[patch v3] mount: add shortoptions for bind, move and rbind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reserving uppercase letters for mount operations:

    --move  | -M
    --bind  | -B
    --rbind | -R

Add lowercase for the most needed mount operation that happen
in initramfs: mount -M /sys /root/sys

Note, we still have shared-subtree operations (--make-{slave,private,...})
without short options.

Signed-off-by: maximilian attems <max@xxxxxxx>

diff --git a/mount/mount.8 b/mount/mount.8
index 6af12e4..b5e604b 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -108,6 +108,11 @@ file hierarchy somewhere else. The call is
 .br
 .B "mount --bind olddir newdir"
 .RE
+or shortoption
+.RS
+.br
+.B "mount -B olddir newdir"
+.RE
 or fstab entry is:
 .RS
 .br
@@ -123,6 +128,11 @@ a second place using
 .br
 .B "mount --rbind olddir newdir"
 .RE
+or shortoption
+.RS
+.br
+.B "mount -R olddir newdir"
+.RE
 .\" available since Linux 2.4.11.
 
 Note that the filesystem mount options will remain the same as those
@@ -135,6 +145,11 @@ to another place. The call is
 .br
 .B "mount --move olddir newdir"
 .RE
+or shortoption
+.RS
+.br
+.B "mount -M olddir newdir"
+.RE
 
 Since Linux 2.6.15 it is possible to mark a mount and its submounts as shared,
 private, slave or unbindable. A shared mount provides ability to create mirrors
diff --git a/mount/mount.c b/mount/mount.c
index 8527b44..2fe90d7 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1672,10 +1672,10 @@ static struct option longopts[] = {
 	{ "test-opts", 1, 0, 'O' },
 	{ "pass-fd", 1, 0, 'p' },
 	{ "types", 1, 0, 't' },
-	{ "bind", 0, 0, 128 },
-	{ "move", 0, 0, 133 },
+	{ "bind", 0, 0, 'B' },
+	{ "move", 0, 0, 'M' },
 	{ "guess-fstype", 1, 0, 134 },
-	{ "rbind", 0, 0, 135 },
+	{ "rbind", 0, 0, 'R' },
 	{ "make-shared", 0, 0, 136 },
 	{ "make-slave", 0, 0, 137 },
 	{ "make-private", 0, 0, 138 },
@@ -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;
@@ -1924,12 +1933,6 @@ main(int argc, char *argv[]) {
 		case 0:
 			break;
 
-		case 128: /* bind */
-			mounttype = MS_BIND;
-			break;
-		case 133: /* move */
-			mounttype = MS_MOVE;
-			break;
 		case 134:
 			/* undocumented, may go away again:
 			   call: mount --guess-fstype device
@@ -1941,9 +1944,6 @@ main(int argc, char *argv[]) {
 			printf("%s\n", fstype ? fstype : "unknown");
 			exit(fstype ? 0 : EX_FAIL);
 		    }
-		case 135:
-			mounttype = (MS_BIND | MS_REC);
-			break;
 
 		case 136:
 			mounttype = MS_SHARED;
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux