Rename dentry name fields
authorEric Biggers <ebiggers3@gmail.com>
Sun, 31 May 2015 14:57:23 +0000 (09:57 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 5 Jun 2015 03:45:34 +0000 (22:45 -0500)
    file_name          => d_name
    file_name_nbytes   => d_name_nbytes
    short_name         => d_short_name
    short_name_nbytes  => d_short_name_nbytes

14 files changed:
include/wimlib/apply.h
include/wimlib/dentry.h
include/wimlib/inode.h
src/dentry.c
src/extract.c
src/iterate_dir.c
src/mount_image.c
src/ntfs-3g_apply.c
src/ntfs-3g_capture.c
src/solid.c
src/update_image.c
src/wildcard.c
src/win32_apply.c
src/win32_capture.c

index ad21418..071f5ed 100644 (file)
@@ -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
index 025a56c..dc7770b 100644 (file)
@@ -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 */
index fc8ddc2..00cd7f1 100644 (file)
@@ -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;
index 7ba4358..cb1b4df 100644 (file)
@@ -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)
index ea9c252..0401758 100644 (file)
@@ -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;
index 451143a..c9de38c 100644 (file)
@@ -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;
index 0ae5f21..e2f0ffb 100644 (file)
@@ -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;
        }
index 9de5774..3dcf8d5 100644 (file)
@@ -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;
index 5a97cff..7ad9976 100644 (file)
@@ -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",
index 704fb41..59971d4 100644 (file)
@@ -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);
index 15d7f74..e58b22d 100644 (file)
@@ -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) {
index febe8ee..2bc9c6b 100644 (file)
@@ -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;
index 7593f20..45b1d65 100644 (file)
@@ -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++;
index db2ea0e..95d8770 100644 (file)
@@ -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;
 }