]> wimlib.net Git - wimlib/blob - include/wimlib/capture.h
4d3a60aba8dfe92ae7c1f7017407eba3cbafb1f0
[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/util.h"
9
10 struct wim_lookup_table;
11 struct wim_dentry;
12 struct wim_inode;
13
14 /* Common parameters to implementations of building an in-memory dentry tree
15  * from an on-disk directory structure. */
16 struct add_image_params {
17         /* Pointer to the lookup table of the WIM.  */
18         struct wim_lookup_table *lookup_table;
19
20         /* List of streams that have been added so far, but without their SHA1
21          * message digests being calculated (as a shortcut).  */
22         struct list_head *unhashed_streams;
23
24         /* Hash table of inodes that have been captured for this tree so far. */
25         struct wim_inode_table inode_table;
26
27         /* The set of security descriptors that have been captured for this
28          * image so far. */
29         struct wim_sd_set sd_set;
30
31         /* Pointer to the capture configuration, which indicates whether any
32          * files should be excluded from capture or not. */
33         struct wimlib_capture_config *config;
34
35         /* Flags that affect the capture operation (WIMLIB_ADD_FLAG_*) */
36         int add_flags;
37
38         /* Extra argument; set to point to a pointer to the ntfs_volume for
39          * libntfs-3g capture.  */
40         void *extra_arg;
41
42         u64 capture_root_ino;
43         u64 capture_root_dev;
44
45         /* If non-NULL, the user-supplied progress function. */
46         wimlib_progress_func_t progress_func;
47
48         /* Progress data.  */
49         union wimlib_progress_info progress;
50 };
51
52
53 /* capture_common.c */
54
55 extern void
56 do_capture_progress(struct add_image_params *params, int status,
57                     const struct wim_inode *inode);
58
59 extern bool
60 exclude_path(const tchar *path, size_t path_len,
61              const struct wimlib_capture_config *config,
62              bool exclude_prefix);
63
64 extern struct wimlib_capture_config *
65 copy_capture_config(const struct wimlib_capture_config *config);
66
67 extern int
68 copy_and_canonicalize_capture_config(const struct wimlib_capture_config *config,
69                                      struct wimlib_capture_config **config_copy_ret);
70
71 extern void
72 free_capture_config(struct wimlib_capture_config *config);
73
74 /* hardlink.c */
75
76 extern int
77 init_inode_table(struct wim_inode_table *table, size_t capacity);
78
79 extern int
80 inode_table_new_dentry(struct wim_inode_table *table, const tchar *name,
81                        u64 ino, u64 devno, bool noshare,
82                        struct wim_dentry **dentry_ret);
83
84 extern void
85 inode_table_prepare_inode_list(struct wim_inode_table *table,
86                                struct list_head *head);
87
88
89 #ifdef WITH_NTFS_3G
90 /* ntfs-3g_capture.c */
91 extern int
92 build_dentry_tree_ntfs(struct wim_dentry **root_p,
93                        const tchar *device,
94                        struct add_image_params *params);
95 #endif
96
97 #ifdef __WIN32__
98 /* win32_capture.c */
99 extern int
100 win32_build_dentry_tree(struct wim_dentry **root_ret,
101                         const tchar *root_disk_path,
102                         struct add_image_params *params);
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 #endif
110
111 #define WIMLIB_ADD_FLAG_ROOT    0x80000000
112
113 #endif /* _WIMLIB_CAPTURE_H */