[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 1/2] df: Add a config option to show rootfs
From:       "Lauri Kasanen" <curaga () operamail ! com>
Date:       2011-01-27 16:47:37
Message-ID: 20110127164737.91F6F15F069 () c-in3ws--03-03 ! sv2 ! lotuslive ! com
[Download RAW message or body]

Morning bb'folks!


I would like to have df show rootfs.

Tiny Core runs in the initramfs, and we currently have a kludge in place
to accommodate some installers (and users who want to check free space :)).
In the absence of a bootcode, the rootfs contents are copied to a new tmpfs
and a switch_root is performed.

I just found out it wasn't a bigger limit like I thought, it was merely df
skipping it.


What would be the best way to go? Would a build-time option for that be ok?

- Lauri


--=20
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com


["0001-df-Add-a-config-option-to-show-rootfs.patch" (0001-df-Add-a-config-option-to-show-rootfs.patch)]

From c11cb4ba4312af437f1e7b4d929a9d72e0f92b2b Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <curaga@operamail.com>
Date: Thu, 27 Jan 2011 18:21:46 +0200
Subject: [PATCH 1/2] df: Add a config option to show rootfs

This is useful for embedded systems that run in initramfs.

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
---
 coreutils/Config.src |    9 +++++++++
 coreutils/df.c       |    2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/coreutils/Config.src b/coreutils/Config.src
index 1a044f9..530043e 100644
--- a/coreutils/Config.src
+++ b/coreutils/Config.src
@@ -143,6 +143,15 @@ config FEATURE_DF_FANCY
 	    -i Inodes
 	    -B <SIZE> Blocksize
 
+config FEATURE_DF_ROOTFS
+	bool "Show rootfs"
+	default n
+	depends on DF
+	help
+	  Include rootfs in df output. Only enable this if you run
+	  from initramfs, otherwise "df /" will not show your real
+	  root device.
+
 config DIRNAME
 	bool "dirname"
 	default y
diff --git a/coreutils/df.c b/coreutils/df.c
index af9b77b..c4f7907 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -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 (strcmp(device, "rootfs") == 0 && !ENABLE_FEATURE_DF_ROOTFS)
 				continue;
 
 #ifdef WHY_WE_DO_IT_FOR_DEV_ROOT_ONLY
-- 
1.7.2.1



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic