From 8df639463ae0c754d2b1af3d6c1d22e59ee3ccf8 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 31 May 2015 09:57:23 -0500 Subject: [PATCH] Rename dentry name fields file_name => d_name file_name_nbytes => d_name_nbytes short_name => d_short_name short_name_nbytes => d_short_name_nbytes --- include/wimlib/apply.h | 6 +- include/wimlib/dentry.h | 14 ++--- include/wimlib/inode.h | 4 +- src/dentry.c | 118 ++++++++++++++++++++-------------------- src/extract.c | 20 +++---- src/iterate_dir.c | 4 +- src/mount_image.c | 15 ++--- src/ntfs-3g_apply.c | 2 +- src/ntfs-3g_capture.c | 8 +-- src/solid.c | 6 +- src/update_image.c | 24 ++++---- src/wildcard.c | 6 +- src/win32_apply.c | 14 ++--- src/win32_capture.c | 8 +-- 14 files changed, 123 insertions(+), 126 deletions(-) diff --git a/include/wimlib/apply.h b/include/wimlib/apply.h index ad21418e..071f5ed4 100644 --- a/include/wimlib/apply.h +++ b/include/wimlib/apply.h @@ -198,9 +198,9 @@ struct apply_operations { * * 'd_extraction_name' and 'd_extraction_name_nchars' of each dentry * will be set to indicate the actual name with which the dentry should - * be extracted. This may or may not be the same as 'file_name'. - * TODO: really, the extraction backends should be responsible for - * generating 'd_extraction_name'. + * be extracted. This may or may not be the same as 'd_name'. TODO: + * really, the extraction backends should be responsible for generating + * 'd_extraction_name'. * * Each dentry will refer to a valid inode in 'd_inode'. Each inode * will contain a list of dentries of that inode being extracted; this diff --git a/include/wimlib/dentry.h b/include/wimlib/dentry.h index 025a56cd..dc7770bc 100644 --- a/include/wimlib/dentry.h +++ b/include/wimlib/dentry.h @@ -61,19 +61,19 @@ struct wim_dentry { /* Pointer to the UTF-16LE short filename (malloc()ed buffer), or NULL * if this dentry has no short name. */ - utf16lechar *short_name; + utf16lechar *d_short_name; /* Pointer to the UTF-16LE filename (malloc()ed buffer), or NULL if this * dentry has no filename. */ - utf16lechar *file_name; + utf16lechar *d_name; /* Length of UTF-16LE encoded short filename, in bytes, not including * the terminating zero wide-character. */ - u16 short_name_nbytes; + u16 d_short_name_nbytes; /* Length of UTF-16LE encoded "long" file name, in bytes, not including * the terminating null character. */ - u16 file_name_nbytes; + u16 d_name_nbytes; /* When capturing from an NTFS volume using NTFS-3g, this flag is set on * dentries that were created from a filename in the WIN32 or WIN32+DOS @@ -105,7 +105,7 @@ struct wim_dentry { /* (Extraction only) Actual name to extract this dentry as. This may be * either in 'tchars' or in 'utf16lechars', depending on what encoding - * the extraction backend needs. This may alias 'file_name'. If it + * the extraction backend needs. This may alias 'd_name'. If it * doesn't, it is an allocated buffer which must be freed. */ void *d_extraction_name; @@ -277,12 +277,12 @@ dentry_has_children(const struct wim_dentry *dentry) static inline bool dentry_has_short_name(const struct wim_dentry *dentry) { - return dentry->short_name_nbytes != 0; + return dentry->d_short_name_nbytes != 0; } static inline bool dentry_has_long_name(const struct wim_dentry *dentry) { - return dentry->file_name_nbytes != 0; + return dentry->d_name_nbytes != 0; } #endif /* _WIMLIB_DENTRY_H */ diff --git a/include/wimlib/inode.h b/include/wimlib/inode.h index fc8ddc27..00cd7f1a 100644 --- a/include/wimlib/inode.h +++ b/include/wimlib/inode.h @@ -106,13 +106,13 @@ struct wim_inode { u32 i_attributes; /* Root of a balanced binary search tree storing the child directory - * entries of this inode, if any. Keyed by wim_dentry->file_name, case + * entries of this inode, if any. Keyed by wim_dentry->d_name, case * sensitively. If this inode is not a directory or if it has no * children then this will be an empty tree (NULL). */ struct avl_tree_node *i_children; /* Root of a balanced binary search tree storing the child directory - * entries of this inode, if any. Keyed by wim_dentry->file_name, case + * entries of this inode, if any. Keyed by wim_dentry->d_name, case * insensitively. If this inode is not a directory or if it has no * children then this will be an empty tree (NULL). */ struct avl_tree_node *i_children_ci; diff --git a/src/dentry.c b/src/dentry.c index 7ba43580..cb1b4df2 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -175,14 +175,14 @@ struct wim_dentry_on_disk { * encoded "long" name, excluding the null terminator. If zero, then * this file has no long name. The root dentry should not have a long * name, but all other dentries in the image should have long names. */ - le16 file_name_nbytes; + le16 name_nbytes; /* Beginning of optional, variable-length fields */ - /* If file_name_nbytes != 0, the next field will be the UTF-16LE encoded - * long file name. This will be null-terminated, so the size of this - * field will really be file_name_nbytes + 2. */ - /*utf16lechar file_name[];*/ + /* If name_nbytes != 0, the next field will be the UTF-16LE encoded long + * name. This will be null-terminated, so the size of this field will + * really be name_nbytes + 2. */ + /*utf16lechar name[];*/ /* If short_name_nbytes != 0, the next field will be the UTF-16LE * encoded short name. This will be null-terminated, so the size of @@ -228,17 +228,17 @@ struct wim_extra_stream_entry_on_disk { } _packed_attribute; static void -do_dentry_set_name(struct wim_dentry *dentry, utf16lechar *file_name, - size_t file_name_nbytes) +do_dentry_set_name(struct wim_dentry *dentry, utf16lechar *name, + size_t name_nbytes) { - FREE(dentry->file_name); - dentry->file_name = file_name; - dentry->file_name_nbytes = file_name_nbytes; + FREE(dentry->d_name); + dentry->d_name = name; + dentry->d_name_nbytes = name_nbytes; if (dentry_has_short_name(dentry)) { - FREE(dentry->short_name); - dentry->short_name = NULL; - dentry->short_name_nbytes = 0; + FREE(dentry->d_short_name); + dentry->d_short_name = NULL; + dentry->d_short_name_nbytes = 0; } } @@ -315,11 +315,11 @@ dentry_set_name(struct wim_dentry *dentry, const tchar *name) * tagged metadata items as well as any extra stream entries that may need to * follow the dentry. */ static size_t -dentry_min_len_with_names(u16 file_name_nbytes, u16 short_name_nbytes) +dentry_min_len_with_names(u16 name_nbytes, u16 short_name_nbytes) { size_t length = sizeof(struct wim_dentry_on_disk); - if (file_name_nbytes) - length += (u32)file_name_nbytes + 2; + if (name_nbytes) + length += (u32)name_nbytes + 2; if (short_name_nbytes) length += (u32)short_name_nbytes + 2; return length; @@ -354,8 +354,8 @@ dentry_out_total_length(const struct wim_dentry *dentry) const struct wim_inode *inode = dentry->d_inode; size_t len; - len = dentry_min_len_with_names(dentry->file_name_nbytes, - dentry->short_name_nbytes); + len = dentry_min_len_with_names(dentry->d_name_nbytes, + dentry->d_short_name_nbytes); len = ALIGN(len, 8); len += ALIGN(inode->i_extra_size, 8); @@ -492,7 +492,7 @@ calculate_dentry_full_path(struct wim_dentry *dentry) ulen = 0; d = dentry; do { - ulen += d->file_name_nbytes / sizeof(utf16lechar); + ulen += d->d_name_nbytes / sizeof(utf16lechar); ulen++; d = d->d_parent; /* assumes d == d->d_parent for root */ } while (!dentry_is_root(d)); @@ -502,8 +502,8 @@ calculate_dentry_full_path(struct wim_dentry *dentry) d = dentry; do { - p -= d->file_name_nbytes / sizeof(utf16lechar); - memcpy(p, d->file_name, d->file_name_nbytes); + p -= d->d_name_nbytes / sizeof(utf16lechar); + memcpy(p, d->d_name, d->d_name_nbytes); *--p = cpu_to_le16(WIM_PATH_SEPARATOR); d = d->d_parent; /* assumes d == d->d_parent for root */ } while (!dentry_is_root(d)); @@ -576,10 +576,10 @@ static int dentry_compare_names_case_insensitive(const struct wim_dentry *d1, const struct wim_dentry *d2) { - return cmp_utf16le_strings(d1->file_name, - d1->file_name_nbytes / 2, - d2->file_name, - d2->file_name_nbytes / 2, + return cmp_utf16le_strings(d1->d_name, + d1->d_name_nbytes / 2, + d2->d_name, + d2->d_name_nbytes / 2, true); } @@ -588,10 +588,10 @@ static int dentry_compare_names_case_sensitive(const struct wim_dentry *d1, const struct wim_dentry *d2) { - return cmp_utf16le_strings(d1->file_name, - d1->file_name_nbytes / 2, - d2->file_name, - d2->file_name_nbytes / 2, + return cmp_utf16le_strings(d1->d_name, + d1->d_name_nbytes / 2, + d2->d_name, + d2->d_name_nbytes / 2, false); } @@ -629,8 +629,8 @@ bool default_ignore_case = #endif ; -/* Case-sensitive dentry lookup. Only @file_name and @file_name_nbytes of - * @dummy must be valid. */ +/* Case-sensitive dentry lookup. Only @d_name and @d_name_nbytes of @dummy must + * be valid. */ static struct wim_dentry * dir_lookup(const struct wim_inode *dir, const struct wim_dentry *dummy) { @@ -644,8 +644,8 @@ dir_lookup(const struct wim_inode *dir, const struct wim_dentry *dummy) return avl_tree_entry(node, struct wim_dentry, d_index_node); } -/* Case-insensitive dentry lookup. Only @file_name and @file_name_nbytes of - * @dummy must be valid. */ +/* Case-insensitive dentry lookup. Only @d_name and @d_name_nbytes of @dummy + * must be valid. */ static struct wim_dentry * dir_lookup_ci(const struct wim_inode *dir, const struct wim_dentry *dummy) { @@ -673,8 +673,8 @@ get_dentry_child_with_utf16le_name(const struct wim_dentry *dentry, struct wim_dentry dummy; struct wim_dentry *child; - dummy.file_name = (utf16lechar*)name; - dummy.file_name_nbytes = name_nbytes; + dummy.d_name = (utf16lechar*)name; + dummy.d_name_nbytes = name_nbytes; if (!ignore_case) /* Case-sensitive lookup. */ @@ -1006,8 +1006,8 @@ free_dentry(struct wim_dentry *dentry) { if (dentry) { d_disassociate(dentry); - FREE(dentry->file_name); - FREE(dentry->short_name); + FREE(dentry->d_name); + FREE(dentry->d_short_name); FREE(dentry->_full_path); FREE(dentry); } @@ -1390,7 +1390,7 @@ read_dentry(const u8 * restrict buf, size_t buf_len, struct wim_dentry *dentry; struct wim_inode *inode; u16 short_name_nbytes; - u16 file_name_nbytes; + u16 name_nbytes; u64 calculated_size; int ret; @@ -1457,16 +1457,16 @@ read_dentry(const u8 * restrict buf, size_t buf_len, * name, and the short name. */ short_name_nbytes = le16_to_cpu(disk_dentry->short_name_nbytes); - file_name_nbytes = le16_to_cpu(disk_dentry->file_name_nbytes); + name_nbytes = le16_to_cpu(disk_dentry->name_nbytes); - if (unlikely((short_name_nbytes & 1) | (file_name_nbytes & 1))) { + if (unlikely((short_name_nbytes & 1) | (name_nbytes & 1))) { ret = WIMLIB_ERR_INVALID_METADATA_RESOURCE; goto err_free_dentry; } /* We now know the length of the file name and short name. Make sure * the length of the dentry is large enough to actually hold them. */ - calculated_size = dentry_min_len_with_names(file_name_nbytes, + calculated_size = dentry_min_len_with_names(name_nbytes, short_name_nbytes); if (unlikely(length < calculated_size)) { @@ -1479,25 +1479,25 @@ read_dentry(const u8 * restrict buf, size_t buf_len, /* Read the filename if present. Note: if the filename is empty, there * is no null terminator following it. */ - if (file_name_nbytes) { - dentry->file_name = utf16le_dupz(p, file_name_nbytes); - if (dentry->file_name == NULL) { + if (name_nbytes) { + dentry->d_name = utf16le_dupz(p, name_nbytes); + if (unlikely(!dentry->d_name)) { ret = WIMLIB_ERR_NOMEM; goto err_free_dentry; } - dentry->file_name_nbytes = file_name_nbytes; - p += (u32)file_name_nbytes + 2; + dentry->d_name_nbytes = name_nbytes; + p += (u32)name_nbytes + 2; } /* Read the short filename if present. Note: if there is no short * filename, there is no null terminator following it. */ if (short_name_nbytes) { - dentry->short_name = utf16le_dupz(p, short_name_nbytes); - if (dentry->short_name == NULL) { + dentry->d_short_name = utf16le_dupz(p, short_name_nbytes); + if (unlikely(!dentry->d_short_name)) { ret = WIMLIB_ERR_NOMEM; goto err_free_dentry; } - dentry->short_name_nbytes = short_name_nbytes; + dentry->d_short_name_nbytes = short_name_nbytes; p += (u32)short_name_nbytes + 2; } @@ -1532,13 +1532,13 @@ err_free_dentry: static bool dentry_is_dot_or_dotdot(const struct wim_dentry *dentry) { - if (dentry->file_name_nbytes <= 4) { - if (dentry->file_name_nbytes == 4) { - if (dentry->file_name[0] == cpu_to_le16('.') && - dentry->file_name[1] == cpu_to_le16('.')) + if (dentry->d_name_nbytes <= 4) { + if (dentry->d_name_nbytes == 4) { + if (dentry->d_name[0] == cpu_to_le16('.') && + dentry->d_name[1] == cpu_to_le16('.')) return true; - } else if (dentry->file_name_nbytes == 2) { - if (dentry->file_name[0] == cpu_to_le16('.')) + } else if (dentry->d_name_nbytes == 2) { + if (dentry->d_name[0] == cpu_to_le16('.')) return true; } } @@ -1766,17 +1766,17 @@ write_dentry(const struct wim_dentry * restrict dentry, u8 * restrict p) cpu_to_le64((inode->i_nlink == 1) ? 0 : inode->i_ino); } - disk_dentry->short_name_nbytes = cpu_to_le16(dentry->short_name_nbytes); - disk_dentry->file_name_nbytes = cpu_to_le16(dentry->file_name_nbytes); + disk_dentry->short_name_nbytes = cpu_to_le16(dentry->d_short_name_nbytes); + disk_dentry->name_nbytes = cpu_to_le16(dentry->d_name_nbytes); p += sizeof(struct wim_dentry_on_disk); wimlib_assert(dentry_is_root(dentry) != dentry_has_long_name(dentry)); if (dentry_has_long_name(dentry)) - p = mempcpy(p, dentry->file_name, (u32)dentry->file_name_nbytes + 2); + p = mempcpy(p, dentry->d_name, (u32)dentry->d_name_nbytes + 2); if (dentry_has_short_name(dentry)) - p = mempcpy(p, dentry->short_name, (u32)dentry->short_name_nbytes + 2); + p = mempcpy(p, dentry->d_short_name, (u32)dentry->d_short_name_nbytes + 2); /* Align to 8-byte boundary */ while ((uintptr_t)p & 7) diff --git a/src/extract.c b/src/extract.c index ea9c2522..0401758b 100644 --- a/src/extract.c +++ b/src/extract.c @@ -643,7 +643,7 @@ destroy_dentry_list(struct list_head *dentry_list) dentry_reset_extraction_list_node(dentry); inode->i_visited = 0; inode->i_can_externally_back = 0; - if ((void *)dentry->d_extraction_name != (void *)dentry->file_name) + if ((void *)dentry->d_extraction_name != (void *)dentry->d_name) FREE(dentry->d_extraction_name); dentry->d_extraction_name = NULL; dentry->d_extraction_name_nchars = 0; @@ -718,8 +718,8 @@ dentry_calculate_extraction_name(struct wim_dentry *dentry, #ifdef WITH_NTFS_3G if (ctx->extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) { - dentry->d_extraction_name = dentry->file_name; - dentry->d_extraction_name_nchars = dentry->file_name_nbytes / + dentry->d_extraction_name = dentry->d_name; + dentry->d_extraction_name_nchars = dentry->d_name_nbytes / sizeof(utf16lechar); return 0; } @@ -752,9 +752,9 @@ dentry_calculate_extraction_name(struct wim_dentry *dentry, } } - if (file_name_valid(dentry->file_name, dentry->file_name_nbytes / 2, false)) { - ret = utf16le_get_tstr(dentry->file_name, - dentry->file_name_nbytes, + if (file_name_valid(dentry->d_name, dentry->d_name_nbytes / 2, false)) { + ret = utf16le_get_tstr(dentry->d_name, + dentry->d_name_nbytes, (const tchar **)&dentry->d_extraction_name, &dentry->d_extraction_name_nchars); dentry->d_extraction_name_nchars /= sizeof(tchar); @@ -777,16 +777,16 @@ dentry_calculate_extraction_name(struct wim_dentry *dentry, out_replace: { - utf16lechar utf16_name_copy[dentry->file_name_nbytes / 2]; + utf16lechar utf16_name_copy[dentry->d_name_nbytes / 2]; - memcpy(utf16_name_copy, dentry->file_name, dentry->file_name_nbytes); - file_name_valid(utf16_name_copy, dentry->file_name_nbytes / 2, true); + memcpy(utf16_name_copy, dentry->d_name, dentry->d_name_nbytes); + file_name_valid(utf16_name_copy, dentry->d_name_nbytes / 2, true); const tchar *tchar_name; size_t tchar_nchars; ret = utf16le_get_tstr(utf16_name_copy, - dentry->file_name_nbytes, + dentry->d_name_nbytes, &tchar_name, &tchar_nchars); if (ret) return ret; diff --git a/src/iterate_dir.c b/src/iterate_dir.c index 451143a7..c9de38cf 100644 --- a/src/iterate_dir.c +++ b/src/iterate_dir.c @@ -91,12 +91,12 @@ init_wimlib_dentry(struct wimlib_dir_entry *wdentry, struct wim_dentry *dentry, const struct wim_inode_stream *strm; struct wimlib_unix_data unix_data; - ret = utf16le_get_tstr(dentry->file_name, dentry->file_name_nbytes, + ret = utf16le_get_tstr(dentry->d_name, dentry->d_name_nbytes, &wdentry->filename, &dummy); if (ret) return ret; - ret = utf16le_get_tstr(dentry->short_name, dentry->short_name_nbytes, + ret = utf16le_get_tstr(dentry->d_short_name, dentry->d_short_name_nbytes, &wdentry->dos_name, &dummy); if (ret) return ret; diff --git a/src/mount_image.c b/src/mount_image.c index 0ae5f216..e2f0ffbc 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -1712,18 +1712,15 @@ wimfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, return ret; for_inode_child(child, inode) { - char *file_name_mbs; - size_t file_name_mbs_nbytes; + char *name; + size_t name_nbytes; - ret = utf16le_to_tstr(child->file_name, - child->file_name_nbytes, - &file_name_mbs, - &file_name_mbs_nbytes); - if (ret) + if (utf16le_to_tstr(child->d_name, child->d_name_nbytes, + &name, &name_nbytes)) return -errno; - ret = filler(buf, file_name_mbs, NULL, 0); - FREE(file_name_mbs); + ret = filler(buf, name, NULL, 0); + FREE(name); if (ret) return ret; } diff --git a/src/ntfs-3g_apply.c b/src/ntfs-3g_apply.c index 9de5774b..3dcf8d53 100644 --- a/src/ntfs-3g_apply.c +++ b/src/ntfs-3g_apply.c @@ -280,7 +280,7 @@ ntfs_3g_restore_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni, * UTF-16LE internally... which is annoying because we currently have * the UTF-16LE string but not the multibyte string. */ - ret = utf16le_get_tstr(dentry->short_name, dentry->short_name_nbytes, + ret = utf16le_get_tstr(dentry->d_short_name, dentry->d_short_name_nbytes, &dos_name, &dos_name_nbytes); if (ret) goto out_close; diff --git a/src/ntfs-3g_capture.c b/src/ntfs-3g_capture.c index 5a97cff0..7ad99768 100644 --- a/src/ntfs-3g_capture.c +++ b/src/ntfs-3g_capture.c @@ -524,11 +524,11 @@ set_dentry_dos_name(struct wim_dentry *dentry, const struct dos_name_map *map) if (dentry->is_win32_name) { node = lookup_dos_name(map, dentry->d_inode->i_ino); if (node) { - dentry->short_name = utf16le_dupz(node->dos_name, - node->name_nbytes); - if (!dentry->short_name) + dentry->d_short_name = utf16le_dupz(node->dos_name, + node->name_nbytes); + if (!dentry->d_short_name) return WIMLIB_ERR_NOMEM; - dentry->short_name_nbytes = node->name_nbytes; + dentry->d_short_name_nbytes = node->name_nbytes; } else { WARNING("NTFS inode %"PRIu64" has Win32 name with no " "corresponding DOS name", diff --git a/src/solid.c b/src/solid.c index 704fb414..59971d46 100644 --- a/src/solid.c +++ b/src/solid.c @@ -115,9 +115,9 @@ blob_set_solid_sort_name_from_inode(struct blob_descriptor *blob, /* If this file has multiple names, choose the shortest one. */ inode_for_each_dentry(dentry, inode) { - if (dentry->file_name_nbytes < best_name_nbytes) { - best_name = dentry->file_name; - best_name_nbytes = dentry->file_name_nbytes; + if (dentry->d_name_nbytes < best_name_nbytes) { + best_name = dentry->d_name; + best_name_nbytes = dentry->d_name_nbytes; } } blob->solid_sort_name = utf16le_dupz(best_name, best_name_nbytes); diff --git a/src/update_image.c b/src/update_image.c index 15d7f749..e58b22dc 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -315,13 +315,13 @@ rollback_update_primitive(const struct update_primitive *prim, break; case CHANGE_FILE_NAME: rollback_name_change(prim->name.old_name, - &prim->name.subject->file_name, - &prim->name.subject->file_name_nbytes); + &prim->name.subject->d_name, + &prim->name.subject->d_name_nbytes); break; case CHANGE_SHORT_NAME: rollback_name_change(prim->name.old_name, - &prim->name.subject->short_name, - &prim->name.subject->short_name_nbytes); + &prim->name.subject->d_short_name, + &prim->name.subject->d_short_name_nbytes); break; } } @@ -420,26 +420,26 @@ journaled_change_name(struct update_command_journal *j, prim.type = CHANGE_FILE_NAME; prim.name.subject = dentry; - prim.name.old_name = dentry->file_name; + prim.name.old_name = dentry->d_name; ret = record_update_primitive(j, prim); if (ret) { FREE(new_name); return ret; } - dentry->file_name = new_name; - dentry->file_name_nbytes = new_name_nbytes; + dentry->d_name = new_name; + dentry->d_name_nbytes = new_name_nbytes; /* Clear the short name. */ prim.type = CHANGE_SHORT_NAME; prim.name.subject = dentry; - prim.name.old_name = dentry->short_name; + prim.name.old_name = dentry->d_short_name; ret = record_update_primitive(j, prim); if (ret) return ret; - dentry->short_name = NULL; - dentry->short_name_nbytes = 0; + dentry->d_short_name = NULL; + dentry->d_short_name_nbytes = 0; return 0; } @@ -513,8 +513,8 @@ handle_conflict(struct wim_dentry *branch, struct wim_dentry *existing, existing_child = get_dentry_child_with_utf16le_name(existing, - new_child->file_name, - new_child->file_name_nbytes, + new_child->d_name, + new_child->d_name_nbytes, WIMLIB_CASE_PLATFORM_DEFAULT); unlink_dentry(new_child); if (existing_child) { diff --git a/src/wildcard.c b/src/wildcard.c index febe8ee0..2bc9c6b8 100644 --- a/src/wildcard.c +++ b/src/wildcard.c @@ -191,11 +191,11 @@ match_dentry(struct wim_dentry *cur_dentry, struct match_dentry_ctx *ctx) size_t name_nchars; int ret; - if (cur_dentry->file_name_nbytes == 0) + if (cur_dentry->d_name_nbytes == 0) return 0; - ret = utf16le_get_tstr(cur_dentry->file_name, - cur_dentry->file_name_nbytes, + ret = utf16le_get_tstr(cur_dentry->d_name, + cur_dentry->d_name_nbytes, &name, &name_nchars); if (ret) return ret; diff --git a/src/win32_apply.c b/src/win32_apply.c index 7593f20e..45b1d653 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -1149,7 +1149,7 @@ remove_conflicting_short_name(const struct wim_dentry *dentry, struct win32_appl 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). */ @@ -1226,7 +1226,7 @@ set_short_name(HANDLE h, const struct wim_dentry *dentry, */ 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; @@ -1235,8 +1235,8 @@ set_short_name(HANDLE h, const struct wim_dentry *dentry, 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, @@ -1245,7 +1245,7 @@ retry: 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]; @@ -1279,7 +1279,7 @@ retry: * 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); @@ -1290,7 +1290,7 @@ retry: /* 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++; diff --git a/src/win32_capture.c b/src/win32_capture.c index db2ea0ec..95d87700 100644 --- a/src/win32_capture.c +++ b/src/win32_capture.c @@ -248,11 +248,11 @@ winnt_get_short_name(HANDLE h, struct wim_dentry *dentry) FileAlternateNameInformation); info = (const FILE_NAME_INFORMATION *)buf; if (NT_SUCCESS(status) && info->FileNameLength != 0) { - dentry->short_name = utf16le_dupz(info->FileName, - info->FileNameLength); - if (!dentry->short_name) + dentry->d_short_name = utf16le_dupz(info->FileName, + info->FileNameLength); + if (!dentry->d_short_name) return STATUS_NO_MEMORY; - dentry->short_name_nbytes = info->FileNameLength; + dentry->d_short_name_nbytes = info->FileNameLength; } return status; } -- 2.43.0