]> wimlib.net Git - wimlib/blobdiff - src/lookup_table.c
dentry.c: Read/write dentries from structure
[wimlib] / src / lookup_table.c
index e2ce02e7bc4ea29b3bc4908df3a20e1eeca8fec7..3361d8c20cf90aa739e0d72786010dbdc56bc380 100644 (file)
  * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
-#include "wimlib_internal.h"
-#include "lookup_table.h"
-#include "buffer_io.h"
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "wimlib/buffer_io.h"
+#include "wimlib/error.h"
+#include "wimlib/file_io.h"
+#include "wimlib/lookup_table.h"
+#include "wimlib/metadata.h"
+#include "wimlib/paths.h"
+#include "wimlib/resource.h"
+#include "wimlib/util.h"
+
 #include <errno.h>
 #include <stdlib.h>
-
 #ifdef WITH_FUSE
-#include <unistd.h>
+#  include <unistd.h> /* for unlink() */
 #endif
 
 struct wim_lookup_table *
@@ -58,7 +67,7 @@ new_lookup_table(size_t capacity)
 }
 
 struct wim_lookup_table_entry *
-new_lookup_table_entry()
+new_lookup_table_entry(void)
 {
        struct wim_lookup_table_entry *lte;
 
@@ -342,6 +351,10 @@ for_lookup_table_entry_pos_sorted(struct wim_lookup_table *table,
        return ret;
 }
 
+
+/* Size of each lookup table entry in the WIM file. */
+#define WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE 50
+
 /*
  * Reads the lookup table from a WIM file.
  *
@@ -525,7 +538,7 @@ out:
 
 
 static u8 *
-write_lookup_table_entry(struct wim_lookup_table_entry *lte, u8 *buf_p)
+write_lookup_table_entry(const struct wim_lookup_table_entry *lte, u8 *buf_p)
 {
        buf_p = put_resource_entry(buf_p, &lte->output_resource_entry);
        buf_p = put_u16(buf_p, lte->part_number);
@@ -824,6 +837,19 @@ out:
 }
 #endif
 
+/*
+ * XXX Probably should store the compression type directly in the lookup table
+ * entry
+ */
+int
+wim_resource_compression_type(const struct wim_lookup_table_entry *lte)
+{
+       if (!(lte->resource_entry.flags & WIM_RESHDR_FLAG_COMPRESSED)
+           || lte->resource_location != RESOURCE_IN_WIM)
+               return WIMLIB_COMPRESSION_TYPE_NONE;
+       return wimlib_get_compression_type(lte->wim);
+}
+
 /* Resolve an inode's lookup table entries
  *
  * This replaces the SHA1 hash fields (which are used to lookup an entry in the