]> wimlib.net Git - wimlib/blobdiff - src/extract_image.c
imagex-export.1.in: Clarify sentence
[wimlib] / src / extract_image.c
index 20b44ee26aac24aa1720282398533af2dd00ac29..fad438f52b27eeb62347e8dcfcb4642c1f8e8e06 100644 (file)
@@ -187,7 +187,8 @@ dentry_find_streams_to_extract(struct wim_dentry *dentry, void *_ctx)
 
        lte = inode_unnamed_lte_resolved(inode);
        if (lte) {
-               maybe_add_stream_for_extraction(lte, stream_list);
+               if (!inode->i_visited)
+                       maybe_add_stream_for_extraction(lte, stream_list);
                list_add_tail(&dentry->tmp_list, &lte->lte_dentry_list);
                dentry_added = true;
        }
@@ -210,8 +211,10 @@ dentry_find_streams_to_extract(struct wim_dentry *dentry, void *_ctx)
                        if (inode->i_ads_entries[i].stream_name_nbytes != 0) {
                                lte = inode->i_ads_entries[i].lte;
                                if (lte) {
-                                       maybe_add_stream_for_extraction(lte,
-                                                                       stream_list);
+                                       if (!inode->i_visited) {
+                                               maybe_add_stream_for_extraction(lte,
+                                                                               stream_list);
+                                       }
                                        if (!dentry_added) {
                                                list_add_tail(&dentry->tmp_list,
                                                              &lte->lte_dentry_list);
@@ -221,6 +224,7 @@ dentry_find_streams_to_extract(struct wim_dentry *dentry, void *_ctx)
                        }
                }
        }
+       inode->i_visited = 1;
        return 0;
 }
 
@@ -259,6 +263,7 @@ static int
 dentry_reset_needs_extraction(struct wim_dentry *dentry, void *_ignore)
 {
        dentry->needs_extraction = 0;
+       dentry->d_inode->i_visited = 0;
        return 0;
 }
 
@@ -741,7 +746,6 @@ wimlib_extract_files(WIMStruct *wim,
 {
        int ret;
        struct wimlib_extract_command *cmds_copy;
-       struct wim_lookup_table *wim_tab_save, *joined_tab;
        int all_flags = 0;
 
        default_extract_flags &= WIMLIB_EXTRACT_MASK_PUBLIC;
@@ -753,15 +757,8 @@ wimlib_extract_files(WIMStruct *wim,
        if (num_cmds == 0)
                goto out;
 
-       if (num_additional_swms) {
-               ret = new_joined_lookup_table(wim, additional_swms,
-                                             num_additional_swms,
-                                             &joined_tab);
-               if (ret)
-                       goto out;
-               wim_tab_save = wim->lookup_table;
-               wim->lookup_table = joined_tab;
-       }
+       if (num_additional_swms)
+               merge_lookup_tables(wim, additional_swms, num_additional_swms);
 
        cmds_copy = CALLOC(num_cmds, sizeof(cmds[0]));
        if (!cmds_copy) {
@@ -805,10 +802,8 @@ out_free_cmds_copy:
        }
        FREE(cmds_copy);
 out_restore_lookup_table:
-       if (num_additional_swms) {
-               free_lookup_table(wim->lookup_table);
-               wim->lookup_table = wim_tab_save;
-       }
+       if (num_additional_swms)
+               unmerge_lookup_table(wim);
 out:
        return ret;
 }
@@ -932,7 +927,6 @@ wimlib_extract_image(WIMStruct *wim,
                     unsigned num_additional_swms,
                     wimlib_progress_func_t progress_func)
 {
-       struct wim_lookup_table *joined_tab, *wim_tab_save;
        int ret;
 
        extract_flags &= WIMLIB_EXTRACT_MASK_PUBLIC;
@@ -941,14 +935,8 @@ wimlib_extract_image(WIMStruct *wim,
        if (ret)
                return ret;
 
-       if (num_additional_swms) {
-               ret = new_joined_lookup_table(wim, additional_swms,
-                                             num_additional_swms, &joined_tab);
-               if (ret)
-                       return ret;
-               wim_tab_save = wim->lookup_table;
-               wim->lookup_table = joined_tab;
-       }
+       if (num_additional_swms)
+               merge_lookup_tables(wim, additional_swms, num_additional_swms);
 
        if (image == WIMLIB_ALL_IMAGES) {
                ret = extract_all_images(wim, target,
@@ -966,9 +954,7 @@ wimlib_extract_image(WIMStruct *wim,
                                       lte_free_extracted_file,
                                       NULL);
        }
-       if (num_additional_swms) {
-               free_lookup_table(wim->lookup_table);
-               wim->lookup_table = wim_tab_save;
-       }
+       if (num_additional_swms)
+               unmerge_lookup_table(wim);
        return ret;
 }