#include <pthread.h>
#endif
+#define WIMLIB_MAKEVERSION(major, minor, patch) \
+ ((major << 20) | (minor << 10) | patch)
+
+
+#define WIMLIB_VERSION_CODE \
+ WIMLIB_MAKEVERSION(WIMLIB_MAJOR_VERSION,\
+ WIMLIB_MINOR_VERSION,\
+ WIMLIB_PATCH_VERSION)
+
+#define WIMLIB_GET_PATCH_VERSION(version) \
+ ((version >> 0) & ((1 << 10) - 1))
+#define WIMLIB_GET_MINOR_VERSION(version) \
+ ((version >> 10) & ((1 << 10) - 1))
+#define WIMLIB_GET_MAJOR_VERSION(version) \
+ ((version >> 20) & ((1 << 10) - 1))
+
+
struct stat;
struct dentry;
struct inode;
u8 deletion_occurred : 1;
u8 all_images_verified : 1;
u8 full_verification_in_progress : 1;
+ u8 wim_locked : 1;
};
/* Inline utility functions for WIMStructs. */
unsigned num_additional_swms,
struct lookup_table **table_ret);
+/* metadata_resource.c */
+
+extern int read_metadata_resource(WIMStruct *w,
+ struct image_metadata *image_metadata);
+extern int write_metadata_resource(WIMStruct *w);
+
/* ntfs-apply.c */
struct apply_args {
struct resource_entry *out_res_entry,
int flags);
-extern int extract_wim_resource_to_fd(const struct lookup_table_entry *lte,
- int fd, u64 size);
+typedef int (*extract_chunk_func_t)(const u8 *, size_t, u64, void *);
-extern int extract_full_wim_resource_to_fd(const struct lookup_table_entry *lte,
- int fd);
+extern int extract_wim_chunk_to_fd(const u8 *buf, size_t len,
+ u64 offset, void *arg);
-extern int read_metadata_resource(WIMStruct *w,
- struct image_metadata *image_metadata);
+extern int extract_wim_resource(const struct lookup_table_entry *lte,
+ u64 size, extract_chunk_func_t extract_chunk,
+ void *extract_chunk_arg);
+/*
+ * Extracts the first @size bytes of the WIM resource specified by @lte to the
+ * open file descriptor @fd.
+ *
+ * Returns 0 on success; nonzero on failure.
+ */
+static inline int
+extract_wim_resource_to_fd(const struct lookup_table_entry *lte,
+ int fd, u64 size)
+{
+ return extract_wim_resource(lte, size,
+ extract_wim_chunk_to_fd, &fd);
+}
extern int write_dentry_resources(struct dentry *dentry, void *wim_p);
extern int copy_resource(struct lookup_table_entry *lte, void *w);
-extern int write_metadata_resource(WIMStruct *w);
/* security.c */
wimlib_progress_func_t progress_func);
#if defined(HAVE_SYS_FILE_H) && defined(HAVE_FLOCK)
-extern int lock_wim(FILE *fp, const char *path);
+extern int lock_wim(WIMStruct *w, FILE *fp);
#else
-static inline int lock_wim(FILE *fp, const char *path)
+static inline int lock_wim(WIMStruct *w, FILE *fp)
{
return 0;
}