]> wimlib.net Git - wimlib/blob - include/wimlib/capture.h
Update progress functions
[wimlib] / include / wimlib / capture.h
1 #ifndef _WIMLIB_CAPTURE_H
2 #define _WIMLIB_CAPTURE_H
3
4 #include "wimlib.h"
5 #include "wimlib/inode_table.h"
6 #include "wimlib/list.h"
7 #include "wimlib/security.h"
8 #include "wimlib/textfile.h"
9 #include "wimlib/util.h"
10
11 struct wim_lookup_table;
12 struct wim_dentry;
13 struct wim_inode;
14
15 struct capture_config {
16         struct string_set exclusion_pats;
17         struct string_set exclusion_exception_pats;
18         void *buf;
19 };
20
21 /* Common parameters to implementations of building an in-memory dentry tree
22  * from an on-disk directory structure. */
23 struct add_image_params {
24         /* Pointer to the lookup table of the WIM.  */
25         struct wim_lookup_table *lookup_table;
26
27         /* List of streams that have been added so far, but without their SHA1
28          * message digests being calculated (as a shortcut).  */
29         struct list_head *unhashed_streams;
30
31         /* Hash table of inodes that have been captured for this tree so far. */
32         struct wim_inode_table *inode_table;
33
34         /* The set of security descriptors that have been captured for this
35          * image so far. */
36         struct wim_sd_set *sd_set;
37
38         /* Pointer to the capture configuration.  */
39         struct capture_config *config;
40
41         /* Flags that affect the capture operation (WIMLIB_ADD_FLAG_*) */
42         int add_flags;
43
44         /* Extra argument; set to point to a pointer to the ntfs_volume for
45          * libntfs-3g capture.  */
46         void *extra_arg;
47
48         /* If non-NULL, the user-supplied progress function. */
49         wimlib_progress_func_t progfunc;
50         void *progctx;
51
52         /* Progress data.  */
53         union wimlib_progress_info progress;
54
55         /* Can be used by the capture implementation.  */
56         u64 capture_root_ino;
57         u64 capture_root_dev;
58         size_t capture_root_nchars;
59 };
60
61 /* capture_common.c */
62
63 extern int
64 do_capture_progress(struct add_image_params *params, int status,
65                     const struct wim_inode *inode);
66
67 extern int
68 mangle_pat(tchar *pat, const tchar *path, unsigned long line_no);
69
70 extern int
71 read_capture_config(const tchar *config_file, const void *buf,
72                     size_t bufsize, struct capture_config *config);
73
74 extern void
75 destroy_capture_config(struct capture_config *config);
76
77 extern bool
78 match_pattern_list(const tchar *path, size_t path_nchars,
79                    const struct string_set *list);
80
81 extern bool
82 should_exclude_path(const tchar *path, size_t path_nchars,
83                     const struct capture_config *config);
84
85 typedef int (*capture_tree_t)(struct wim_dentry **, const tchar *,
86                               struct add_image_params *);
87
88 #ifdef WITH_NTFS_3G
89 /* ntfs-3g_capture.c */
90 extern int
91 build_dentry_tree_ntfs(struct wim_dentry **root_p,
92                        const tchar *device,
93                        struct add_image_params *params);
94 #endif
95
96 #ifdef __WIN32__
97 /* win32_capture.c */
98 extern int
99 win32_build_dentry_tree(struct wim_dentry **root_ret,
100                         const tchar *root_disk_path,
101                         struct add_image_params *params);
102 #define platform_default_capture_tree win32_build_dentry_tree
103 #else
104 /* unix_capture.c */
105 extern int
106 unix_build_dentry_tree(struct wim_dentry **root_ret,
107                        const tchar *root_disk_path,
108                        struct add_image_params *params);
109 #define platform_default_capture_tree unix_build_dentry_tree
110 #endif
111
112 #define WIMLIB_ADD_FLAG_ROOT    0x80000000
113
114 #endif /* _WIMLIB_CAPTURE_H */