summaryrefslogtreecommitdiff
path: root/packages/busybox/slingbox-1.00/lazy_umount.patch
blob: 0608017e703ed89476461c5a39c53739230db672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- busybox-1.00-orig/util-linux/umount.c	2005-12-16 23:13:33.000000000 -0600
+++ busybox-1.00/util-linux/umount.c	2005-12-16 23:16:49.000000000 -0600
@@ -35,6 +35,7 @@
 #endif
 
 static const int MNT_FORCE = 1;
+static const int MNT_DETACH = 2;	/* Linksys -L mod */
 static const int MS_MGC_VAL = 0xc0ed0000; /* Magic number indicatng "new" flags */
 static const int MS_REMOUNT = 32;	/* Alter flags of a mounted FS.  */
 static const int MS_RDONLY = 1;	/* Mount read-only.  */
@@ -54,7 +55,7 @@
 static struct _mtab_entry_t *mtab_cache = NULL;
 
 
-
+static int doLazy = FALSE;		/* Linksys -L mod */
 #if defined CONFIG_FEATURE_MOUNT_FORCE
 static int doForce = FALSE;
 #endif
@@ -181,6 +182,12 @@
 		/* this was a loop device, delete it */
 		del_loop(blockDevice);
 #endif
+	if (status != 0 && doLazy) {	/* Linksys -L mod */
+		status = umount2(blockDevice, MNT_DETACH);
+		if (status != 0) {
+			bb_error_msg_and_die("lazy umount of %s failed!", blockDevice);
+		}
+	}
 #if defined CONFIG_FEATURE_MOUNT_FORCE
 	if (status != 0 && doForce) {
 		status = umount2(blockDevice, MNT_FORCE);
@@ -259,6 +266,9 @@
 				freeLoop = FALSE;
 				break;
 #endif
+			case 'L':	/* Linksys -L mod */
+				doLazy = TRUE;
+				break;
 #ifdef CONFIG_FEATURE_MTAB_SUPPORT
 			case 'n':
 				useMtab = FALSE;