resource.c: Cleanup and refactor
[wimlib] / include / wimlib / resource.h
index e030e33..a16572b 100644 (file)
@@ -73,13 +73,15 @@ resource_is_compressed(const struct resource_entry *entry)
        return (entry->flags & WIM_RESHDR_FLAG_COMPRESSED);
 }
 
        return (entry->flags & WIM_RESHDR_FLAG_COMPRESSED);
 }
 
-static inline void copy_resource_entry(struct resource_entry *dst,
-                                      const struct resource_entry *src)
+static inline void
+copy_resource_entry(struct resource_entry *dst,
+                   const struct resource_entry *src)
 {
        memcpy(dst, src, sizeof(struct resource_entry));
 }
 
 {
        memcpy(dst, src, sizeof(struct resource_entry));
 }
 
-static inline void zero_resource_entry(struct resource_entry *entry)
+static inline void
+zero_resource_entry(struct resource_entry *entry)
 {
        memset(entry, 0, sizeof(struct resource_entry));
 }
 {
        memset(entry, 0, sizeof(struct resource_entry));
 }
@@ -99,7 +101,6 @@ put_resource_entry(const struct resource_entry *entry,
 
 #define WIMLIB_READ_RESOURCE_FLAG_RAW_FULL             0x80000000
 #define WIMLIB_READ_RESOURCE_FLAG_RAW_CHUNKS           0x40000000
 
 #define WIMLIB_READ_RESOURCE_FLAG_RAW_FULL             0x80000000
 #define WIMLIB_READ_RESOURCE_FLAG_RAW_CHUNKS           0x40000000
-#define WIMLIB_READ_RESOURCE_FLAG_SEEK_ONLY            0x20000000
 #define WIMLIB_READ_RESOURCE_FLAG_RAW          (WIMLIB_READ_RESOURCE_FLAG_RAW_FULL |  \
                                                 WIMLIB_READ_RESOURCE_FLAG_RAW_CHUNKS)
 #define WIMLIB_READ_RESOURCE_MASK                      0xffff0000
 #define WIMLIB_READ_RESOURCE_FLAG_RAW          (WIMLIB_READ_RESOURCE_FLAG_RAW_FULL |  \
                                                 WIMLIB_READ_RESOURCE_FLAG_RAW_CHUNKS)
 #define WIMLIB_READ_RESOURCE_MASK                      0xffff0000
@@ -110,7 +111,8 @@ put_resource_entry(const struct resource_entry *entry,
 extern int
 read_partial_wim_resource(const struct wim_lookup_table_entry *lte,
                          u64 size, consume_data_callback_t cb,
 extern int
 read_partial_wim_resource(const struct wim_lookup_table_entry *lte,
                          u64 size, consume_data_callback_t cb,
-                         void *ctx_or_buf, int flags, u64 offset);
+                         u32 in_chunk_size, void *ctx_or_buf,
+                         int flags, u64 offset);
 
 extern int
 read_partial_wim_resource_into_buf(const struct wim_lookup_table_entry *lte,
 
 extern int
 read_partial_wim_resource_into_buf(const struct wim_lookup_table_entry *lte,
@@ -128,22 +130,27 @@ res_entry_to_data(const struct resource_entry *res_entry,
 
 extern int
 read_resource_prefix(const struct wim_lookup_table_entry *lte,
 
 extern int
 read_resource_prefix(const struct wim_lookup_table_entry *lte,
-                    u64 size, consume_data_callback_t cb, void *ctx_or_buf,
-                    int flags);
+                    u64 size, consume_data_callback_t cb,
+                    u32 in_chunk_size, void *ctx_or_buf, int flags);
 
 /* Functions to write a resource.  */
 
 extern int
 write_wim_resource(struct wim_lookup_table_entry *lte, struct filedes *out_fd,
 
 /* Functions to write a resource.  */
 
 extern int
 write_wim_resource(struct wim_lookup_table_entry *lte, struct filedes *out_fd,
-                  int out_ctype, struct resource_entry *out_res_entry,
-                  int write_resource_flags);
+                  int out_ctype,
+                  u32 out_chunk_size,
+                  struct resource_entry *out_res_entry,
+                  int write_resource_flags,
+                  struct wimlib_lzx_context **comp_ctx);
 
 extern int
 write_wim_resource_from_buffer(const void *buf, size_t buf_size,
                               int reshdr_flags, struct filedes *out_fd,
                               int out_ctype,
 
 extern int
 write_wim_resource_from_buffer(const void *buf, size_t buf_size,
                               int reshdr_flags, struct filedes *out_fd,
                               int out_ctype,
+                              u32 out_chunk_size,
                               struct resource_entry *out_res_entry,
                               struct resource_entry *out_res_entry,
-                              u8 *hash_ret, int write_resource_flags);
+                              u8 *hash_ret, int write_resource_flags,
+                              struct wimlib_lzx_context **comp_ctx);
 
 /* Functions to extract a resource.  */
 
 
 /* Functions to extract a resource.  */