static const u16 max_fds = 0xffff;
int ret;
- pthread_mutex_lock(&inode->i_mutex);
-
DEBUG("Allocating fd for stream ID %u from inode %#"PRIx64" "
"(open = %u, allocated = %u)",
stream_id, inode->i_ino, inode->i_num_opened_fds,
}
}
out:
- pthread_mutex_unlock(&inode->i_mutex);
return ret;
}
inode_put_fd(struct wim_inode *inode, struct wimfs_fd *fd)
{
wimlib_assert(inode != NULL);
-
- pthread_mutex_lock(&inode->i_mutex);
-
wimlib_assert(fd->f_inode == inode);
wimlib_assert(inode->i_num_opened_fds != 0);
wimlib_assert(fd->idx < inode->i_num_allocated_fds);
inode->i_fds[fd->idx] = NULL;
FREE(fd);
- if (--inode->i_num_opened_fds == 0 && inode->i_nlink == 0) {
- pthread_mutex_unlock(&inode->i_mutex);
- free_inode(inode);
- } else {
- pthread_mutex_unlock(&inode->i_mutex);
+ if (--inode->i_num_opened_fds == 0) {
+ FREE(inode->i_fds);
+ inode->i_fds = NULL;
+ inode->i_num_allocated_fds = 0;
+ if (inode->i_nlink == 0)
+ free_inode(inode);
}
}
{
int ret;
struct wim_lookup_table_entry *lte, *tmp;
- WIMStruct *w = ctx->wim;
+ WIMStruct *wim = ctx->wim;
struct wim_image_metadata *imd = wim_get_current_image_metadata(ctx->wim);
DEBUG("Closing all staging file descriptors.");
}
}
- xml_update_image_info(w, w->current_image);
- ret = wimlib_overwrite(w, write_flags, 0, progress_func);
+ xml_update_image_info(wim, wim->current_image);
+ ret = wimlib_overwrite(wim, write_flags, 0, progress_func);
if (ret)
ERROR("Failed to commit changes to mounted WIM image");
return ret;
struct wim_dentry *from_dentry, *from_dentry_parent;
const char *link_name;
struct wim_inode *inode;
- WIMStruct *w = wimfs_get_WIMStruct();
+ WIMStruct *wim = wimfs_get_WIMStruct();
int ret;
- inode = wim_pathname_to_inode(w, to);
+ inode = wim_pathname_to_inode(wim, to);
if (!inode)
return -errno;
FILE_ATTRIBUTE_REPARSE_POINT))
return -EPERM;
- from_dentry_parent = get_parent_dentry(w, from);
+ from_dentry_parent = get_parent_dentry(wim, from);
if (!from_dentry_parent)
return -errno;
if (!dentry_is_directory(from_dentry_parent))
int ret;
struct wimfs_fd *fd = NULL;
struct wimfs_context *ctx = wimfs_get_context();
- WIMStruct *w = ctx->wim;
+ WIMStruct *wim = ctx->wim;
- inode = wim_pathname_to_inode(w, path);
+ inode = wim_pathname_to_inode(wim, path);
if (!inode)
return -errno;
if (!inode_is_directory(inode))
wimfs_rmdir(const char *path)
{
struct wim_dentry *dentry;
- WIMStruct *w = wimfs_get_WIMStruct();
+ WIMStruct *wim = wimfs_get_WIMStruct();
- dentry = get_dentry(w, path);
+ dentry = get_dentry(wim, path);
if (!dentry)
return -errno;
if (dentry_has_children(dentry))
return -ENOTEMPTY;
- remove_dentry(dentry, w->lookup_table);
+ remove_dentry(dentry, wim->lookup_table);
return 0;
}
{
struct wim_dentry *dentry;
struct wim_inode *inode;
- WIMStruct *w = wimfs_get_WIMStruct();
+ WIMStruct *wim = wimfs_get_WIMStruct();
- dentry = get_dentry(w, path);
+ dentry = get_dentry(wim, path);
if (!dentry)
return -errno;
inode = dentry->d_inode;
{
struct wim_dentry *dentry;
struct wim_inode *inode;
- WIMStruct *w = wimfs_get_WIMStruct();
+ WIMStruct *wim = wimfs_get_WIMStruct();
- dentry = get_dentry(w, path);
+ dentry = get_dentry(wim, path);
if (!dentry)
return -errno;
inode = dentry->d_inode;
goto out_free_message_queue_names;
argc = 0;
- argv[argc++] = "imagex";
+ argv[argc++] = IMAGEX_PROGNAME;
argv[argc++] = dir_copy;
- /* disable multi-threaded operation for read-write mounts */
- if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)
- argv[argc++] = "-s";
+ /* disable multi-threaded operation */
+ argv[argc++] = "-s";
if (mount_flags & WIMLIB_MOUNT_FLAG_DEBUG)
argv[argc++] = "-d";
* assign inode numbers */
DEBUG("Resolving lookup table entries and assigning inode numbers");
ctx.next_ino = 1;
- image_for_each_inode(inode, imd) {
- ret = inode_resolve_ltes(inode, wim->lookup_table);
- if (ret)
- goto out_delete_staging_dir;
+ image_for_each_inode(inode, imd)
inode->i_ino = ctx.next_ino++;
- }
DEBUG("(next_ino = %"PRIu64")", ctx.next_ino);
DEBUG("Calling fuse_main()");
/* Try to delete the staging directory if a deletion wasn't yet
* attempted due to an earlier error */
-out_delete_staging_dir:
if (ctx.staging_dir_name)
delete_staging_dir(&ctx);
out_free_dir_copy: