X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Fresource.h;h=2eab7bee0cd0a04c7f3c03834cbfa1f058dff628;hp=2c1cd9b4523068ddf504d9157ebfbb306de4627d;hb=ad8c3f70361e25b7c1bbc46d4429749c7215fa12;hpb=e176e9731e696562bab8de7b9bd34c019deef3e8 diff --git a/include/wimlib/resource.h b/include/wimlib/resource.h index 2c1cd9b4..2eab7bee 100644 --- a/include/wimlib/resource.h +++ b/include/wimlib/resource.h @@ -52,6 +52,13 @@ struct wim_resource_spec { /* Temporary flag. */ u32 raw_copy_ok : 1; + + /* Compression type of this resource. */ + u32 compression_type : 22; + + /* Compression chunk size of this resource. Irrelevant if the resource + * is uncompressed. */ + u32 chunk_size; }; /* On-disk version of a WIM resource header. */ @@ -170,10 +177,14 @@ struct alt_chunk_table_header_disk { * the chunks (4 bytes per entry). */ } _packed_attribute; -/* wimlib internal flags used when writing resources. */ -#define WIMLIB_WRITE_RESOURCE_FLAG_RECOMPRESS 0x00000001 -#define WIMLIB_WRITE_RESOURCE_FLAG_PIPABLE 0x00000002 -#define WIMLIB_WRITE_RESOURCE_FLAG_PACK_STREAMS 0x00000004 +static inline unsigned int +get_chunk_entry_size(u64 res_size, bool is_alt) +{ + if (res_size <= UINT32_MAX || is_alt) + return 4; + else + return 8; +} /* Functions to read streams */ @@ -192,6 +203,10 @@ extern int wim_reshdr_to_data(const struct wim_reshdr *reshdr, WIMStruct *wim, void **buf_ret); +extern int +wim_reshdr_to_hash(const struct wim_reshdr *reshdr, WIMStruct *wim, + u8 hash[SHA1_HASH_SIZE]); + extern int skip_wim_stream(struct wim_lookup_table_entry *lte); @@ -285,6 +300,10 @@ extern int extract_stream_to_fd(struct wim_lookup_table_entry *lte, struct filedes *fd, u64 size); +extern int +extract_full_stream_to_fd(struct wim_lookup_table_entry *lte, + struct filedes *fd); + extern int extract_chunk_to_fd(const void *chunk, size_t size, void *_fd_p);