aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-04-17 13:07:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2012-04-17 13:07:28 +0200
commit86a03bee1d3d6990c03bf500836b19ec8a1c1f12 (patch)
treef86a7cc1aed9d415e5cbd4bbbcddbd401eaaf7d3
parentee0d4cd8cb64a4ef7f10a89c7d51145d44cc6d49 (diff)
downloadbusybox-w32-86a03bee1d3d6990c03bf500836b19ec8a1c1f12.tar.gz
busybox-w32-86a03bee1d3d6990c03bf500836b19ec8a1c1f12.tar.bz2
busybox-w32-86a03bee1d3d6990c03bf500836b19ec8a1c1f12.zip
umount: make -d always active, add -D to suppress it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/umount.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 5b716c688..4c2e8821e 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -22,7 +22,7 @@
22//usage: "\n -l Lazy umount (detach filesystem)" 22//usage: "\n -l Lazy umount (detach filesystem)"
23//usage: "\n -f Force umount (i.e., unreachable NFS server)" 23//usage: "\n -f Force umount (i.e., unreachable NFS server)"
24//usage: IF_FEATURE_MOUNT_LOOP( 24//usage: IF_FEATURE_MOUNT_LOOP(
25//usage: "\n -d Free loop device if it has been used" 25//usage: "\n -D Don't free loop device even if it has been used"
26//usage: ) 26//usage: )
27//usage: 27//usage:
28//usage:#define umount_example_usage 28//usage:#define umount_example_usage
@@ -44,14 +44,22 @@ static struct mntent *getmntent_r(FILE* stream, struct mntent* result,
44} 44}
45#endif 45#endif
46 46
47/* ignored: -v -d -t -i */ 47/* Ignored: -v -t -i
48#define OPTION_STRING "fldnra" "vdt:i" 48 * bbox always acts as if -d is present.
49 * -D can be used to suppress it (bbox extension).
50 * Rationale:
51 * (1) util-linux's umount does it if "loop=..." is seen in /etc/mtab:
52 * thus, on many systems, bare umount _does_ drop loop devices.
53 * (2) many users request this feature.
54 */
55#define OPTION_STRING "fldDnra" "vt:i"
49#define OPT_FORCE (1 << 0) // Same as MNT_FORCE 56#define OPT_FORCE (1 << 0) // Same as MNT_FORCE
50#define OPT_LAZY (1 << 1) // Same as MNT_DETACH 57#define OPT_LAZY (1 << 1) // Same as MNT_DETACH
51#define OPT_FREELOOP (1 << 2) 58//#define OPT_FREE_LOOP (1 << 2) // -d is assumed always present
52#define OPT_NO_MTAB (1 << 3) 59#define OPT_DONT_FREE_LOOP (1 << 3)
53#define OPT_REMOUNT (1 << 4) 60#define OPT_NO_MTAB (1 << 4)
54#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 5) : 0) 61#define OPT_REMOUNT (1 << 5)
62#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 6) : 0)
55 63
56int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 64int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
57int umount_main(int argc UNUSED_PARAM, char **argv) 65int umount_main(int argc UNUSED_PARAM, char **argv)
@@ -165,7 +173,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
165 } else { 173 } else {
166 // De-allocate the loop device. This ioctl should be ignored on 174 // De-allocate the loop device. This ioctl should be ignored on
167 // any non-loop block devices. 175 // any non-loop block devices.
168 if (ENABLE_FEATURE_MOUNT_LOOP && (opt & OPT_FREELOOP) && m) 176 if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONT_FREE_LOOP) && m)
169 del_loop(m->device); 177 del_loop(m->device);
170 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m) 178 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m)
171 erase_mtab(m->dir); 179 erase_mtab(m->dir);