/* List of lookup table entries in the staging directory */
struct list_head staging_list;
+ /* List of inodes in the mounted image */
+ struct hlist_head *image_inode_list;
+
/* Name and message queue descriptors for message queues between the filesystem
* daemon process and the unmount process. These are used when the filesystem
* is unmounted and the process running wimlib_mount() (i.e. the `imagex
new->d_inode->resolved = 1;
new->d_inode->ino = ctx->next_ino++;
dentry_add_child(parent, new);
+ hlist_add_head(&new->d_inode->hlist, ctx->image_inode_list);
*dentry_ret = new;
return 0;
}
int ret;
int fd;
struct lookup_table_entry *old_lte, *new_lte;
- off_t old_size;
off_t extract_size;
DEBUG("Extracting resource to staging dir: inode %"PRIu64", "
if (ret == 0) {
if (ctx->mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) {
if (unmount_flags & WIMLIB_UNMOUNT_FLAG_COMMIT) {
- int write_flags;
+ int write_flags = 0;
if (unmount_flags & WIMLIB_UNMOUNT_FLAG_CHECK_INTEGRITY)
- write_flags = WIMLIB_WRITE_FLAG_CHECK_INTEGRITY;
- else
- write_flags = 0;
+ write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY;
+ if (unmount_flags & WIMLIB_UNMOUNT_FLAG_REBUILD)
+ write_flags |= WIMLIB_WRITE_FLAG_REBUILD;
+ if (unmount_flags & WIMLIB_UNMOUNT_FLAG_RECOMPRESS)
+ write_flags |= WIMLIB_WRITE_FLAG_RECOMPRESS;
status = rebuild_wim(ctx, write_flags);
}
ret = delete_staging_dir(ctx);
from_dentry->d_inode = inode;
inode->link_count++;
- if (inode->lte)
- inode->lte->refcnt++;
for (i = 0; i <= inode->num_ads; i++) {
lte = inode_stream_lte_resolved(inode, i);
if (lte)
}
ret = select_wim_image(wim, image);
-
if (ret != 0)
goto out;
- imd = &wim->image_metadata[image - 1];
-
DEBUG("Selected image %d", image);
+ imd = wim_get_current_image_metadata(wim);
+
if (imd->root_dentry->refcnt != 1) {
ERROR("Cannot mount image that was just exported with "
"wimlib_export_image()");
}
if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) {
- ret = lock_wim(wim->fp, wim->filename);
+ ret = lock_wim(wim, wim->fp);
if (ret != 0)
goto out;
}
init_wimfs_context(&ctx);
ctx.wim = wim;
ctx.mount_flags = mount_flags;
+ ctx.image_inode_list = &imd->inode_list;
if (mount_flags & WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS)
ctx.default_lookup_flags = LOOKUP_FLAG_ADS_OK;
DEBUG("Unlinking message queues in case they already exist");
ret = set_message_queue_names(&ctx, dir);
if (ret != 0)
- goto out;
+ goto out_unlock;
unlink_message_queues(&ctx);
DEBUG("Preparing arguments to fuse_main()");
ret = WIMLIB_ERR_FUSE;
out_free_dir_copy:
FREE(dir_copy);
+out_unlock:
+ wim->wim_locked = 0;
out_free_message_queue_names:
free_message_queue_names(&ctx);
out: