]> wimlib.net Git - wimlib/commitdiff
add_params: Embed inode table and sd_set directly
authorEric Biggers <ebiggers3@gmail.com>
Tue, 14 May 2013 16:04:58 +0000 (11:04 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 14 May 2013 16:04:58 +0000 (11:04 -0500)
src/ntfs-capture.c
src/unix_capture.c
src/update_image.c
src/wimlib_internal.h
src/win32_capture.c
src/win32_common.c

index b0258a891367a32966c0a777f54bb5c0d171ce0a..5c46504617c1561d691715660c2280db1a4f49b3 100644 (file)
@@ -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(&params->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(&params->sd_set,
                                                             sd, ret);
                        if (inode->i_security_id == -1) {
                                ERROR("Out of memory");
index 963e53dabfb388c1e33dc1a0383348ea972e8ab7..4164a6246bf066ade122dabade0f4d1b77bca071 100644 (file)
@@ -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(&params->inode_table,
                                     path_basename_with_len(path, path_len),
                                     stbuf.st_ino, stbuf.st_dev, false, &root);
        if (ret)
index 9453f2e02cf9d23bee7ae83861c18089e9974131..e85cd60671fa4350c11e3f41fe7ce5e25b978757 100644 (file)
@@ -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(&params.inode_table, 9001);
        if (ret)
                goto out;
 
-       ret = init_sd_set(&sd_set, imd->security_data);
+       ret = init_sd_set(&params.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(&params.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(&params.sd_set, rollback_sd);
 out_destroy_inode_table:
-       destroy_inode_table(&inode_table);
+       destroy_inode_table(&params.inode_table);
 out:
        return ret;
 }
index 08a176cf277d7855428292ef93cce17a1001fd5d..84a7998fd15d6e41a5cc3f3a9bc50b8d559633d5 100644 (file)
 #include "util.h"
 #include "list.h"
 #include "wimlib.h"
-
-#if defined(WITH_FUSE) || defined(ENABLE_MULTITHREADED_COMPRESSION)
-#include <pthread.h>
-#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. */
index e2d98078702f840b68ff8a14848999ad8309f43e..aeabfa91ae8f2a9a4d6994f0ef33b3bd843fee78 100644 (file)
@@ -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(&params->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, &params->sd_set,
                                                    path, state,
                                                    params->add_flags);
                if (ret)
index 484afea6061eda610f8093687a1a3a0fa8fa7aa6..668f96d8a57efea6fe27ee3fb421b18de3001daf 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <shlwapi.h> /* for PathMatchSpecW() */
 #include <errno.h>
+#include <pthread.h>
 
 #include "win32_common.h"