#endif
#include "wimlib/apply.h"
+#include "wimlib/assert.h"
#include "wimlib/dentry.h"
#include "wimlib/error.h"
#include "wimlib/file_io.h"
}
#define NUM_PATHBUFS 2 /* We need 2 when creating hard links */
-#define MAX_OPEN_FDS 1000 /* TODO: Add special case for when the number of
- identical streams exceeds this number. */
struct unix_apply_ctx {
/* Extract flags, the pointer to the WIMStruct, etc. */
unsigned which_pathbuf;
/* Currently open file descriptors for extraction */
- struct filedes open_fds[MAX_OPEN_FDS];
+ struct filedes open_fds[MAX_OPEN_STREAMS];
/* Number of currently open file descriptors in open_fds, starting from
* the beginning of the array. */
ERROR_WITH_ERRNO("Can't create directory \"%s\"", path);
return WIMLIB_ERR_MKDIR;
}
- return 0;
+
+ return report_file_created(&ctx->common);
}
/* If @dentry represents an empty regular file or a special file, create it, set
if (ret)
return ret;
- return unix_create_hardlinks(inode, dentry, path, ctx);
+ ret = unix_create_hardlinks(inode, dentry, path, ctx);
+ if (ret)
+ return ret;
+
+ return report_file_created(&ctx->common);
}
static int
return 0;
}
- if (ctx->num_open_fds == MAX_OPEN_FDS) {
- ERROR("Can't extract data: too many open files!");
- return WIMLIB_ERR_UNSUPPORTED;
- }
+ /* This should be ensured by extract_stream_list() */
+ wimlib_assert(ctx->num_open_fds < MAX_OPEN_STREAMS);
first_dentry = inode_first_extraction_dentry(inode);
first_path = unix_build_extraction_path(first_dentry, ctx);
/* Called when starting to read a single-instance stream for extraction */
static int
-unix_begin_extract_stream(struct wim_lookup_table_entry *stream,
- u32 flags, void *_ctx)
+unix_begin_extract_stream(struct wim_lookup_table_entry *stream, void *_ctx)
{
struct unix_apply_ctx *ctx = _ctx;
const struct stream_owner *owners = stream_owners(stream);
ret = unix_set_metadata(-1, dentry->d_inode, NULL, ctx);
if (ret)
return ret;
+ ret = report_file_metadata_applied(&ctx->common);
+ if (ret)
+ return ret;
}
}
return 0;
* because we can't extract any other files until their directories
* exist. Empty files are needed because they don't have
* representatives in the stream list. */
+ reset_file_progress(&ctx->common);
ret = unix_create_dirs_and_empty_files(dentry_list, ctx);
if (ret)
goto out;
if (ret)
goto out;
+
/* Set directory metadata. We do this last so that we get the right
* directory timestamps. */
+ reset_file_progress(&ctx->common);
ret = unix_set_dir_metadata(dentry_list, ctx);
if (ret)
goto out;