- int status = 0;
-
-#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
- if (strcmp(filesystemType, "auto") == 0) {
- static const char *noauto_array[] = { "tmpfs", "shm", "proc", "ramfs", "devpts", "devfs", "usbdevfs", 0 };
- const char **noauto_fstype;
- const int num_of_filesystems = sysfs(3, 0, 0);
- char buf[255];
- int i=0;
-
- filesystemType=buf;
-
- while(i < num_of_filesystems) {
- sysfs(2, i++, filesystemType);
- for (noauto_fstype = noauto_array; *noauto_fstype; noauto_fstype++) {
- if (!strcmp(filesystemType, *noauto_fstype)) {
- break;
- }
- }
- if (!*noauto_fstype) {
- status = do_mount(blockDevice, directory, filesystemType,
- flags | MS_MGC_VAL, string_flags,
- useMtab, fakeIt, mtab_opts, mount_all);
- if (status)
- break;
- }
- }
- }
-#else
- if (strcmp(filesystemType, "auto") == 0) {
- char buf[255];
- FILE *f;
- int read_proc = 0;
-
- f = fopen ( "/etc/filesystems", "r" );
-
- if ( f ) {
- while ( fgets ( buf, sizeof( buf ), f )) {
- if ( *buf == '*' )
- read_proc = 1;
- else if ( *buf == '#' )
- continue;
- else {
- filesystemType = buf;
-
- // Add NULL termination to each line
- while (*filesystemType && !isspace ( *filesystemType ))
- filesystemType++;
- *filesystemType = '\0';
-
- filesystemType = buf;
-
- if ( xstrlen ( filesystemType )) {
- status = do_mount(blockDevice, directory, filesystemType,
- flags | MS_MGC_VAL, string_flags,
- useMtab, fakeIt, mtab_opts, mount_all);
- if (status)
- break;
- }
-
- }
- }
- fclose ( f );
+ int rc = -1, vfsflags;
+ char *loopFile = 0, *filteropts = 0;
+ llist_t *fl = 0;
+ struct stat st;
+
+ vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
+
+ // Treat fstype "auto" as unspecified.
+
+ if (mp->mnt_type && !strcmp(mp->mnt_type,"auto")) mp->mnt_type = 0;
+
+ // Might this be an NFS filesystem?
+
+ if (ENABLE_FEATURE_MOUNT_NFS &&
+ (!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) &&
+ strchr(mp->mnt_fsname, ':') != NULL)
+ {
+ if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &filteropts, 1)) {
+ bb_perror_msg("nfsmount failed");
+ goto report_error;
+ } else {
+ // Strangely enough, nfsmount() doesn't actually mount() anything.
+ mp->mnt_type = "nfs";
+ rc = mount_it_now(mp, vfsflags, filteropts);
+ if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
+
+ goto report_error;