df,find_mount_point: optionally don't ignore rootfs
authorLauri Kasanen <curaga@operamail.com>
Mon, 31 Jan 2011 05:27:35 +0000 (06:27 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 31 Jan 2011 05:27:35 +0000 (06:27 +0100)
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/df.c
libbb/Config.src
libbb/find_mount_point.c

index af9b77b23935e46fa8d6e0b0c54f7213cd17f163..70fd1f4fdd5d741512a42b9d8339e4c7f71b1088 100644 (file)
@@ -160,7 +160,7 @@ int df_main(int argc UNUSED_PARAM, char **argv)
                        }
 
                        /* GNU coreutils 6.10 skips certain mounts, try to be compatible.  */
-                       if (strcmp(device, "rootfs") == 0)
+                       if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(device, "rootfs") == 0)
                                continue;
 
 #ifdef WHY_WE_DO_IT_FOR_DEV_ROOT_ONLY
index 85892d3fe15de6248cd1c54433afa8063fbee99f..dfb897d5f6863e1e9bb45adcec6e3524523e0b71 100644 (file)
@@ -161,6 +161,25 @@ config FEATURE_COPYBUF_KB
          Bigger buffers will be allocated with mmap, with fallback to 4 kb
          stack buffer if mmap fails.
 
+config FEATURE_SKIP_ROOTFS
+       bool "Skip rootfs in mount table"
+       default y
+       help
+         Ignore rootfs entry in mount table.
+
+         In Linux, kernel has a special filesystem, rootfs, which is initially
+         mounted on /. It contains initramfs data, if kernel is configured
+         to have one. Usually, another file system is mounted over / early
+         in boot process, and therefore most tools which manipulate
+         mount table, such as df, will skip rootfs entry.
+
+         However, some systems do not mount anything on /.
+         If you need to configure busybox for one of these systems,
+         you may find useful to turn this option off to make df show
+         initramfs statistic.
+
+         Otherwise, choose Y.
+
 config MONOTONIC_SYSCALL
        bool "Use clock_gettime(CLOCK_MONOTONIC) syscall"
        default n
index 361698a6bd43f3e83f8406584f876b13f1e1bc65..56637ad923502a0d52a4684558c56fb8cd466940 100644 (file)
@@ -43,7 +43,7 @@ struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too)
                /* rootfs mount in Linux 2.6 exists always,
                 * and it makes sense to always ignore it.
                 * Otherwise people can't reference their "real" root! */
-               if (strcmp(mountEntry->mnt_fsname, "rootfs") == 0)
+               if (ENABLE_FEATURE_SKIP_ROOTFS && strcmp(mountEntry->mnt_fsname, "rootfs") == 0)
                        continue;
 
                if (strcmp(name, mountEntry->mnt_dir) == 0