]> wimlib.net Git - wimlib/blobdiff - src/mount.c
Acquire advisory lock when doing a read-write mount
[wimlib] / src / mount.c
index 67a6eddbe97433caed27554932216999624a737f..1290bd546486c7565eac1bdfa20211b10a563b37 100644 (file)
@@ -1856,7 +1856,8 @@ static struct fuse_operations wimfs_operations = {
 /* Mounts an image from a WIM file. */
 WIMLIBAPI int wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
                                 int mount_flags, WIMStruct **additional_swms,
-                                unsigned num_additional_swms)
+                                unsigned num_additional_swms,
+                                const char *staging_dir)
 {
        int argc = 0;
        char *argv[16];
@@ -1914,6 +1915,12 @@ WIMLIBAPI int wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
                goto out;
        }
 
+       if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) {
+               ret = lock_wim(wim->fp, wim->filename);
+               if (ret != 0)
+                       goto out;
+       }
+
        if (!(mount_flags & (WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_NONE |
                       WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_XATTR |
                       WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS)))
@@ -2031,7 +2038,8 @@ out:
  * Unmounts the WIM file that was previously mounted on @dir by using
  * wimlib_mount_image().
  */
-WIMLIBAPI int wimlib_unmount_image(const char *dir, int unmount_flags)
+WIMLIBAPI int wimlib_unmount_image(const char *dir, int unmount_flags,
+                                  wimlib_progress_func_t progress_func)
 {
        pid_t pid;
        int status;
@@ -2208,14 +2216,16 @@ static inline int mount_unsupported_error()
        return WIMLIB_ERR_UNSUPPORTED;
 }
 
-WIMLIBAPI int wimlib_unmount_image(const char *dir, int unmount_flags)
+WIMLIBAPI int wimlib_unmount_image(const char *dir, int unmount_flags,
+                                  wimlib_progress_func_t progress_func)
 {
        return mount_unsupported_error();
 }
 
 WIMLIBAPI int wimlib_mount_image(WIMStruct *wim_p, int image, const char *dir,
                                 int mount_flags, WIMStruct **additional_swms,
-                                unsigned num_additional_swms)
+                                unsigned num_additional_swms,
+                                const char *staging_dir)
 {
        return mount_unsupported_error();
 }