]> wimlib.net Git - wimlib/commitdiff
win32_capture: make open by file ID opt-in
authorEric Biggers <ebiggers3@gmail.com>
Sun, 17 Jan 2016 23:06:12 +0000 (17:06 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 17 Jan 2016 23:09:20 +0000 (17:09 -0600)
NEWS
include/wimlib.h
src/update_image.c
src/win32_capture.c

diff --git a/NEWS b/NEWS
index c9e05d314e5be4acd297aad711148d627c412370..ac4faf692171479164523cc346cf28019b9f55a7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ Version 1.9.0-BETA:
        Significantly improved performance of directory scans of full NTFS
        volumes on Windows 8 and later.
 
        Significantly improved performance of directory scans of full NTFS
        volumes on Windows 8 and later.
 
+       On Windows, to improve capture performance, wimlib now sometimes opens
+       files by inode number rather than by path.  This is enabled for
+       wimcapture and wimappend, but for now other applications have to opt-in.
+
        The progress messages printed by wimlib-imagex while writing WIM files
        have been slightly tweaked.
 
        The progress messages printed by wimlib-imagex while writing WIM files
        have been slightly tweaked.
 
index 4279ac21a0a31a90cd230009a89b10cb7b8cf13d..500132e94109a4d4caa62b97fee30f0cd32b0934 100644 (file)
@@ -1757,6 +1757,15 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  */
 #define WIMLIB_ADD_FLAG_SNAPSHOT               0x00008000
 
  */
 #define WIMLIB_ADD_FLAG_SNAPSHOT               0x00008000
 
+/**
+ * Permit the library to discard file paths after the initial scan.  If the
+ * application won't use WIMLIB_WRITE_FLAG_SEND_DONE_WITH_FILE_MESSAGES while
+ * writing the WIM archive, this flag can be used to allow the library to enable
+ * optimizations such as opening files by inode number rather than by path.
+ * Currently this only makes a difference on Windows.
+ */
+#define WIMLIB_ADD_FLAG_FILE_PATHS_UNNEEDED    0x00010000
+
 /** @} */
 /** @addtogroup G_modifying_wims
  * @{ */
 /** @} */
 /** @addtogroup G_modifying_wims
  * @{ */
index c24ee1947ba498b9edd0fe0284d4f4580840af14..c07b19d6db609cb25a5bfdaefb7faf57b93b184b 100644 (file)
@@ -1205,7 +1205,8 @@ check_add_command(struct wimlib_update_command *cmd,
                          WIMLIB_ADD_FLAG_WIMBOOT |
                          WIMLIB_ADD_FLAG_NO_REPLACE |
                          WIMLIB_ADD_FLAG_TEST_FILE_EXCLUSION |
                          WIMLIB_ADD_FLAG_WIMBOOT |
                          WIMLIB_ADD_FLAG_NO_REPLACE |
                          WIMLIB_ADD_FLAG_TEST_FILE_EXCLUSION |
-                         WIMLIB_ADD_FLAG_SNAPSHOT))
+                         WIMLIB_ADD_FLAG_SNAPSHOT |
+                         WIMLIB_ADD_FLAG_FILE_PATHS_UNNEEDED))
                return WIMLIB_ERR_INVALID_PARAM;
 
        bool is_entire_image = WIMLIB_IS_WIM_ROOT_PATH(cmd->add.wim_target_path);
                return WIMLIB_ERR_INVALID_PARAM;
 
        bool is_entire_image = WIMLIB_IS_WIM_ROOT_PATH(cmd->add.wim_target_path);
index 196342e6ed76699281d8d8220cb4e755fdb80614..ef7d118a20dbde54d615665a5ca2a8460e49ab01 100644 (file)
@@ -2643,22 +2643,22 @@ generate_wim_structures_recursive(struct wim_dentry **root_ret,
        ns = FIRST_STREAM(ni);
        for (u32 i = 0; i < ni->num_streams; i++) {
                struct windows_file *windows_file;
        ns = FIRST_STREAM(ni);
        for (u32 i = 0; i < ni->num_streams; i++) {
                struct windows_file *windows_file;
-               size_t stream_name_nchars;
 
 
+               /* Reference the stream by path if it's a named data stream, or
+                * if the volume doesn't support "open by file ID", or if the
+                * application hasn't explicitly opted in to "open by file ID".
+                * Otherwise, only save the inode number (file ID).  */
                if (*ns->name ||
                if (*ns->name ||
-                   !(ctx->vol_flags & FILE_SUPPORTS_OPEN_BY_FILE_ID))
+                   !(ctx->vol_flags & FILE_SUPPORTS_OPEN_BY_FILE_ID) ||
+                   !(ctx->params->add_flags & WIMLIB_ADD_FLAG_FILE_PATHS_UNNEEDED))
                {
                {
-                       /* Named data stream: reference by path  */
-                       stream_name_nchars = wcslen(ns->name);
                        windows_file = alloc_windows_file(path,
                                                          path_nchars,
                                                          ns->name,
                        windows_file = alloc_windows_file(path,
                                                          path_nchars,
                                                          ns->name,
-                                                         stream_name_nchars,
+                                                         wcslen(ns->name),
                                                          ctx->snapshot,
                                                          false);
                } else {
                                                          ctx->snapshot,
                                                          false);
                } else {
-                       /* Unamed data stream: reference by file ID (inode number)  */
-                       stream_name_nchars = 0;
                        windows_file = alloc_windows_file_for_file_id(ni->ino,
                                                                      path,
                                                                      ctx->params->capture_root_nchars + 1,
                        windows_file = alloc_windows_file_for_file_id(ni->ino,
                                                                      path,
                                                                      ctx->params->capture_root_nchars + 1,