+ wrap things in B<> to make pod2man happy
[oweals/busybox.git] / mount.c
diff --git a/mount.c b/mount.c
index f46664bf4f3b86945d875ac3c7f760db95176605..972e5066cbcb2978abdd719fff7da82cf1e1d79e 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -45,8 +45,7 @@
 #include <mntent.h>
 #include <sys/mount.h>
 #include <ctype.h>
-#include <fstab.h>
-#if defined BB_FEATURE_USE_DEVPS_N_DEVMTAB
+#if defined BB_FEATURE_USE_DEVPS_PATCH
 #include <linux/devmtab.h>
 #endif
 
@@ -84,8 +83,6 @@ static const char mount_usage[] = "\tmount [flags]\n"
        "\tsuid / nosuid:\tAllow set-user-id-root programs / disallow them.\n"
        "\tremount: Re-mount a currently-mounted filesystem, changing its flags.\n"
        "\tro / rw: Mount for read-only / read-write.\n"
-       "\t"
-
        "There are EVEN MORE flags that are specific to each filesystem.\n"
        "You'll have to see the written documentation for those.\n";
 
@@ -142,7 +139,6 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
                                fprintf(stderr, "WARNING: loop device is read-only\n");
                                flags &= ~MS_RDONLY;
                        }
-                       use_loop = FALSE;
                }
 #endif
                status =
@@ -255,7 +251,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
                fclose(f);
        } else
 #endif
-#if defined BB_FEATURE_USE_DEVPS_N_DEVMTAB
+#if defined BB_FEATURE_USE_DEVPS_PATCH
        if (strcmp(filesystemType, "auto") == 0) {
                int fd, i, numfilesystems;
                char device[] = "/dev/mtab";
@@ -322,10 +318,7 @@ extern int mount_main(int argc, char **argv)
        int useMtab = TRUE;
        int i;
 
-       /* Only compiled in if BB_MTAB is not defined */
-       whine_if_fstab_is_missing();
-
-#if defined BB_FEATURE_USE_DEVPS_N_DEVMTAB
+#if defined BB_FEATURE_USE_DEVPS_PATCH
        if (argc == 1) {
                int fd, i, numfilesystems;
                char device[] = "/dev/mtab";
@@ -353,8 +346,12 @@ extern int mount_main(int argc, char **argv)
                                        mntentlist[i].mnt_opts, mntentlist[i].mnt_freq, 
                                        mntentlist[i].mnt_passno);
                }
+               /* Don't bother to close files or free memory.  Exit 
+                * does that automagically, so we can save a few bytes */
+#if 0
                free( mntentlist);
                close(fd);
+#endif
                exit(TRUE);
        }
 #else
@@ -365,14 +362,9 @@ extern int mount_main(int argc, char **argv)
                        struct mntent *m;
 
                        while ((m = getmntent(mountTable)) != 0) {
-                               struct fstab *fstabItem;
                                char *blockDevice = m->mnt_fsname;
-
-                               /* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
                                if (strcmp(blockDevice, "/dev/root") == 0) {
-                                       fstabItem = getfsfile("/");
-                                       if (fstabItem != NULL)
-                                               blockDevice = fstabItem->fs_spec;
+                                       find_real_root_device_name( blockDevice);
                                }
                                printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
                                           m->mnt_type, m->mnt_opts);
@@ -415,15 +407,16 @@ extern int mount_main(int argc, char **argv)
                                case 'a':
                                        all = TRUE;
                                        break;
-#ifdef BB_MTAB
                                case 'f':
                                        fakeIt = TRUE;
                                        break;
+#ifdef BB_MTAB
                                case 'n':
                                        useMtab = FALSE;
                                        break;
 #endif
                                case 'v':
+                                       break; /* ignore -v */
                                case 'h':
                                case '-':
                                        goto goodbye;
@@ -446,7 +439,7 @@ extern int mount_main(int argc, char **argv)
                FILE *f = setmntent("/etc/fstab", "r");
 
                if (f == NULL)
-                       fatalError( "\nCannot ream /etc/fstab: %s\n", strerror (errno));
+                       fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno));
 
                while ((m = getmntent(f)) != NULL) {
                        // If the file system isn't noauto,