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.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 74638d21c..99db3084c 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -2,9 +2,8 @@
2/* 2/*
3 * Mini umount implementation for busybox 3 * Mini umount implementation for busybox
4 * 4 *
5 * 5 * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
6 * Copyright (C) 1999,2000,2001 by Lineo, inc. 6 * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
7 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -57,13 +56,13 @@ static struct _mtab_entry_t *mtab_cache = NULL;
57 56
58 57
59 58
60#if defined BB_FEATURE_MOUNT_FORCE 59#if defined CONFIG_FEATURE_MOUNT_FORCE
61static int doForce = FALSE; 60static int doForce = FALSE;
62#endif 61#endif
63#if defined BB_FEATURE_MOUNT_LOOP 62#if defined CONFIG_FEATURE_MOUNT_LOOP
64static int freeLoop = TRUE; 63static int freeLoop = TRUE;
65#endif 64#endif
66#if defined BB_FEATURE_MTAB_SUPPORT 65#if defined CONFIG_FEATURE_MTAB_SUPPORT
67static int useMtab = TRUE; 66static int useMtab = TRUE;
68#endif 67#endif
69static int umountAll = FALSE; 68static int umountAll = FALSE;
@@ -112,7 +111,7 @@ static char *mtab_getinfo(const char *match, const char which)
112 if (which == MTAB_GETMOUNTPT) { 111 if (which == MTAB_GETMOUNTPT) {
113 return cur->mountpt; 112 return cur->mountpt;
114 } else { 113 } else {
115#if !defined BB_FEATURE_MTAB_SUPPORT 114#if !defined CONFIG_FEATURE_MTAB_SUPPORT
116 if (strcmp(cur->device, "/dev/root") == 0) { 115 if (strcmp(cur->device, "/dev/root") == 0) {
117 /* Adjusts device to be the real root device, 116 /* Adjusts device to be the real root device,
118 * or leaves device alone if it can't find it */ 117 * or leaves device alone if it can't find it */
@@ -151,7 +150,7 @@ static char *mtab_first(void **iter)
151 150
152/* Don't bother to clean up, since exit() does that 151/* Don't bother to clean up, since exit() does that
153 * automagically, so we can save a few bytes */ 152 * automagically, so we can save a few bytes */
154#ifdef BB_FEATURE_CLEAN_UP 153#ifdef CONFIG_FEATURE_CLEAN_UP
155static void mtab_free(void) 154static void mtab_free(void)
156{ 155{
157 struct _mtab_entry_t *this, *next; 156 struct _mtab_entry_t *this, *next;
@@ -179,12 +178,12 @@ static int do_umount(const char *name)
179 178
180 status = umount(name); 179 status = umount(name);
181 180
182#if defined BB_FEATURE_MOUNT_LOOP 181#if defined CONFIG_FEATURE_MOUNT_LOOP
183 if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) 182 if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
184 /* this was a loop device, delete it */ 183 /* this was a loop device, delete it */
185 del_loop(blockDevice); 184 del_loop(blockDevice);
186#endif 185#endif
187#if defined BB_FEATURE_MOUNT_FORCE 186#if defined CONFIG_FEATURE_MOUNT_FORCE
188 if (status != 0 && doForce == TRUE) { 187 if (status != 0 && doForce == TRUE) {
189 status = umount2(blockDevice, MNT_FORCE); 188 status = umount2(blockDevice, MNT_FORCE);
190 if (status != 0) { 189 if (status != 0) {
@@ -202,7 +201,7 @@ static int do_umount(const char *name)
202 } 201 }
203 } 202 }
204 if (status == 0) { 203 if (status == 0) {
205#if defined BB_FEATURE_MTAB_SUPPORT 204#if defined CONFIG_FEATURE_MTAB_SUPPORT
206 if (useMtab == TRUE) 205 if (useMtab == TRUE)
207 erase_mtab(name); 206 erase_mtab(name);
208#endif 207#endif
@@ -246,7 +245,7 @@ extern int umount_main(int argc, char **argv)
246 if (argc < 2) { 245 if (argc < 2) {
247 show_usage(); 246 show_usage();
248 } 247 }
249#ifdef BB_FEATURE_CLEAN_UP 248#ifdef CONFIG_FEATURE_CLEAN_UP
250 atexit(mtab_free); 249 atexit(mtab_free);
251#endif 250#endif
252 251
@@ -257,17 +256,17 @@ extern int umount_main(int argc, char **argv)
257 case 'a': 256 case 'a':
258 umountAll = TRUE; 257 umountAll = TRUE;
259 break; 258 break;
260#if defined BB_FEATURE_MOUNT_LOOP 259#if defined CONFIG_FEATURE_MOUNT_LOOP
261 case 'l': 260 case 'l':
262 freeLoop = FALSE; 261 freeLoop = FALSE;
263 break; 262 break;
264#endif 263#endif
265#ifdef BB_FEATURE_MTAB_SUPPORT 264#ifdef CONFIG_FEATURE_MTAB_SUPPORT
266 case 'n': 265 case 'n':
267 useMtab = FALSE; 266 useMtab = FALSE;
268 break; 267 break;
269#endif 268#endif
270#ifdef BB_FEATURE_MOUNT_FORCE 269#ifdef CONFIG_FEATURE_MOUNT_FORCE
271 case 'f': 270 case 'f':
272 doForce = TRUE; 271 doForce = TRUE;
273 break; 272 break;