#define FUSE_USE_VERSION 26
+#include <sys/types.h> /* sometimes required before <attr/xattr.h> */
+
#include <attr/xattr.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <unistd.h>
#include <utime.h>
}
}
- list_add_tail(&new_inode->i_list,
- &wim_get_current_image_metadata(wimfs_ctx->wim)->inode_list);
+ hlist_add_head(&new_inode->i_hlist,
+ &wim_get_current_image_metadata(wimfs_ctx->wim)->inode_list);
dentry_add_child(parent, new_dentry);
filedes_init(&fd, staging_fd);
errno = 0;
extract_size = min(old_blob->size, size);
- result = extract_blob_to_fd(old_blob, &fd, extract_size);
+ result = extract_blob_prefix_to_fd(old_blob, extract_size, &fd);
} else {
extract_size = 0;
result = 0;
close(ctx->parent_dir_fd);
}
-/* Number the inodes in the mounted image sequentially. */
static void
-reassign_inode_numbers(struct wimfs_context *ctx)
+prepare_inodes(struct wimfs_context *ctx)
{
struct wim_image_metadata *imd;
struct wim_inode *inode;
ctx->next_ino = 1;
imd = wim_get_current_image_metadata(ctx->wim);
- image_for_each_inode(inode, imd)
+ image_for_each_inode(inode, imd) {
inode->i_ino = ctx->next_ino++;
+ inode->i_num_opened_fds = 0;
+ inode->i_num_allocated_fds = 0;
+ inode->i_fds = NULL;
+ }
}
static void
static void
close_all_fds(struct wimfs_context *ctx)
{
- struct wim_inode *inode, *tmp;
+ struct wim_inode *inode;
+ struct hlist_node *tmp;
struct wim_image_metadata *imd;
imd = wim_get_current_image_metadata(ctx->wim);
- list_for_each_entry_safe(inode, tmp, &imd->inode_list, i_list)
+ image_for_each_inode_safe(inode, tmp, imd)
inode_close_fds(inode);
}
size_t size)
{
const struct wimfs_context *ctx = wimfs_get_context();
- struct wim_inode *inode;
- struct wim_inode_stream *strm;
- struct blob_descriptor *blob;
+ const struct wim_inode *inode;
+ const struct wim_inode_stream *strm;
+ const struct blob_descriptor *blob;
if (!strncmp(name, "wimfs.", 6)) {
/* Handle some magical extended attributes. These really should
if (size < blob->size)
return -ERANGE;
- if (read_full_blob_into_buf(blob, value))
+ if (read_blob_into_buf(blob, value))
return errno ? -errno : -EIO;
}
return blob->size;
switch (blob->blob_location) {
case BLOB_IN_WIM:
- if (read_partial_wim_blob_into_buf(blob, size, offset, buf))
+ if (read_partial_wim_blob_into_buf(blob, offset, size, buf))
ret = errno ? -errno : -EIO;
else
ret = size;
return ret;
}
+ if (wim_has_solid_resources(wim)) {
+ WARNING("Mounting a WIM file containing solid-compressed data; "
+ "file access may be slow.");
+ }
+
/* If the user did not specify an interface for accessing named
* data streams, use the default (extended attributes). */
if (!(mount_flags & (WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_NONE |
}
}
- /* Assign new inode numbers. */
- reassign_inode_numbers(&ctx);
+ /* Number the inodes in the mounted image sequentially and initialize
+ * the file descriptor arrays */
+ prepare_inodes(&ctx);
/* If a read-write mount, mark the image as modified. */
if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)