From 23ea88c8b6eae44e1a50b104f8a5d3314b59c4e9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 13 May 2014 11:17:03 -0500 Subject: [PATCH] wim_root_dentry() => wim_get_current_root_dentry() Likewise for wim_security_data(). --- include/wimlib/metadata.h | 22 ++++++++-------------- src/dentry.c | 2 +- src/extract.c | 6 +++--- src/iterate_dir.c | 10 +++++----- src/update_image.c | 2 +- src/wildcard.c | 2 +- 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/include/wimlib/metadata.h b/include/wimlib/metadata.h index 7f1c7c02..6e421204 100644 --- a/include/wimlib/metadata.h +++ b/include/wimlib/metadata.h @@ -46,36 +46,30 @@ struct wim_image_metadata { #endif }; +/* Retrieve the metadata of the image in @wim currently selected with + * select_wim_image(). */ static inline struct wim_image_metadata * wim_get_current_image_metadata(WIMStruct *wim) { return wim->image_metadata[wim->current_image - 1]; } -static inline const struct wim_image_metadata * -wim_get_const_current_image_metadata(const WIMStruct *wim) -{ - return wim->image_metadata[wim->current_image - 1]; -} - +/* Retrieve the root dentry of the image in @wim currently selected with + * select_wim_image(). */ static inline struct wim_dentry * -wim_root_dentry(WIMStruct *wim) +wim_get_current_root_dentry(WIMStruct *wim) { return wim_get_current_image_metadata(wim)->root_dentry; } +/* Retrieve the security data of the image in @wim currently selected with + * select_wim_image(). */ static inline struct wim_security_data * -wim_security_data(WIMStruct *wim) +wim_get_current_security_data(WIMStruct *wim) { return wim_get_current_image_metadata(wim)->security_data; } -static inline const struct wim_security_data * -wim_const_security_data(const WIMStruct *wim) -{ - return wim_get_const_current_image_metadata(wim)->security_data; -} - /* Iterate over each inode in a WIM image that has not yet been hashed */ #define image_for_each_inode(inode, imd) \ list_for_each_entry(inode, &imd->inode_list, i_list) diff --git a/src/dentry.c b/src/dentry.c index 13f36ca6..5435a648 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -649,7 +649,7 @@ get_dentry_utf16le(WIMStruct *wim, const utf16lechar *path, /* Start with the root directory of the image. Note: this will be NULL * if an image has been added directly with wimlib_add_empty_image() but * no files have been added yet; in that case we fail with ENOENT. */ - cur_dentry = wim_root_dentry(wim); + cur_dentry = wim_get_current_root_dentry(wim); name_start = path; for (;;) { diff --git a/src/extract.c b/src/extract.c index 422cd9cc..36b6583c 100644 --- a/src/extract.c +++ b/src/extract.c @@ -658,11 +658,11 @@ extract_security(const tchar *path, struct apply_ctx *ctx, if (ctx->supported_features.security_descriptors && inode->i_security_id != -1) { - const struct wim_security_data *sd; + struct wim_security_data *sd; const u8 *desc; size_t desc_size; - sd = wim_const_security_data(ctx->wim); + sd = wim_get_current_security_data(ctx->wim); desc = sd->descriptors[inode->i_security_id]; desc_size = sd->sizes[inode->i_security_id]; @@ -2472,7 +2472,7 @@ extract_trees(WIMStruct *wim, struct wim_dentry **trees, size_t num_trees, ctx.progress.extract.target = target; } - ctx.target_dentry = wim_root_dentry(wim); + ctx.target_dentry = wim_get_current_root_dentry(wim); /* Note: ctx.target_dentry represents the dentry that gets extracted to * @target. There may be none, in which case it gets set to the image * root and never matches any of the dentries actually being extracted. diff --git a/src/iterate_dir.c b/src/iterate_dir.c index db43f502..693245e5 100644 --- a/src/iterate_dir.c +++ b/src/iterate_dir.c @@ -40,10 +40,8 @@ #include "wimlib/wim.h" static int -init_wimlib_dentry(struct wimlib_dir_entry *wdentry, - struct wim_dentry *dentry, - const WIMStruct *wim, - int flags) +init_wimlib_dentry(struct wimlib_dir_entry *wdentry, struct wim_dentry *dentry, + WIMStruct *wim, int flags) { int ret; size_t dummy; @@ -70,7 +68,9 @@ init_wimlib_dentry(struct wimlib_dir_entry *wdentry, wdentry->depth++; if (inode->i_security_id >= 0) { - const struct wim_security_data *sd = wim_const_security_data(wim); + struct wim_security_data *sd; + + sd = wim_get_current_security_data(wim); wdentry->security_descriptor = sd->descriptors[inode->i_security_id]; wdentry->security_descriptor_size = sd->sizes[inode->i_security_id]; } diff --git a/src/update_image.c b/src/update_image.c index df0ab990..a88ccd92 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -1106,7 +1106,7 @@ execute_update_commands(WIMStruct *wim, if (ret) goto out; - ret = init_sd_set(sd_set, wim_security_data(wim)); + ret = init_sd_set(sd_set, wim_get_current_security_data(wim)); if (ret) goto out_destroy_inode_table; diff --git a/src/wildcard.c b/src/wildcard.c index 234ee91c..958829a2 100644 --- a/src/wildcard.c +++ b/src/wildcard.c @@ -326,7 +326,7 @@ expand_wildcard(WIMStruct *wim, struct wim_dentry *root; int ret; - root = wim_root_dentry(wim); + root = wim_get_current_root_dentry(wim); if (root == NULL) goto no_match; -- 2.43.0