]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
add ply_unmount_filesystem function to handle lazy umount
authorRay Strode <rstrode@redhat.com>
Mon, 22 Oct 2007 00:45:27 +0000 (20:45 -0400)
committerRay Strode <rstrode@redhat.com>
Mon, 22 Oct 2007 00:45:27 +0000 (20:45 -0400)
The lazy unmount flag isn't documented anywhere, so its
probably better to hide the nastiness behind a function

src/libply/ply-utils.c
src/libply/ply-utils.h

index e1d7a287421219fcd7a18cda39183727528d0563..58a38629b6e7c8cfdd95b65edc24d92d7715f1ad 100644 (file)
@@ -739,14 +739,13 @@ ply_detach_directory (const char *directory)
       return dir_fd;
     }
 
-  if (umount2 (directory, PLY_SUPER_SECRET_LAZY_UNMOUNT_FLAG) < 0)
+  if (!ply_unmount_filesystem (directory))
     {
       ply_save_errno ();
       umount (directory);
       ply_restore_errno ();
       return false;
     }
-
   rmdir (directory);
 
   /* return a file descriptor to the directory because it's now been
@@ -930,4 +929,13 @@ ply_copy_directory (const char *source,
   return true;
 }
 
+bool 
+ply_unmount_filesystem (const char *directory)
+{
+  if (umount2 (directory, PLY_SUPER_SECRET_LAZY_UNMOUNT_FLAG) < 0)
+    return false;
+
+  return true;
+}
+
 /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
index dea2ab3f93f169da44b1cf27c8f18da49e03ef35..91d01ca1169a126f639842eb172c6730ee6550a9 100644 (file)
@@ -81,6 +81,7 @@ bool ply_create_detachable_directory (const char *directory);
 int ply_detach_directory (const char *directory);
 bool ply_copy_file (const char *source, const char *destination);
 bool ply_copy_directory (const char *source, const char *destination);
+bool ply_unmount_filesystem (const char *directory);
 #endif
 
 #endif /* PLY_UTILS_H */