Add support for unsafe in-place compaction of WIM files
[wimlib] / include / wimlib / write.h
1 #ifndef _WIMLIB_WRITE_H
2 #define _WIMLIB_WRITE_H
3
4 #include "wimlib.h"
5 #include "wimlib/types.h"
6
7 /* Internal use only */
8 #define WIMLIB_WRITE_FLAG_FILE_DESCRIPTOR               0x80000000
9 #define WIMLIB_WRITE_FLAG_APPEND                        0x40000000
10 #define WIMLIB_WRITE_FLAG_NO_NEW_BLOBS                  0x20000000
11 #define WIMLIB_WRITE_FLAG_USE_EXISTING_TOTALBYTES       0x10000000
12 #define WIMLIB_WRITE_FLAG_NO_METADATA                   0x08000000
13
14 /* Keep in sync with wimlib.h  */
15 #define WIMLIB_WRITE_MASK_PUBLIC (                        \
16         WIMLIB_WRITE_FLAG_CHECK_INTEGRITY               | \
17         WIMLIB_WRITE_FLAG_NO_CHECK_INTEGRITY            | \
18         WIMLIB_WRITE_FLAG_PIPABLE                       | \
19         WIMLIB_WRITE_FLAG_NOT_PIPABLE                   | \
20         WIMLIB_WRITE_FLAG_RECOMPRESS                    | \
21         WIMLIB_WRITE_FLAG_FSYNC                         | \
22         WIMLIB_WRITE_FLAG_REBUILD                       | \
23         WIMLIB_WRITE_FLAG_SOFT_DELETE                   | \
24         WIMLIB_WRITE_FLAG_IGNORE_READONLY_FLAG          | \
25         WIMLIB_WRITE_FLAG_SKIP_EXTERNAL_WIMS            | \
26         WIMLIB_WRITE_FLAG_STREAMS_OK                    | \
27         WIMLIB_WRITE_FLAG_RETAIN_GUID                   | \
28         WIMLIB_WRITE_FLAG_SOLID                         | \
29         WIMLIB_WRITE_FLAG_SEND_DONE_WITH_FILE_MESSAGES  | \
30         WIMLIB_WRITE_FLAG_NO_SOLID_SORT                 | \
31         WIMLIB_WRITE_FLAG_UNSAFE_COMPACT)
32
33 #if defined(HAVE_SYS_FILE_H) && defined(HAVE_FLOCK)
34 extern int
35 lock_wim_for_append(WIMStruct *wim);
36 extern void
37 unlock_wim_for_append(WIMStruct *wim);
38 #else
39 static inline int
40 lock_wim_for_append(WIMStruct *wim)
41 {
42         return 0;
43 }
44 static inline void
45 unlock_wim_for_append(WIMStruct *wim)
46 {
47 }
48 #endif
49
50 struct filedes;
51 struct list_head;
52 struct wim_reshdr;
53
54 int
55 write_wim_part(WIMStruct *wim,
56                const void *path_or_fd,
57                int image,
58                int write_flags,
59                unsigned num_threads,
60                unsigned part_number,
61                unsigned total_parts,
62                struct list_head *blob_list_override,
63                const u8 *guid);
64
65 int
66 write_wim_resource_from_buffer(const void *buf,
67                                size_t buf_size,
68                                bool is_metadata,
69                                struct filedes *out_fd,
70                                int out_ctype,
71                                u32 out_chunk_size,
72                                struct wim_reshdr *out_reshdr,
73                                u8 *hash_ret,
74                                int write_resource_flags);
75
76 #endif /* _WIMLIB_WRITE_H */