aboutsummaryrefslogtreecommitdiff
path: root/util-linux/umount.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/umount.c')
-rw-r--r--util-linux/umount.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 0f087e197..b0f393cca 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -41,6 +41,9 @@ static const char umount_usage[] =
41#ifdef BB_FEATURE_REMOUNT 41#ifdef BB_FEATURE_REMOUNT
42 "\t-r:\tTry to remount devices as read-only if mount is busy\n" 42 "\t-r:\tTry to remount devices as read-only if mount is busy\n"
43#endif 43#endif
44#if defined BB_FEATURE_MOUNT_LOOP
45 "\t-f:\tDo not free loop device (if a loop device has been used)\n"
46#endif
44; 47;
45 48
46struct _mtab_entry_t { 49struct _mtab_entry_t {
@@ -53,9 +56,14 @@ static struct _mtab_entry_t *mtab_cache = NULL;
53 56
54 57
55 58
59#if defined BB_FEATURE_MOUNT_LOOP
60static int freeLoop = TRUE;
61#endif
56static int useMtab = TRUE; 62static int useMtab = TRUE;
57static int umountAll = FALSE; 63static int umountAll = FALSE;
64#if defined BB_FEATURE_REMOUNT
58static int doRemount = FALSE; 65static int doRemount = FALSE;
66#endif
59extern const char mtab_file[]; /* Defined in utility.c */ 67extern const char mtab_file[]; /* Defined in utility.c */
60 68
61 69
@@ -167,7 +175,7 @@ static int do_umount(const char *name, int useMtab)
167 status = umount(name); 175 status = umount(name);
168 176
169#if defined BB_FEATURE_MOUNT_LOOP 177#if defined BB_FEATURE_MOUNT_LOOP
170 if (blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) 178 if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
171 /* this was a loop device, delete it */ 179 /* this was a loop device, delete it */
172 del_loop(blockDevice); 180 del_loop(blockDevice);
173#endif 181#endif
@@ -236,6 +244,11 @@ extern int umount_main(int argc, char **argv)
236 case 'a': 244 case 'a':
237 umountAll = TRUE; 245 umountAll = TRUE;
238 break; 246 break;
247#if defined BB_FEATURE_MOUNT_LOOP
248 case 'f':
249 freeLoop = FALSE;
250 break;
251#endif
239#ifdef BB_MTAB 252#ifdef BB_MTAB
240 case 'n': 253 case 'n':
241 useMtab = FALSE; 254 useMtab = FALSE;