]> wimlib.net Git - wimlib/blob - include/wimlib/apply.h
Update progress functions
[wimlib] / include / wimlib / apply.h
1 #ifndef _WIMLIB_APPLY_H
2 #define _WIMLIB_APPLY_H
3
4 #include "wimlib/list.h"
5 #include "wimlib/progress.h"
6 #include "wimlib/types.h"
7 #include "wimlib.h"
8
9 /* These can be treated as counts (for required_features) or booleans (for
10  * supported_features).  */
11 struct wim_features {
12         unsigned long archive_files;
13         unsigned long hidden_files;
14         unsigned long system_files;
15         unsigned long compressed_files;
16         unsigned long encrypted_files;
17         unsigned long encrypted_directories;
18         unsigned long not_context_indexed_files;
19         unsigned long sparse_files;
20         unsigned long named_data_streams;
21         unsigned long hard_links;
22         unsigned long reparse_points;
23         unsigned long symlink_reparse_points;
24         unsigned long other_reparse_points;
25         unsigned long security_descriptors;
26         unsigned long short_names;
27         unsigned long unix_data;
28         unsigned long timestamps;
29         unsigned long case_sensitive_filenames;
30 };
31
32 struct wim_lookup_table_entry;
33 struct read_stream_list_callbacks;
34
35 struct apply_ctx {
36         /* The WIMStruct from which files are being extracted from the currently
37          * selected image.  */
38         WIMStruct *wim;
39
40         /* The target of the extraction, usually the path to a directory.  */
41         const tchar *target;
42
43         /* Length of @target in tchars.  */
44         size_t target_nchars;
45
46         /* Extraction flags (WIMLIB_EXTRACT_FLAG_*)  */
47         int extract_flags;
48
49         /* User-provided progress function, or NULL if not specified.  */
50         wimlib_progress_func_t progfunc;
51         void *progctx;
52
53         /* Progress data buffer, with progress.extract initialized.  */
54         union wimlib_progress_info progress;
55
56         /* Features required to extract the files (with counts)  */
57         struct wim_features required_features;
58
59         /* Features supported by the extraction mode (with booleans)  */
60         struct wim_features supported_features;
61
62         /* The members below should not be used outside of extract.c  */
63         u64 next_progress;
64         unsigned long invalid_sequence;
65         unsigned long num_streams_remaining;
66         struct list_head stream_list;
67         const struct read_stream_list_callbacks *saved_cbs;
68         struct wim_lookup_table_entry *cur_stream;
69 };
70
71 static inline int
72 extract_progress(struct apply_ctx *ctx, enum wimlib_progress_msg msg)
73 {
74         return call_progress(ctx->progfunc, msg, &ctx->progress, ctx->progctx);
75 }
76
77 /* Returns any of the aliases of an inode that are being extracted.  */
78 #define inode_first_extraction_dentry(inode)            \
79         list_first_entry(&(inode)->i_extraction_aliases,        \
80                          struct wim_dentry, d_extraction_alias_node)
81
82 extern int
83 extract_stream_list(struct apply_ctx *ctx,
84                     const struct read_stream_list_callbacks *cbs);
85
86 struct apply_operations {
87         const char *name;
88         int (*get_supported_features)(const tchar *target,
89                                       struct wim_features *supported_features);
90
91         int (*extract)(struct list_head *dentry_list, struct apply_ctx *ctx);
92
93         size_t context_size;
94         bool single_tree_only;
95 };
96
97 #ifdef __WIN32__
98   extern const struct apply_operations win32_apply_ops;
99 #else
100   extern const struct apply_operations unix_apply_ops;
101 #endif
102
103 #ifdef WITH_NTFS_3G
104   extern const struct apply_operations ntfs_3g_apply_ops;
105 #endif
106
107 #endif /* _WIMLIB_APPLY_H */