aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/umount.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index c958fd552..0c50dc9ee 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -42,7 +42,7 @@
42//usage: "\n -l Lazy umount (detach filesystem)" 42//usage: "\n -l Lazy umount (detach filesystem)"
43//usage: "\n -f Force umount (i.e., unreachable NFS server)" 43//usage: "\n -f Force umount (i.e., unreachable NFS server)"
44//usage: IF_FEATURE_MOUNT_LOOP( 44//usage: IF_FEATURE_MOUNT_LOOP(
45//usage: "\n -D Don't free loop device even if it has been used" 45//usage: "\n -d Free loop device if it has been used"
46//usage: ) 46//usage: )
47//usage: 47//usage:
48//usage:#define umount_example_usage 48//usage:#define umount_example_usage
@@ -68,22 +68,14 @@ static struct mntent *getmntent_r(FILE* stream, struct mntent* result,
68} 68}
69#endif 69#endif
70 70
71/* Ignored: -v -t -i 71/* ignored: -v -t -i */
72 * bbox always acts as if -d is present. 72#define OPTION_STRING "fldnra" "vt:i"
73 * -D can be used to suppress it (bbox extension).
74 * Rationale:
75 * (1) util-linux's umount does it if "loop=..." is seen in /etc/mtab:
76 * thus, on many systems, bare umount _does_ drop loop devices.
77 * (2) many users request this feature.
78 */
79#define OPTION_STRING "fldDnra" "vt:i"
80#define OPT_FORCE (1 << 0) // Same as MNT_FORCE 73#define OPT_FORCE (1 << 0) // Same as MNT_FORCE
81#define OPT_LAZY (1 << 1) // Same as MNT_DETACH 74#define OPT_LAZY (1 << 1) // Same as MNT_DETACH
82//#define OPT_FREE_LOOP (1 << 2) // -d is assumed always present 75#define OPT_FREELOOP (1 << 2)
83#define OPT_DONT_FREE_LOOP (1 << 3) 76#define OPT_NO_MTAB (1 << 3)
84#define OPT_NO_MTAB (1 << 4) 77#define OPT_REMOUNT (1 << 4)
85#define OPT_REMOUNT (1 << 5) 78#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 5) : 0)
86#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 6) : 0)
87 79
88int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 80int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
89int umount_main(int argc UNUSED_PARAM, char **argv) 81int umount_main(int argc UNUSED_PARAM, char **argv)
@@ -206,7 +198,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
206 } else { 198 } else {
207 // De-allocate the loop device. This ioctl should be ignored on 199 // De-allocate the loop device. This ioctl should be ignored on
208 // any non-loop block devices. 200 // any non-loop block devices.
209 if (ENABLE_FEATURE_MOUNT_LOOP && !(opt & OPT_DONT_FREE_LOOP) && m) 201 if (ENABLE_FEATURE_MOUNT_LOOP && (opt & OPT_FREELOOP) && m)
210 del_loop(m->device); 202 del_loop(m->device);
211 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m) 203 if (ENABLE_FEATURE_MTAB_SUPPORT && !(opt & OPT_NO_MTAB) && m)
212 erase_mtab(m->dir); 204 erase_mtab(m->dir);