+static inline u64
+wim_resource_size(const struct wim_lookup_table_entry *lte)
+{
+ return lte->resource_entry.original_size;
+}
+
+static inline u64
+wim_resource_chunks(const struct wim_lookup_table_entry *lte)
+{
+ return (wim_resource_size(lte) + WIM_CHUNK_SIZE - 1) / WIM_CHUNK_SIZE;
+}
+
+static inline u64
+wim_resource_compressed_size(const struct wim_lookup_table_entry *lte)
+{
+ return lte->resource_entry.size;
+}
+
+/*
+ * XXX Probably should store the compression type directly in the lookup table
+ * entry
+ */
+static inline 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);
+}
+
+static inline bool
+lte_filename_valid(const struct wim_lookup_table_entry *lte)
+{
+ return 0
+ #ifdef __WIN32__
+ || lte->resource_location == RESOURCE_WIN32
+ || lte->resource_location == RESOURCE_WIN32_ENCRYPTED
+ #else
+ || lte->resource_location == RESOURCE_IN_FILE_ON_DISK
+ #endif
+ #ifdef WITH_FUSE
+ || lte->resource_location == RESOURCE_IN_STAGING_FILE
+ #endif
+ ;
+}
+
+extern struct wim_lookup_table *
+new_lookup_table(size_t capacity);
+
+extern int
+read_lookup_table(WIMStruct *w);
+
+extern int
+write_lookup_table(WIMStruct *w, int image, struct resource_entry *out_res_entry);
+
+extern int
+write_lookup_table_from_stream_list(struct list_head *stream_list,
+ int out_fd,
+ struct resource_entry *out_res_entry);
+
+extern void
+free_lookup_table(struct wim_lookup_table *table);
+
+extern void
+lookup_table_insert(struct wim_lookup_table *table, struct wim_lookup_table_entry *lte);
+
+/* Unlinks a lookup table entry from the table; does not free it. */
+static inline void
+lookup_table_unlink(struct wim_lookup_table *table, struct wim_lookup_table_entry *lte)
+{
+ wimlib_assert(!lte->unhashed);
+ hlist_del(<e->hash_list);
+ wimlib_assert(table->num_entries != 0);
+ table->num_entries--;
+}
+
+extern struct wim_lookup_table_entry *
+new_lookup_table_entry();