[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] Re: [patch] lazy umount
From:       Rafael =?utf-8?q?=C3=81vila_de_Esp=C3=ADndola?= <rafael.espindola () gmail ! com>
Date:       2005-07-29 18:23:48
Message-ID: 200507291523.59670.rafael.espindola () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


The attached patch fixes a silly error in my previous patch.

Rafael

["umount-lazy.patch" (text/x-diff)]

Index: include/usage.h
===================================================================
--- include/usage.h	(revision 10957)
+++ include/usage.h	(working copy)
@@ -2963,9 +2963,10 @@
 	"Unmount file systems\n" \
 	"\nFlags:\n" "\t-a\tUnmount all file systems" \
 	USAGE_MTAB(" in /etc/mtab\n\t-n\tDon't erase /etc/mtab entries") \
+	"\n\t-l\tLazy unmount" \
 	"\n\t-r\tTry to remount devices as read-only if mount is busy" \
 	USAGE_MOUNT_FORCE("\n\t-f\tForce umount (i.e., unreachable NFS server)") \
-	USAGE_MOUNT_LOOP("\n\t-l\tDo not free loop device (if a loop device has been used)")
+	USAGE_MOUNT_LOOP("\n\t-d\tFree loop device (if a loop device has been used)")
 #define umount_example_usage \
 	"$ umount /dev/hdc1 \n"
 
Index: util-linux/umount.c
===================================================================
--- util-linux/umount.c	(revision 10957)
+++ util-linux/umount.c	(working copy)
@@ -35,6 +35,7 @@
 #endif
 
 static const int MNT_FORCE = 1;
+static const int MNT_DETACH = 2;
 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.  */
@@ -59,13 +60,14 @@
 static int doForce = FALSE;
 #endif
 #if defined CONFIG_FEATURE_MOUNT_LOOP
-static int freeLoop = TRUE;
+static int freeLoop = FALSE;
 #endif
 #if defined CONFIG_FEATURE_MTAB_SUPPORT
 static int useMtab = TRUE;
 #endif
 static int umountAll = FALSE;
 static int doRemount = FALSE;
+static int umountLazy = FALSE;
 
 
 
@@ -174,7 +176,10 @@
 	if (blockDevice && strcmp(blockDevice, name) == 0)
 		name = mtab_getinfo(blockDevice, MTAB_GETMOUNTPT);
 
-	status = umount(name);
+	if(umountLazy)
+	  status = umount2(name, MNT_DETACH);
+	else
+	  status = umount(name);
 
 #if defined CONFIG_FEATURE_MOUNT_LOOP
 	if (freeLoop && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
@@ -254,10 +259,13 @@
 			case 'a':
 				umountAll = TRUE;
 				break;
-#if defined CONFIG_FEATURE_MOUNT_LOOP
 			case 'l':
-				freeLoop = FALSE;
+				umountLazy = TRUE;
 				break;
+#if defined CONFIG_FEATURE_MOUNT_LOOP
+			case 'd':
+				freeLoop = TRUE;
+				break;
 #endif
 #ifdef CONFIG_FEATURE_MTAB_SUPPORT
 			case 'n':

[Attachment #8 (application/pgp-signature)]

_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic