1 #ifndef _WIMLIB_APPLY_H
2 #define _WIMLIB_APPLY_H
4 #include "wimlib/compiler.h"
5 #include "wimlib/file_io.h"
6 #include "wimlib/list.h"
7 #include "wimlib/progress.h"
8 #include "wimlib/types.h"
11 /* These can be treated as counts (for required_features) or booleans (for
12 * supported_features). */
14 unsigned long archive_files;
15 unsigned long hidden_files;
16 unsigned long system_files;
17 unsigned long compressed_files;
18 unsigned long encrypted_files;
19 unsigned long encrypted_directories;
20 unsigned long not_context_indexed_files;
21 unsigned long sparse_files;
22 unsigned long named_data_streams;
23 unsigned long hard_links;
24 unsigned long reparse_points;
25 unsigned long symlink_reparse_points;
26 unsigned long other_reparse_points;
27 unsigned long security_descriptors;
28 unsigned long short_names;
29 unsigned long unix_data;
30 unsigned long timestamps;
31 unsigned long case_sensitive_filenames;
34 struct wim_lookup_table_entry;
35 struct read_stream_list_callbacks;
38 /* The WIMStruct from which files are being extracted from the currently
42 /* The target of the extraction, usually the path to a directory. */
45 /* Length of @target in tchars. */
48 /* Extraction flags (WIMLIB_EXTRACT_FLAG_*) */
51 /* User-provided progress function, or NULL if not specified. */
52 wimlib_progress_func_t progfunc;
55 /* Progress data buffer, with progress.extract initialized. */
56 union wimlib_progress_info progress;
58 /* Features required to extract the files (with counts) */
59 struct wim_features required_features;
61 /* Features supported by the extraction mode (with booleans) */
62 struct wim_features supported_features;
64 /* The members below should not be used outside of extract.c */
66 unsigned long invalid_sequence;
67 unsigned long num_streams_remaining;
68 struct list_head stream_list;
69 const struct read_stream_list_callbacks *saved_cbs;
70 struct wim_lookup_table_entry *cur_stream;
71 u64 cur_stream_offset;
72 struct filedes tmpfile_fd;
74 unsigned int count_until_file_progress;
77 /* Maximum number of UNIX file descriptors, NTFS attributes, or Windows file
78 * handles that can be opened simultaneously to extract a single-instance
79 * stream to multiple destinations. */
80 #define MAX_OPEN_STREAMS 512
83 extract_progress(struct apply_ctx *ctx, enum wimlib_progress_msg msg)
85 return call_progress(ctx->progfunc, msg, &ctx->progress, ctx->progctx);
89 do_file_extract_progress(struct apply_ctx *ctx, enum wimlib_progress_msg msg);
92 maybe_do_file_progress(struct apply_ctx *ctx, enum wimlib_progress_msg msg)
94 if (unlikely(!--ctx->count_until_file_progress))
95 return do_file_extract_progress(ctx, msg);
99 /* Call this to reset the counter for report_file_created() and
100 * report_file_metadata_applied(). */
102 reset_file_progress(struct apply_ctx *ctx)
104 ctx->count_until_file_progress = 1;
107 /* Report that a file was created, prior to stream extraction. */
109 report_file_created(struct apply_ctx *ctx)
111 return maybe_do_file_progress(ctx, WIMLIB_PROGRESS_MSG_EXTRACT_FILE_STRUCTURE);
114 /* Report that file metadata was applied, after stream extraction. */
116 report_file_metadata_applied(struct apply_ctx *ctx)
118 return maybe_do_file_progress(ctx, WIMLIB_PROGRESS_MSG_EXTRACT_METADATA);
121 /* Returns any of the aliases of an inode that are being extracted. */
122 #define inode_first_extraction_dentry(inode) \
123 list_first_entry(&(inode)->i_extraction_aliases, \
124 struct wim_dentry, d_extraction_alias_node)
127 extract_stream_list(struct apply_ctx *ctx,
128 const struct read_stream_list_callbacks *cbs);
130 struct apply_operations {
132 int (*get_supported_features)(const tchar *target,
133 struct wim_features *supported_features);
135 int (*extract)(struct list_head *dentry_list, struct apply_ctx *ctx);
138 bool single_tree_only;
142 extern const struct apply_operations win32_apply_ops;
144 extern const struct apply_operations unix_apply_ops;
148 extern const struct apply_operations ntfs_3g_apply_ops;
151 #endif /* _WIMLIB_APPLY_H */