53e7d571654844d8abb909a5264c01f1fd230b29
[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
32 #if defined(HAVE_SYS_FILE_H) && defined(HAVE_FLOCK)
33 extern int
34 lock_wim_for_append(WIMStruct *wim);
35 extern void
36 unlock_wim_for_append(WIMStruct *wim);
37 #else
38 static inline int
39 lock_wim_for_append(WIMStruct *wim)
40 {
41         return 0;
42 }
43 static inline void
44 unlock_wim_for_append(WIMStruct *wim)
45 {
46 }
47 #endif
48
49 struct filedes;
50 struct list_head;
51 struct wim_reshdr;
52
53 int
54 write_wim_part(WIMStruct *wim,
55                const void *path_or_fd,
56                int image,
57                int write_flags,
58                unsigned num_threads,
59                unsigned part_number,
60                unsigned total_parts,
61                struct list_head *blob_list_override,
62                const u8 *guid);
63
64 int
65 write_wim_resource_from_buffer(const void *buf,
66                                size_t buf_size,
67                                bool is_metadata,
68                                struct filedes *out_fd,
69                                int out_ctype,
70                                u32 out_chunk_size,
71                                struct wim_reshdr *out_reshdr,
72                                u8 *hash_ret,
73                                int write_resource_flags);
74
75 #endif /* _WIMLIB_WRITE_H */