svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Mon Oct 2 11:52:49 PDT 2006


Author: vda
Date: 2006-10-02 11:52:49 -0700 (Mon, 02 Oct 2006)
New Revision: 16291

Log:
mount: accept and ignore -s (sloppy) option.
needed for compatibility with Linux automounter.


Modified:
   trunk/busybox/util-linux/mount.c


Changeset:
Modified: trunk/busybox/util-linux/mount.c
===================================================================
--- trunk/busybox/util-linux/mount.c	2006-10-02 18:52:14 UTC (rev 16290)
+++ trunk/busybox/util-linux/mount.c	2006-10-02 18:52:49 UTC (rev 16291)
@@ -92,8 +92,8 @@
 	{"remount", MS_REMOUNT},  // action flag
 };
 
+#define VECTOR_SIZE(v) (sizeof(v) / sizeof((v)[0]))
 
-
 /* Append mount options to string */
 static void append_mount_options(char **oldopts, char *newopts)
 {
@@ -139,7 +139,7 @@
 		if (comma) *comma = 0;
 
 		// Find this option in mount_options
-		for (i = 0; i < (sizeof(mount_options) / sizeof(*mount_options)); i++) {
+		for (i = 0; i < VECTOR_SIZE(mount_options); i++) {
 			if (!strcasecmp(mount_options[i].name, options)) {
 				long fl = mount_options[i].flags;
 				if (fl < 0) flags &= fl;
@@ -148,9 +148,7 @@
 			}
 		}
 		// If unrecognized not NULL, append unrecognized mount options */
-		if (unrecognized
-				&& i == (sizeof(mount_options) / sizeof(*mount_options)))
-		{
+		if (unrecognized && i == VECTOR_SIZE(mount_options)) {
 			// Add it to strflags, to pass on to kernel
 			i = *unrecognized ? strlen(*unrecognized) : 0;
 			*unrecognized = xrealloc(*unrecognized, i+strlen(options)+2);
@@ -1446,7 +1444,7 @@
 
 	// Parse remaining options
 
-	opt = bb_getopt_ulflags(argc, argv, "o:t:rwanfv", &opt_o, &fstype);
+	opt = bb_getopt_ulflags(argc, argv, "o:t:rwanfvs", &opt_o, &fstype);
 	if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o
 	//if (opt & 0x2) // -t
 	if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r
@@ -1454,7 +1452,8 @@
 	//if (opt & 0x10) // -a
 	if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = 0); // -n
 	if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1); // -f
-	//if (opt & 0x80) // -v: ignore
+	//if (opt & 0x80) // -v: verbose (ignore)
+	//if (opt & 0x100) // -s: sloppy (ignore)
 	argv += optind;
 	argc -= optind;
 
@@ -1499,8 +1498,10 @@
 		goto clean_up;
 	}
 
+	i = parse_mount_options(cmdopts, 0);
+
 	// If we have a shared subtree flag, don't worry about fstab or mtab.
-	i = parse_mount_options(cmdopts,0);
+
 	if (ENABLE_FEATURE_MOUNT_FLAGS &&
 			(i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE )))
 	{
@@ -1511,17 +1512,16 @@
 
 	// Open either fstab or mtab
 
-	if (parse_mount_options(cmdopts,0) & MS_REMOUNT)
+	if (i & MS_REMOUNT)
 		fstabname = bb_path_mtab_file;
 	else fstabname = "/etc/fstab";
-
 	fstab = setmntent(fstabname,"r");
 	if (!fstab)
 		bb_perror_msg_and_die("cannot read %s", fstabname);
 
 	// Loop through entries until we find what we're looking for.
 
-	memset(mtpair,0,sizeof(mtpair));
+	memset(mtpair, 0, sizeof(mtpair));
 	for (;;) {
 		struct mntent *mtnext = (mtcur==mtpair ? mtpair+1 : mtpair);
 



More information about the busybox-cvs mailing list