From: Eric Biggers Date: Tue, 14 May 2013 16:04:58 +0000 (-0500) Subject: add_params: Embed inode table and sd_set directly X-Git-Tag: v1.4.0~52 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=726f9bbd0bd664294fce8a50be1d5b6881df8d16 add_params: Embed inode table and sd_set directly --- diff --git a/src/ntfs-capture.c b/src/ntfs-capture.c index b0258a89..5c465046 100644 --- a/src/ntfs-capture.c +++ b/src/ntfs-capture.c @@ -582,7 +582,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret, } /* Create a WIM dentry with an associated inode, which may be shared */ - ret = inode_table_new_dentry(params->inode_table, + ret = inode_table_new_dentry(¶ms->inode_table, path_basename_with_len(path, path_len), ni->mft_no, 0, false, &root); if (ret) @@ -665,7 +665,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret, ni, dir_ni, sd, ret); } if (ret > 0) { - inode->i_security_id = sd_set_add_sd(params->sd_set, + inode->i_security_id = sd_set_add_sd(¶ms->sd_set, sd, ret); if (inode->i_security_id == -1) { ERROR("Out of memory"); diff --git a/src/unix_capture.c b/src/unix_capture.c index 963e53da..4164a624 100644 --- a/src/unix_capture.c +++ b/src/unix_capture.c @@ -243,7 +243,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret, goto out; } - ret = inode_table_new_dentry(params->inode_table, + ret = inode_table_new_dentry(¶ms->inode_table, path_basename_with_len(path, path_len), stbuf.st_ino, stbuf.st_dev, false, &root); if (ret) diff --git a/src/update_image.c b/src/update_image.c index 9453f2e0..e85cd606 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -168,8 +168,6 @@ execute_add_command(WIMStruct *wim, int add_flags; tchar *fs_source_path; tchar *wim_target_path; - struct wim_inode_table inode_table; - struct sd_set sd_set; struct wim_image_metadata *imd; struct list_head unhashed_streams; struct add_image_params params; @@ -217,19 +215,17 @@ execute_add_command(WIMStruct *wim, extra_arg = NULL; } - ret = init_inode_table(&inode_table, 9001); + ret = init_inode_table(¶ms.inode_table, 9001); if (ret) goto out; - ret = init_sd_set(&sd_set, imd->security_data); + ret = init_sd_set(¶ms.sd_set, imd->security_data); if (ret) goto out_destroy_inode_table; INIT_LIST_HEAD(&unhashed_streams); wim->lookup_table->unhashed_streams = &unhashed_streams; params.lookup_table = wim->lookup_table; - params.inode_table = &inode_table; - params.sd_set = &sd_set; params.config = config; params.add_flags = add_flags; params.progress_func = progress_func; @@ -272,7 +268,7 @@ execute_add_command(WIMStruct *wim, #ifdef WITH_NTFS_3G imd->ntfs_vol = ntfs_vol; #endif - inode_table_prepare_inode_list(&inode_table, &imd->inode_list); + inode_table_prepare_inode_list(¶ms.inode_table, &imd->inode_list); ret = 0; rollback_sd = false; if (add_flags & WIMLIB_ADD_FLAG_RPFIX) @@ -285,9 +281,9 @@ out_ntfs_umount: #endif free_dentry_tree(branch, wim->lookup_table); out_destroy_sd_set: - destroy_sd_set(&sd_set, rollback_sd); + destroy_sd_set(¶ms.sd_set, rollback_sd); out_destroy_inode_table: - destroy_inode_table(&inode_table); + destroy_inode_table(¶ms.inode_table); out: return ret; } diff --git a/src/wimlib_internal.h b/src/wimlib_internal.h index 08a176cf..84a7998f 100644 --- a/src/wimlib_internal.h +++ b/src/wimlib_internal.h @@ -30,10 +30,7 @@ #include "util.h" #include "list.h" #include "wimlib.h" - -#if defined(WITH_FUSE) || defined(ENABLE_MULTITHREADED_COMPRESSION) -#include -#endif +#include "security.h" #define WIMLIB_MAKEVERSION(major, minor, patch) \ ((major << 20) | (minor << 10) | patch) @@ -427,13 +424,12 @@ struct add_image_params { /* Pointer to the lookup table of the WIM. */ struct wim_lookup_table *lookup_table; - /* Pointer to a hash table of inodes that have been captured for this - * WIM image so far. */ - struct wim_inode_table *inode_table; + /* Hash table of inodes that have been captured for this tree so far. */ + struct wim_inode_table inode_table; - /* Pointer to the set of security descriptors that have been captured - * for this image so far. */ - struct sd_set *sd_set; + /* The set of security descriptors that have been captured for this + * image so far. */ + struct sd_set sd_set; /* Pointer to the capture configuration, which indicates whether any * files should be excluded from capture or not. */ diff --git a/src/win32_capture.c b/src/win32_capture.c index e2d98078..aeabfa91 100644 --- a/src/win32_capture.c +++ b/src/win32_capture.c @@ -1030,7 +1030,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, * only 1 link and refuse to hard link them. This is because Windows * has a bug where it can return duplicate File IDs for files and * directories on the FAT filesystem. */ - ret = inode_table_new_dentry(params->inode_table, + ret = inode_table_new_dentry(¶ms->inode_table, path_basename_with_len(path, path_num_chars), ((u64)file_info.nFileIndexHigh << 32) | (u64)file_info.nFileIndexLow, @@ -1061,7 +1061,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret, if (!(params->add_flags & WIMLIB_ADD_FLAG_NO_ACLS) && (vol_flags & FILE_PERSISTENT_ACLS)) { - ret = win32_get_security_descriptor(root, params->sd_set, + ret = win32_get_security_descriptor(root, ¶ms->sd_set, path, state, params->add_flags); if (ret) diff --git a/src/win32_common.c b/src/win32_common.c index 484afea6..668f96d8 100644 --- a/src/win32_common.c +++ b/src/win32_common.c @@ -27,6 +27,7 @@ #include /* for PathMatchSpecW() */ #include +#include #include "win32_common.h"