+
+ if (extract_flags & WIMLIB_EXTRACT_FLAG_SEQUENTIAL) {
+ struct list_head stream_list;
+ INIT_LIST_HEAD(&stream_list);
+ w->private = &stream_list;
+ for_dentry_in_tree(root, dentry_add_streams_for_extraction, w);
+ ret = sort_stream_list_by_wim_position(&stream_list);
+ args.extract_flags &= ~WIMLIB_EXTRACT_FLAG_DIRS_ONLY;
+ if (ret == 0) {
+ args.extract_flags |= WIMLIB_EXTRACT_FLAG_SKIP_DIRS;
+ struct lookup_table_entry *lte;
+ struct lookup_table_entry *tmp;
+ struct dentry *dentry;
+ list_for_each_entry_safe(lte, tmp, &stream_list, staging_list) {
+ list_del(<e->staging_list);
+ lte->extracted_file = NULL;
+ list_for_each_entry(dentry, <e->dentry_list, tmp_list) {
+ ret = extract_dentry(dentry, &args);
+ if (ret != 0)
+ return ret;
+ }
+ FREE(lte->extracted_file);
+ }
+ args.extract_flags |= WIMLIB_EXTRACT_FLAG_EMPTY_ONLY;
+ ret = for_dentry_in_tree(root, extract_dentry, &args);
+ if (ret != 0)
+ return ret;
+ args.extract_flags &= ~(WIMLIB_EXTRACT_FLAG_SKIP_DIRS |
+ WIMLIB_EXTRACT_FLAG_EMPTY_ONLY);
+ } else {
+ WARNING("Falling back to non-sequential image extraction");
+ ret = for_dentry_in_tree(root, extract_dentry, &args);
+ if (ret != 0)
+ return ret;
+ }
+ }
+
+ return for_dentry_in_tree_depth(root, apply_dentry_timestamps, &args);