* beginning of the array) */
unsigned num_open_handles;
- /* List of dentries, joined by @tmp_list, that need to have reparse data
- * extracted as soon as the whole blob has been read into @data_buffer.
- * */
+ /* List of dentries, joined by @d_tmp_list, that need to have reparse
+ * data extracted as soon as the whole blob has been read into
+ * @data_buffer. */
struct list_head reparse_dentries;
- /* List of dentries, joined by @tmp_list, that need to have raw
+ /* List of dentries, joined by @d_tmp_list, that need to have raw
* encrypted data extracted as soon as the whole blob has been read into
* @data_buffer. */
struct list_head encrypted_dentries;
will_externally_back_inode(struct wim_inode *inode, struct win32_apply_ctx *ctx,
const struct wim_dentry **excluded_dentry_ret)
{
- struct list_head *next;
struct wim_dentry *dentry;
struct blob_descriptor *blob;
int ret;
* We need to check the patterns in [PrepopulateList] against every name
* of the inode, in case any of them match.
*/
- next = inode->i_extraction_aliases.next;
- do {
- dentry = list_entry(next, struct wim_dentry,
- d_extraction_alias_node);
+
+ inode_for_each_extraction_alias(dentry, inode) {
ret = calculate_dentry_full_path(dentry);
if (ret)
return ret;
- if (!can_externally_back_path(dentry->_full_path,
- wcslen(dentry->_full_path), ctx))
+ if (!can_externally_back_path(dentry->d_full_path,
+ wcslen(dentry->d_full_path), ctx))
{
if (excluded_dentry_ret)
*excluded_dentry_ret = dentry;
return WIM_BACKING_EXCLUDED;
}
- next = next->next;
- } while (next != &inode->i_extraction_aliases);
+ }
inode->i_can_externally_back = 1;
return 0;
build_extraction_path(excluded_dentry, ctx);
- info.wimboot_exclude.path_in_wim = excluded_dentry->_full_path;
+ info.wimboot_exclude.path_in_wim = excluded_dentry->d_full_path;
info.wimboot_exclude.extraction_path = current_path(ctx);
return call_progress(ctx->common.progfunc,
static struct wim_dentry *
first_extraction_alias(const struct wim_inode *inode)
{
- struct list_head *next = inode->i_extraction_aliases.next;
struct wim_dentry *dentry;
- do {
- dentry = list_entry(next, struct wim_dentry,
- d_extraction_alias_node);
+ inode_for_each_extraction_alias(dentry, inode)
if (dentry_has_short_name(dentry))
- break;
- next = next->next;
- } while (next != &inode->i_extraction_aliases);
- return dentry;
+ return dentry;
+ return inode_first_extraction_dentry(inode);
}
/*
name = &ctx->pathbuf.Buffer[ctx->pathbuf.Length / sizeof(wchar_t)];
while (name != ctx->pathbuf.Buffer && *(name - 1) != L'\\')
name--;
- end = mempcpy(name, dentry->short_name, dentry->short_name_nbytes);
+ end = mempcpy(name, dentry->d_short_name, dentry->d_short_name_nbytes);
ctx->pathbuf.Length = ((u8 *)end - (u8 *)ctx->pathbuf.Buffer);
/* Open the conflicting file (by short name). */
*/
size_t bufsize = offsetof(FILE_NAME_INFORMATION, FileName) +
- max(dentry->short_name_nbytes, sizeof(wchar_t)) +
+ max(dentry->d_short_name_nbytes, sizeof(wchar_t)) +
sizeof(wchar_t);
u8 buf[bufsize] _aligned_attribute(8);
FILE_NAME_INFORMATION *info = (FILE_NAME_INFORMATION *)buf;
memset(buf, 0, bufsize);
- info->FileNameLength = dentry->short_name_nbytes;
- memcpy(info->FileName, dentry->short_name, dentry->short_name_nbytes);
+ info->FileNameLength = dentry->d_short_name_nbytes;
+ memcpy(info->FileName, dentry->d_short_name, dentry->d_short_name_nbytes);
retry:
status = (*func_NtSetInformationFile)(h, &ctx->iosb, info, bufsize,
return 0;
if (status == STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME) {
- if (dentry->short_name_nbytes == 0)
+ if (dentry->d_short_name_nbytes == 0)
return 0;
if (!ctx->tried_to_enable_short_names) {
wchar_t volume[7];
* from files.
*/
if (unlikely(status == STATUS_OBJECT_NAME_COLLISION) &&
- dentry->short_name_nbytes && !tried_to_remove_existing)
+ dentry->d_short_name_nbytes && !tried_to_remove_existing)
{
tried_to_remove_existing = true;
status = remove_conflicting_short_name(dentry, ctx);
/* By default, failure to set short names is not an error (since short
* names aren't too important anymore...). */
if (!(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_STRICT_SHORT_NAMES)) {
- if (dentry->short_name_nbytes)
+ if (dentry->d_short_name_nbytes)
ctx->num_set_short_name_failures++;
else
ctx->num_remove_short_name_failures++;
create_links(HANDLE h, const struct wim_dentry *first_dentry,
struct win32_apply_ctx *ctx)
{
- const struct wim_inode *inode;
- const struct list_head *next;
+ const struct wim_inode *inode = first_dentry->d_inode;
const struct wim_dentry *dentry;
int ret;
- inode = first_dentry->d_inode;
- next = inode->i_extraction_aliases.next;
- do {
- dentry = list_entry(next, struct wim_dentry,
- d_extraction_alias_node);
+ inode_for_each_extraction_alias(dentry, inode) {
if (dentry != first_dentry) {
ret = create_link(h, dentry, ctx);
if (ret)
return ret;
}
- next = next->next;
- } while (next != &inode->i_extraction_aliases);
+ }
return 0;
}
* data be available. So, stage the data in a buffer. */
if (!prepare_data_buffer(ctx, blob->size))
return WIMLIB_ERR_NOMEM;
- list_add_tail(&dentry->tmp_list, &ctx->reparse_dentries);
+ list_add_tail(&dentry->d_tmp_list, &ctx->reparse_dentries);
return 0;
}
* such files... */
if (!prepare_data_buffer(ctx, blob->size))
return WIMLIB_ERR_NOMEM;
- list_add_tail(&dentry->tmp_list, &ctx->encrypted_dentries);
+ list_add_tail(&dentry->d_tmp_list, &ctx->encrypted_dentries);
return 0;
}
} else {
/* Hard links not supported. Extract the blob
* separately to each alias of the inode. */
- struct list_head *next;
-
- next = inode->i_extraction_aliases.next;
- do {
- dentry = list_entry(next, struct wim_dentry,
- d_extraction_alias_node);
+ inode_for_each_extraction_alias(dentry, inode) {
ret = begin_extract_blob_instance(blob, dentry, strm, ctx);
ret = check_apply_error(dentry, ctx, ret);
if (ret)
goto fail;
- next = next->next;
- } while (next != &inode->i_extraction_aliases);
+ }
}
}
if (!list_empty(&ctx->reparse_dentries)) {
if (blob->size > REPARSE_DATA_MAX_SIZE) {
dentry = list_first_entry(&ctx->reparse_dentries,
- struct wim_dentry, tmp_list);
+ struct wim_dentry, d_tmp_list);
build_extraction_path(dentry, ctx);
ERROR("Reparse data of \"%ls\" has size "
"%"PRIu64" bytes (exceeds %u bytes)",
/* Reparse data */
memcpy(ctx->rpbuf.rpdata, ctx->data_buffer, blob->size);
- list_for_each_entry(dentry, &ctx->reparse_dentries, tmp_list) {
+ list_for_each_entry(dentry, &ctx->reparse_dentries, d_tmp_list) {
/* Reparse point header */
complete_reparse_point(&ctx->rpbuf, dentry->d_inode,
if (!list_empty(&ctx->encrypted_dentries)) {
ctx->encrypted_size = blob->size;
- list_for_each_entry(dentry, &ctx->encrypted_dentries, tmp_list) {
+ list_for_each_entry(dentry, &ctx->encrypted_dentries, d_tmp_list) {
ret = extract_encrypted_file(dentry, ctx);
ret = check_apply_error(dentry, ctx, ret);
if (ret)
NTSTATUS status;
/* Set security descriptor if present and not in NO_ACLS mode */
- if (inode->i_security_id >= 0 &&
+ if (inode_has_security_descriptor(inode) &&
!(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_NO_ACLS))
{
const struct wim_security_data *sd;