summaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-09 19:51:13 +0000
committerRob Landley <rob@landley.net>2006-08-09 19:51:13 +0000
commit3ba7bd143ea906a6c00b96136f70d3b1cf24d63c (patch)
treed31b6c0e00dfc085f06ca4f997dfbda8f26231df /util-linux/mount.c
parent721b46e0e608d7ceccf422551d2f53f1c23c285c (diff)
downloadbusybox-w32-3ba7bd143ea906a6c00b96136f70d3b1cf24d63c.tar.gz
busybox-w32-3ba7bd143ea906a6c00b96136f70d3b1cf24d63c.tar.bz2
busybox-w32-3ba7bd143ea906a6c00b96136f70d3b1cf24d63c.zip
Vladimir Dronnikov convinced me to twiddle the semantics of the new shared
subtree stuff to look more like http://lwn.net/Articles/159077/ thinks they should.
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r--util-linux/mount.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 5798a8bfa..93a94bc77 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -28,6 +28,7 @@
28// Not real flags, but we want to be able to check for this. 28// Not real flags, but we want to be able to check for this.
29#define MOUNT_NOAUTO (1<<29) 29#define MOUNT_NOAUTO (1<<29)
30#define MOUNT_SWAP (1<<30) 30#define MOUNT_SWAP (1<<30)
31
31/* Standard mount options (from -o options or --options), with corresponding 32/* Standard mount options (from -o options or --options), with corresponding
32 * flags */ 33 * flags */
33 34
@@ -291,7 +292,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
291 // Look at the file. (Not found isn't a failure for remount, or for 292 // Look at the file. (Not found isn't a failure for remount, or for
292 // a synthetic filesystem like proc or sysfs.) 293 // a synthetic filesystem like proc or sysfs.)
293 294
294 if (!lstat(mp->mnt_fsname, &st) && !(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE | MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))) 295 if (!lstat(mp->mnt_fsname, &st) && !(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
295 { 296 {
296 // Do we need to allocate a loopback device for it? 297 // Do we need to allocate a loopback device for it?
297 298
@@ -455,16 +456,24 @@ int mount_main(int argc, char **argv)
455 goto clean_up; 456 goto clean_up;
456 } 457 }
457 458
458 // If we have at least one argument, it's the storage location 459 // If we have a shared subtree flag, don't worry about fstab or mtab.
459 460 i = parse_mount_options(cmdopts,0);
460 if (optind < argc) storage_path = bb_simplify_path(argv[optind]); 461 if (ENABLE_FEATURE_MOUNT_FLAGS &&
461 462 (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE )))
463 {
464 rc = mount("", argv[optind], "", i, "");
465 if (rc) bb_perror_msg_and_die("%s", argv[optind]);
466 goto clean_up;
467 }
468
462 // Open either fstab or mtab 469 // Open either fstab or mtab
463 470
464 if (parse_mount_options(cmdopts,0) & MS_REMOUNT) 471 if (parse_mount_options(cmdopts,0) & MS_REMOUNT)
465 fstabname = bb_path_mtab_file; 472 fstabname = bb_path_mtab_file;
466 else fstabname="/etc/fstab"; 473 else fstabname="/etc/fstab";
467 474
475 storage_path = bb_simplify_path(argv[optind]);
476
468 if (!(fstab=setmntent(fstabname,"r"))) 477 if (!(fstab=setmntent(fstabname,"r")))
469 bb_perror_msg_and_die("Cannot read %s",fstabname); 478 bb_perror_msg_and_die("Cannot read %s",fstabname);
470 479