From: Eric Biggers Date: Mon, 26 May 2014 03:13:39 +0000 (-0500) Subject: struct wim_dentry: Rename 'parent' to 'd_parent' X-Git-Tag: v1.7.0~105 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=57318a10de8d50cd338fa4c0e4e0b9f60e7c0143 struct wim_dentry: Rename 'parent' to 'd_parent' --- diff --git a/include/wimlib/dentry.h b/include/wimlib/dentry.h index df1b3ed7..2dd98fb4 100644 --- a/include/wimlib/dentry.h +++ b/include/wimlib/dentry.h @@ -65,7 +65,7 @@ struct wim_dentry { struct list_head d_ci_conflict_list; /* The parent of this directory entry. */ - struct wim_dentry *parent; + struct wim_dentry *d_parent; /* Linked list node that places this dentry in the list of aliases for * its inode (d_inode) */ @@ -285,7 +285,7 @@ write_dentry_tree(struct wim_dentry *root, u8 *p); static inline bool dentry_is_root(const struct wim_dentry *dentry) { - return dentry->parent == dentry; + return dentry->d_parent == dentry; } static inline bool diff --git a/src/dentry.c b/src/dentry.c index 763198d1..71d70bb8 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -419,7 +419,7 @@ calculate_dentry_full_path(struct wim_dentry *dentry) do { ulen += d->file_name_nbytes / sizeof(utf16lechar); ulen++; - d = d->parent; /* assumes d == d->parent for root */ + d = d->d_parent; /* assumes d == d->d_parent for root */ } while (!dentry_is_root(d)); utf16lechar ubuf[ulen]; @@ -430,7 +430,7 @@ calculate_dentry_full_path(struct wim_dentry *dentry) p -= d->file_name_nbytes / sizeof(utf16lechar); memcpy(p, d->file_name, d->file_name_nbytes); *--p = cpu_to_le16(WIM_PATH_SEPARATOR); - d = d->parent; /* assumes d == d->parent for root */ + d = d->d_parent; /* assumes d == d->d_parent for root */ } while (!dentry_is_root(d)); wimlib_assert(p == ubuf); @@ -880,7 +880,7 @@ new_dentry(const tchar *name, struct wim_dentry **dentry_ret) return ret; } } - dentry->parent = dentry; + dentry->d_parent = dentry; *dentry_ret = dentry; return 0; } @@ -1102,7 +1102,7 @@ dentry_add_child(struct wim_dentry *parent, struct wim_dentry *child) } else { INIT_LIST_HEAD(&child->d_ci_conflict_list); } - child->parent = parent; + child->d_parent = parent; return NULL; } @@ -1115,7 +1115,7 @@ unlink_dentry(struct wim_dentry *dentry) if (dentry_is_root(dentry)) return; - dir = dentry->parent->d_inode; + dir = dentry->d_parent->d_inode; dir_unindex_child(dir, dentry); @@ -1369,8 +1369,8 @@ read_dentry_tree_recursive(const u8 * restrict buf, size_t buf_len, /* Check for cyclic directory structure, which would cause infinite * recursion if not handled. */ - for (struct wim_dentry *d = dir->parent; - !dentry_is_root(d); d = d->parent) + for (struct wim_dentry *d = dir->d_parent; + !dentry_is_root(d); d = d->d_parent) { if (unlikely(d->subdir_offset == cur_offset)) { ERROR("Cyclic directory structure detected: children " diff --git a/src/extract.c b/src/extract.c index a6b8d9ef..24c3e751 100644 --- a/src/extract.c +++ b/src/extract.c @@ -442,7 +442,7 @@ remove_contained_trees(struct wim_dentry **trees, size_t num_trees) for (i = 0; i < num_trees; i++) { struct wim_dentry *d = trees[i]; while (!dentry_is_root(d)) { - d = d->parent; + d = d->d_parent; if (d->tmp_flag) goto tree_contained; } @@ -509,7 +509,7 @@ build_dentry_list(struct list_head *dentry_list, struct wim_dentry **trees, place_after = dentry_list; ancestor = dentry; do { - ancestor = ancestor->parent; + ancestor = ancestor->d_parent; if (will_extract_dentry(ancestor)) { place_after = &ancestor->d_extraction_list_node; break; @@ -518,7 +518,7 @@ build_dentry_list(struct list_head *dentry_list, struct wim_dentry **trees, ancestor = dentry; do { - ancestor = ancestor->parent; + ancestor = ancestor->d_parent; if (will_extract_dentry(ancestor)) break; list_add(&ancestor->d_extraction_list_node, place_after); diff --git a/src/iterate_dir.c b/src/iterate_dir.c index 4e286b15..d0311358 100644 --- a/src/iterate_dir.c +++ b/src/iterate_dir.c @@ -66,7 +66,7 @@ init_wimlib_dentry(struct wimlib_dir_entry *wdentry, struct wim_dentry *dentry, return ret; wdentry->full_path = dentry->_full_path; - for (struct wim_dentry *d = dentry; !dentry_is_root(d); d = d->parent) + for (struct wim_dentry *d = dentry; !dentry_is_root(d); d = d->d_parent) wdentry->depth++; if (inode->i_security_id >= 0) { diff --git a/src/mount_image.c b/src/mount_image.c index 507330ed..81796cbc 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -540,7 +540,7 @@ touch_inode(struct wim_inode *inode) static void touch_parent(struct wim_dentry *dentry) { - touch_inode(dentry->parent->d_inode); + touch_inode(dentry->d_parent->d_inode); } /* diff --git a/src/ntfs-3g_apply.c b/src/ntfs-3g_apply.c index c61a8882..ff145a61 100644 --- a/src/ntfs-3g_apply.c +++ b/src/ntfs-3g_apply.c @@ -285,7 +285,7 @@ ntfs_3g_restore_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni, goto out_close; if (!dir_ni) - dir_ni = ntfs_inode_open(vol, dentry->parent->d_inode->i_mft_no); + dir_ni = ntfs_inode_open(vol, dentry->d_parent->d_inode->i_mft_no); if (!ni) ni = ntfs_inode_open(vol, dentry->d_inode->i_mft_no); if (dir_ni && ni) { @@ -307,7 +307,7 @@ ntfs_3g_restore_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni, /* Unlike most other NTFS-3g functions, ntfs_set_ntfs_dos_name() * changes the directory's last modification timestamp... * Change it back. */ - return ntfs_3g_restore_timestamps(vol, dentry->parent->d_inode); + return ntfs_3g_restore_timestamps(vol, dentry->d_parent->d_inode); out_close: /* ntfs_inode_close() can take a NULL argument, but it's probably best @@ -543,7 +543,7 @@ ntfs_3g_add_link(ntfs_inode *ni, struct wim_dentry *dentry) int res; /* Open the inode of the parent directory. */ - dir_ni = ntfs_inode_open(ni->vol, dentry->parent->d_inode->i_mft_no); + dir_ni = ntfs_inode_open(ni->vol, dentry->d_parent->d_inode->i_mft_no); if (!dir_ni) goto fail; @@ -578,10 +578,10 @@ ntfs_3g_create_nondirectory(struct wim_inode *inode, /* Create first link. */ - dir_ni = ntfs_inode_open(ctx->vol, first_dentry->parent->d_inode->i_mft_no); + dir_ni = ntfs_inode_open(ctx->vol, first_dentry->d_parent->d_inode->i_mft_no); if (!dir_ni) { ERROR_WITH_ERRNO("Can't open \"%s\" in NTFS volume", - dentry_full_path(first_dentry->parent)); + dentry_full_path(first_dentry->d_parent)); return WIMLIB_ERR_NTFS_3G; } @@ -619,7 +619,7 @@ ntfs_3g_create_nondirectory(struct wim_inode *inode, /* Close the directory in which the first link was created. */ if (ntfs_inode_close(dir_ni)) { ERROR_WITH_ERRNO("Failed to close \"%s\" in NTFS volume", - dentry_full_path(first_dentry->parent)); + dentry_full_path(first_dentry->d_parent)); ret = WIMLIB_ERR_NTFS_3G; goto out_close_ni; } diff --git a/src/unix_apply.c b/src/unix_apply.c index 8b8d9bf5..25b28f9d 100644 --- a/src/unix_apply.c +++ b/src/unix_apply.c @@ -113,7 +113,7 @@ unix_dentry_path_length(const struct wim_dentry *dentry) d = dentry; do { len += d->d_extraction_name_nchars + 1; - d = d->parent; + d = d->d_parent; } while (!dentry_is_root(d) && will_extract_dentry(d)); return len; @@ -161,7 +161,7 @@ unix_build_extraction_path(const struct wim_dentry *dentry, p -= d->d_extraction_name_nchars; memcpy(p, d->d_extraction_name, d->d_extraction_name_nchars); *--p = '/'; - d = d->parent; + d = d->d_parent; } while (!dentry_is_root(d) && will_extract_dentry(d)); return pathbuf; diff --git a/src/update_image.c b/src/update_image.c index 1e2ca6e8..27f921dc 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -212,13 +212,13 @@ do_unlink(struct wim_dentry *subject, struct wim_dentry *parent, { if (parent) { /* Unlink @subject from its @parent. */ - wimlib_assert(subject->parent == parent); + wimlib_assert(subject->d_parent == parent); unlink_dentry(subject); } else { /* Unset @subject as the root of the image. */ *root_p = NULL; } - subject->parent = subject; + subject->d_parent = subject; } static void @@ -362,7 +362,7 @@ journaled_unlink(struct update_command_journal *j, struct wim_dentry *subject) if (dentry_is_root(subject)) parent = NULL; else - parent = subject->parent; + parent = subject->d_parent; prim.type = UNLINK_DENTRY; prim.link.subject = subject; @@ -521,7 +521,7 @@ handle_conflict(struct wim_dentry *branch, struct wim_dentry *existing, struct wim_dentry *parent; int ret; - parent = existing->parent; + parent = existing->d_parent; ret = calculate_dentry_full_path(existing); if (ret) @@ -936,7 +936,7 @@ is_ancestor(const struct wim_dentry *d1, const struct wim_dentry *d2) return true; if (dentry_is_root(d2)) return false; - d2 = d2->parent; + d2 = d2->d_parent; } } @@ -983,7 +983,7 @@ rename_wim_path(WIMStruct *wim, const tchar *from, const tchar *to, if (dentry_has_children(dst)) return -ENOTEMPTY; } - parent_of_dst = dst->parent; + parent_of_dst = dst->d_parent; } else { /* Destination does not exist */ parent_of_dst = get_parent_dentry(wim, to, case_type); diff --git a/src/win32_apply.c b/src/win32_apply.c index ecd71831..0cd67afa 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -357,7 +357,7 @@ dentry_extraction_path_length(const struct wim_dentry *dentry) d = dentry; do { len += d->d_extraction_name_nchars + 1; - d = d->parent; + d = d->d_parent; } while (!dentry_is_root(d) && will_extract_dentry(d)); return --len; /* No leading slash */ @@ -426,8 +426,8 @@ build_extraction_path(const struct wim_dentry *dentry, ctx->pathbuf.Length = len * sizeof(wchar_t); p = ctx->pathbuf.Buffer + len; for (d = dentry; - !dentry_is_root(d->parent) && will_extract_dentry(d->parent); - d = d->parent) + !dentry_is_root(d->d_parent) && will_extract_dentry(d->d_parent); + d = d->d_parent) { p -= d->d_extraction_name_nchars; wmemcpy(p, d->d_extraction_name, d->d_extraction_name_nchars);