[klibc] [patch] mount add move option

maximilian attems max at stro.at
Thu Jul 24 07:17:23 PDT 2008


On Thu, 24 Jul 2008, Karel Zak wrote:

>  It would be nice to add a short option for 'bind' and 'rbind' too.
> 
>  What about reserve uppercase letters for mount operations?
> 
>     --move  | -M
>     --bind  | -B
>     --rbind | -R

cool, implemented below.
 
> 
>  Note, we also have shared-subtree operations (--make-{slave,private,...})
>  without short options.
--make-unbindable,  --make-rshared, --make-rslave, --make-rprivate, 
--make-runbindable

but i'd guess none of them might be of big interest in initramfs.
so aboves three should be fine.

Signed-off-by: maximilian attems <max at stro.at>

diff --git a/mount/mount.c b/mount/mount.c
index 8527b44..f8c8103 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1862,12 +1862,15 @@ main(int argc, char *argv[]) {
 	initproctitle(argc, argv);
 #endif
 
-	while ((c = getopt_long (argc, argv, "afFhilL:no:O:p:rsU:vVwt:",
+	while ((c = getopt_long (argc, argv, "aBfFhilL:Mno:O:p:rRsU:vVwt:",
 				 longopts, NULL)) != -1) {
 		switch (c) {
 		case 'a':	       /* mount everything in fstab */
 			++mount_all;
 			break;
+		case 'B': /* bind */
+			mounttype = MS_BIND;
+			break;
 		case 'f':	       /* fake: don't actually call mount(2) */
 			++fake;
 			break;
@@ -1886,6 +1889,9 @@ main(int argc, char *argv[]) {
 		case 'L':
 			label = optarg;
 			break;
+		case 'M': /* move */
+			mounttype = MS_MOVE;
+			break;
 		case 'n':		/* do not write /etc/mtab */
 			++nomtab;
 			break;
@@ -1902,6 +1908,9 @@ main(int argc, char *argv[]) {
 			readonly = 1;
 			readwrite = 0;
 			break;
+		case 'R': /* rbind */
+			mounttype = (MS_BIND | MS_REC);
+			break;
 		case 's':		/* allow sloppy mount options */
 			sloppy = 1;
 			break;



More information about the klibc mailing list