Add --fake option to umount(8), which omits calling the actual umount syscall (and the loop device deletion) but modifies /etc/mtab. This is similar to the -f or --fake option to mount(8). This would allow some simplifications in fuse by allowing it to call the umount syscall and letting umount(8) just update mtab. Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx> --- mount/umount.8 | 6 ++++++ mount/umount.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) Index: util-linux-ng/mount/umount.8 =================================================================== --- util-linux-ng.orig/mount/umount.8 2010-03-08 18:26:44.000000000 +0100 +++ util-linux-ng/mount/umount.8 2010-03-08 18:26:53.000000000 +0100 @@ -123,6 +123,12 @@ anymore. Don't canonicalize paths. For more details about this option see the .B mount(8) man page. +.IP "\fB\-\-fake\fP" +Causes everything to be done except for the actual system call; this +``fakes'' unmounting the filesystem. It can be used to remove +entries from +.I /etc/mtab +that were unmounted earlier with the -n option. .SH "THE LOOP DEVICE" The Index: util-linux-ng/mount/umount.c =================================================================== --- util-linux-ng.orig/mount/umount.c 2010-03-08 18:26:44.000000000 +0100 +++ util-linux-ng/mount/umount.c 2010-03-08 19:00:21.000000000 +0100 @@ -81,6 +81,9 @@ int restricted = 1; int complained_err = 0; char *complained_dev = NULL; +/* True for fake umount (--fake). */ +static int fake = 0; + /* * check_special_umountprog() * If there is a special umount program for this type, exec it. @@ -210,6 +213,9 @@ umount_one (const char *spec, const char if (check_special_umountprog(spec, node, type, &status)) return status; + /* Skip the actual umounting for --fake */ + if (fake) + goto writemtab; /* * Ignore the option "-d" for non-loop devices and loop devices with * LO_FLAGS_AUTOCLEAR flag. @@ -390,6 +396,7 @@ static struct option longopts[] = { "types", 1, 0, 't' }, { "no-canonicalize", 0, 0, 144 }, + { "fake", 0, 0, 145 }, { NULL, 0, 0, 0 } }; @@ -679,6 +686,9 @@ main (int argc, char *argv[]) { case 144: nocanonicalize = 1; break; + case 145: + fake = 1; + break; case 0: break; case '?': @@ -697,7 +707,8 @@ main (int argc, char *argv[]) { } if (restricted && - (all || types || nomtab || force || remount || nocanonicalize)) { + (all || types || nomtab || force || remount || nocanonicalize || + fake)) { die (2, _("umount: only root can do that")); } -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html