4 * Lookup table, implemented as a hash table, that maps SHA1 message digests to
9 * Copyright (C) 2012, 2013 Eric Biggers
11 * This file is part of wimlib, a library for working with WIM files.
13 * wimlib is free software; you can redistribute it and/or modify it under the
14 * terms of the GNU General Public License as published by the Free
15 * Software Foundation; either version 3 of the License, or (at your option)
18 * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
19 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 * A PARTICULAR PURPOSE. See the GNU General Public License for more
23 * You should have received a copy of the GNU General Public License
24 * along with wimlib; if not, see http://www.gnu.org/licenses/.
27 #include "wimlib_internal.h"
28 #include "lookup_table.h"
29 #include "buffer_io.h"
37 struct wim_lookup_table *
38 new_lookup_table(size_t capacity)
40 struct wim_lookup_table *table;
41 struct hlist_head *array;
43 table = MALLOC(sizeof(struct wim_lookup_table));
45 array = CALLOC(capacity, sizeof(array[0]));
47 table->num_entries = 0;
48 table->capacity = capacity;
53 ERROR("Failed to allocate memory for lookup table with capacity %zu",
60 struct wim_lookup_table_entry *
61 new_lookup_table_entry()
63 struct wim_lookup_table_entry *lte;
65 lte = CALLOC(1, sizeof(struct wim_lookup_table_entry));
70 ERROR("Out of memory (tried to allocate %zu bytes for "
71 "lookup table entry)",
72 sizeof(struct wim_lookup_table_entry));
77 struct wim_lookup_table_entry *
78 clone_lookup_table_entry(const struct wim_lookup_table_entry *old)
80 struct wim_lookup_table_entry *new;
82 new = MALLOC(sizeof(*new));
86 memcpy(new, old, sizeof(*old));
87 new->extracted_file = NULL;
88 switch (new->resource_location) {
92 case RESOURCE_IN_STAGING_FILE:
93 case RESOURCE_IN_FILE_ON_DISK:
94 BUILD_BUG_ON((void*)&old->file_on_disk !=
95 (void*)&old->staging_file_name);
96 new->staging_file_name = TSTRDUP(old->staging_file_name);
97 if (!new->staging_file_name)
100 case RESOURCE_IN_ATTACHED_BUFFER:
101 new->attached_buffer = MALLOC(wim_resource_size(old));
102 if (!new->attached_buffer)
104 memcpy(new->attached_buffer, old->attached_buffer,
105 wim_resource_size(old));
108 case RESOURCE_IN_NTFS_VOLUME:
110 struct ntfs_location *loc;
111 loc = MALLOC(sizeof(*loc));
114 memcpy(loc, old->ntfs_loc, sizeof(*loc));
116 loc->stream_name = NULL;
118 loc->path = STRDUP(old->ntfs_loc->path);
121 loc->stream_name = MALLOC((loc->stream_name_nchars + 1) * 2);
122 if (!loc->stream_name)
124 memcpy(loc->stream_name,
125 old->ntfs_loc->stream_name,
126 (loc->stream_name_nchars + 1) * 2);
135 free_lookup_table_entry(new);
140 free_lookup_table_entry(struct wim_lookup_table_entry *lte)
143 switch (lte->resource_location) {
144 case RESOURCE_IN_STAGING_FILE:
145 case RESOURCE_IN_ATTACHED_BUFFER:
146 case RESOURCE_IN_FILE_ON_DISK:
150 BUILD_BUG_ON((void*)<e->file_on_disk !=
151 (void*)<e->staging_file_name);
152 BUILD_BUG_ON((void*)<e->file_on_disk !=
153 (void*)<e->attached_buffer);
154 FREE(lte->file_on_disk);
157 case RESOURCE_IN_NTFS_VOLUME:
159 FREE(lte->ntfs_loc->path);
160 FREE(lte->ntfs_loc->stream_name);
173 do_free_lookup_table_entry(struct wim_lookup_table_entry *entry, void *ignore)
175 free_lookup_table_entry(entry);
181 free_lookup_table(struct wim_lookup_table *table)
183 DEBUG2("Freeing lookup table");
186 for_lookup_table_entry(table,
187 do_free_lookup_table_entry,
196 * Inserts an entry into the lookup table.
198 * @table: A pointer to the lookup table.
199 * @lte: A pointer to the entry to insert.
202 lookup_table_insert(struct wim_lookup_table *table,
203 struct wim_lookup_table_entry *lte)
205 size_t i = lte->hash_short % table->capacity;
206 hlist_add_head(<e->hash_list, &table->array[i]);
208 /* XXX Make the table grow when too many entries have been inserted. */
209 table->num_entries++;
213 finalize_lte(struct wim_lookup_table_entry *lte)
216 if (lte->resource_location == RESOURCE_IN_STAGING_FILE) {
217 unlink(lte->staging_file_name);
218 list_del(<e->staging_list);
221 free_lookup_table_entry(lte);
224 /* Decrements the reference count for the lookup table entry @lte. If its
225 * reference count reaches 0, it is unlinked from the lookup table. If,
226 * furthermore, the entry has no opened file descriptors associated with it, the
229 lte_decrement_refcnt(struct wim_lookup_table_entry *lte,
230 struct wim_lookup_table *table)
232 wimlib_assert(lte != NULL);
233 wimlib_assert(lte->refcnt != 0);
234 if (--lte->refcnt == 0) {
235 lookup_table_unlink(table, lte);
237 if (lte->num_opened_fds == 0)
245 lte_decrement_num_opened_fds(struct wim_lookup_table_entry *lte)
247 if (lte->num_opened_fds != 0)
248 if (--lte->num_opened_fds == 0 && lte->refcnt == 0)
253 /* Calls a function on all the entries in the WIM lookup table. Stop early and
254 * return nonzero if any call to the function returns nonzero. */
256 for_lookup_table_entry(struct wim_lookup_table *table,
257 int (*visitor)(struct wim_lookup_table_entry *, void *),
260 struct wim_lookup_table_entry *lte;
261 struct hlist_node *pos, *tmp;
264 for (size_t i = 0; i < table->capacity; i++) {
265 hlist_for_each_entry_safe(lte, pos, tmp, &table->array[i],
268 wimlib_assert2(!(lte->resource_entry.flags & WIM_RESHDR_FLAG_METADATA));
269 ret = visitor(lte, arg);
278 cmp_streams_by_wim_position(const void *p1, const void *p2)
280 const struct wim_lookup_table_entry *lte1, *lte2;
281 lte1 = *(const struct wim_lookup_table_entry**)p1;
282 lte2 = *(const struct wim_lookup_table_entry**)p2;
283 if (lte1->resource_entry.offset < lte2->resource_entry.offset)
285 else if (lte1->resource_entry.offset > lte2->resource_entry.offset)
292 sort_stream_list_by_wim_position(struct list_head *stream_list)
294 struct list_head *cur;
296 struct wim_lookup_table_entry **array;
301 list_for_each(cur, stream_list)
303 array_size = num_streams * sizeof(array[0]);
304 array = MALLOC(array_size);
306 ERROR("Failed to allocate %zu bytes to sort stream entries",
308 return WIMLIB_ERR_NOMEM;
310 cur = stream_list->next;
311 for (i = 0; i < num_streams; i++) {
312 array[i] = container_of(cur, struct wim_lookup_table_entry, staging_list);
316 qsort(array, num_streams, sizeof(array[0]), cmp_streams_by_wim_position);
318 INIT_LIST_HEAD(stream_list);
319 for (i = 0; i < num_streams; i++)
320 list_add_tail(&array[i]->staging_list, stream_list);
327 add_lte_to_array(struct wim_lookup_table_entry *lte,
330 struct wim_lookup_table_entry ***pp = _pp;
335 /* Iterate through the lookup table entries, but first sort them by stream
336 * offset in the WIM. Caution: this is intended to be used when the stream
337 * offset field has actually been set. */
339 for_lookup_table_entry_pos_sorted(struct wim_lookup_table *table,
340 int (*visitor)(struct wim_lookup_table_entry *,
344 struct wim_lookup_table_entry **lte_array, **p;
345 size_t num_streams = table->num_entries;
348 lte_array = MALLOC(num_streams * sizeof(lte_array[0]));
350 return WIMLIB_ERR_NOMEM;
352 for_lookup_table_entry(table, add_lte_to_array, &p);
354 wimlib_assert(p == lte_array + num_streams);
356 qsort(lte_array, num_streams, sizeof(lte_array[0]),
357 cmp_streams_by_wim_position);
359 for (size_t i = 0; i < num_streams && ret == 0; i++)
360 ret = visitor(lte_array[i], arg);
366 * Reads the lookup table from a WIM file.
368 * Saves lookup table entries for non-metadata streams in a hash table, and
369 * saves the metadata entry for each image in a special per-image location (the
370 * image_metadata array).
373 read_lookup_table(WIMStruct *w)
376 u8 buf[WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE];
378 struct wim_lookup_table *table;
379 struct wim_lookup_table_entry *cur_entry, *duplicate_entry;
381 if (resource_is_compressed(&w->hdr.lookup_table_res_entry)) {
382 ERROR("Didn't expect a compressed lookup table!");
383 ERROR("Ask the author to implement support for this.");
384 return WIMLIB_ERR_COMPRESSED_LOOKUP_TABLE;
387 DEBUG("Reading lookup table: offset %"PRIu64", size %"PRIu64"",
388 w->hdr.lookup_table_res_entry.offset,
389 w->hdr.lookup_table_res_entry.original_size);
391 if (fseeko(w->fp, w->hdr.lookup_table_res_entry.offset, SEEK_SET) != 0)
393 ERROR_WITH_ERRNO("Failed to seek to byte %"PRIu64" to read "
395 w->hdr.lookup_table_res_entry.offset);
396 return WIMLIB_ERR_READ;
399 num_entries = w->hdr.lookup_table_res_entry.original_size /
400 WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE;
401 table = new_lookup_table(num_entries * 2 + 1);
403 return WIMLIB_ERR_NOMEM;
405 w->current_image = 0;
406 while (num_entries--) {
409 if (fread(buf, 1, sizeof(buf), w->fp) != sizeof(buf)) {
411 ERROR("Unexpected EOF in WIM lookup table!");
413 ERROR_WITH_ERRNO("Error reading WIM lookup "
416 ret = WIMLIB_ERR_READ;
417 goto out_free_lookup_table;
419 cur_entry = new_lookup_table_entry();
421 ret = WIMLIB_ERR_NOMEM;
422 goto out_free_lookup_table;
426 cur_entry->resource_location = RESOURCE_IN_WIM;
427 p = get_resource_entry(buf, &cur_entry->resource_entry);
428 p = get_u16(p, &cur_entry->part_number);
429 p = get_u32(p, &cur_entry->refcnt);
430 p = get_bytes(p, SHA1_HASH_SIZE, cur_entry->hash);
432 if (cur_entry->part_number != w->hdr.part_number) {
433 ERROR("A lookup table entry in part %hu of the WIM "
434 "points to part %hu",
435 w->hdr.part_number, cur_entry->part_number);
436 ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
437 goto out_free_cur_entry;
440 if (is_zero_hash(cur_entry->hash)) {
441 ERROR("The WIM lookup table contains an entry with a "
442 "SHA1 message digest of all 0's");
443 ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
444 goto out_free_cur_entry;
447 if (!(cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_COMPRESSED)
448 && (cur_entry->resource_entry.size !=
449 cur_entry->resource_entry.original_size))
451 #ifdef ENABLE_ERROR_MESSAGES
452 ERROR("Found uncompressed resource with original size "
453 "not the same as compressed size");
454 ERROR("The lookup table entry for the resource is as follows:");
455 print_lookup_table_entry(cur_entry, stderr);
457 ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
458 goto out_free_cur_entry;
461 if (cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA) {
462 /* Lookup table entry for a metadata resource */
463 if (cur_entry->refcnt != 1) {
464 #ifdef ENABLE_ERROR_MESSAGES
465 ERROR("Found metadata resource with refcnt != 1:");
466 print_lookup_table_entry(cur_entry, stderr);
468 ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
469 goto out_free_cur_entry;
472 if (w->hdr.part_number != 1) {
473 ERROR("Found a metadata resource in a "
474 "non-first part of the split WIM!");
475 ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
476 goto out_free_cur_entry;
478 if (w->current_image == w->hdr.image_count) {
479 ERROR("The WIM header says there are %u images "
480 "in the WIM, but we found more metadata "
481 "resources than this", w->hdr.image_count);
482 ret = WIMLIB_ERR_IMAGE_COUNT;
483 goto out_free_cur_entry;
486 /* Notice very carefully: We are assigning the metadata
487 * resources in the exact order mirrored by their lookup
488 * table entries on disk, which is the behavior of
489 * Microsoft's software. In particular, this overrides
490 * the actual locations of the metadata resources
491 * themselves in the WIM file as well as any information
492 * written in the XML data. */
493 DEBUG("Found metadata resource for image %u at "
495 w->current_image + 1,
496 cur_entry->resource_entry.offset);
498 w->current_image++].metadata_lte = cur_entry;
500 /* Lookup table entry for a stream that is not a
501 * metadata resource */
502 duplicate_entry = __lookup_resource(table, cur_entry->hash);
503 if (duplicate_entry) {
504 #ifdef ENABLE_ERROR_MESSAGES
505 ERROR("The WIM lookup table contains two entries with the "
506 "same SHA1 message digest!");
507 ERROR("The first entry is:");
508 print_lookup_table_entry(duplicate_entry, stderr);
509 ERROR("The second entry is:");
510 print_lookup_table_entry(cur_entry, stderr);
512 ret = WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY;
513 goto out_free_cur_entry;
515 lookup_table_insert(table, cur_entry);
519 if (w->hdr.part_number == 1 &&
520 w->current_image != w->hdr.image_count)
522 ERROR("The WIM header says there are %u images "
523 "in the WIM, but we only found %d metadata "
524 "resources!", w->hdr.image_count, w->current_image);
525 ret = WIMLIB_ERR_IMAGE_COUNT;
526 goto out_free_lookup_table;
528 DEBUG("Done reading lookup table.");
529 w->lookup_table = table;
534 out_free_lookup_table:
535 free_lookup_table(table);
537 w->current_image = 0;
543 * Writes a lookup table entry to the output file.
546 write_lookup_table_entry(struct wim_lookup_table_entry *lte, void *_out)
549 u8 buf[WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE];
554 /* Don't write entries that have not had file resources or metadata
555 * resources written for them. */
556 if (lte->out_refcnt == 0)
559 if (lte->output_resource_entry.flags & WIM_RESHDR_FLAG_METADATA) {
560 DEBUG("Writing metadata entry at %"PRIu64" "
561 "(orig size = %"PRIu64")",
562 ftello(out), lte->output_resource_entry.original_size);
565 p = put_resource_entry(buf, <e->output_resource_entry);
566 p = put_u16(p, lte->part_number);
567 p = put_u32(p, lte->out_refcnt);
568 p = put_bytes(p, SHA1_HASH_SIZE, lte->hash);
569 if (fwrite(buf, 1, sizeof(buf), out) != sizeof(buf)) {
570 ERROR_WITH_ERRNO("Failed to write lookup table entry");
571 return WIMLIB_ERR_WRITE;
576 /* Writes the WIM lookup table to the output file. */
578 write_lookup_table(WIMStruct *w, int image, struct resource_entry *out_res_entry)
580 FILE *out = w->out_fp;
581 off_t start_offset, end_offset;
583 int start_image, end_image;
585 start_offset = ftello(out);
586 if (start_offset == -1)
587 return WIMLIB_ERR_WRITE;
589 /* Write lookup table entries for metadata resources */
590 if (image == WIMLIB_ALL_IMAGES) {
592 end_image = w->hdr.image_count;
597 for (int i = start_image; i <= end_image; i++) {
598 struct wim_lookup_table_entry *metadata_lte;
600 metadata_lte = w->image_metadata[i - 1].metadata_lte;
601 metadata_lte->out_refcnt = 1;
602 metadata_lte->output_resource_entry.flags |= WIM_RESHDR_FLAG_METADATA;
603 ret = write_lookup_table_entry(metadata_lte, out);
608 /* Write lookup table entries for other resources */
609 ret = for_lookup_table_entry(w->lookup_table, write_lookup_table_entry, out);
613 /* Fill in the resource entry for the lookup table itself */
614 end_offset = ftello(out);
615 if (end_offset == -1)
616 return WIMLIB_ERR_WRITE;
618 out_res_entry->offset = start_offset;
619 out_res_entry->size = end_offset - start_offset;
620 out_res_entry->original_size = end_offset - start_offset;
621 out_res_entry->flags = WIM_RESHDR_FLAG_METADATA;
627 lte_zero_real_refcnt(struct wim_lookup_table_entry *lte, void *ignore)
629 lte->real_refcnt = 0;
634 lte_zero_out_refcnt(struct wim_lookup_table_entry *lte, void *ignore)
641 lte_free_extracted_file(struct wim_lookup_table_entry *lte, void *ignore)
643 if (lte->extracted_file != NULL) {
644 FREE(lte->extracted_file);
645 lte->extracted_file = NULL;
651 print_lookup_table_entry(const struct wim_lookup_table_entry *lte, FILE *out)
657 tfprintf(out, T("Offset = %"PRIu64" bytes\n"),
658 lte->resource_entry.offset);
660 tfprintf(out, T("Size = %"PRIu64" bytes\n"),
661 (u64)lte->resource_entry.size);
663 tfprintf(out, T("Original size = %"PRIu64" bytes\n"),
664 lte->resource_entry.original_size);
666 tfprintf(out, T("Part Number = %hu\n"), lte->part_number);
667 tfprintf(out, T("Reference Count = %u\n"), lte->refcnt);
669 tfprintf(out, T("Hash = 0x"));
670 print_hash(lte->hash, out);
673 tfprintf(out, T("Flags = "));
674 u8 flags = lte->resource_entry.flags;
675 if (flags & WIM_RESHDR_FLAG_COMPRESSED)
676 tfputs(T("WIM_RESHDR_FLAG_COMPRESSED, "), out);
677 if (flags & WIM_RESHDR_FLAG_FREE)
678 tfputs(T("WIM_RESHDR_FLAG_FREE, "), out);
679 if (flags & WIM_RESHDR_FLAG_METADATA)
680 tfputs(T("WIM_RESHDR_FLAG_METADATA, "), out);
681 if (flags & WIM_RESHDR_FLAG_SPANNED)
682 tfputs(T("WIM_RESHDR_FLAG_SPANNED, "), out);
684 switch (lte->resource_location) {
685 case RESOURCE_IN_WIM:
686 if (lte->wim->filename) {
687 tfprintf(out, T("WIM file = `%"TS"'\n"),
694 case RESOURCE_IN_FILE_ON_DISK:
695 tfprintf(out, T("File on Disk = `%"TS"'\n"),
698 case RESOURCE_IN_STAGING_FILE:
699 tfprintf(out, T("Staging File = `%"TS"'\n"),
700 lte->staging_file_name);
709 do_print_lookup_table_entry(struct wim_lookup_table_entry *lte, void *fp)
711 print_lookup_table_entry(lte, (FILE*)fp);
716 * Prints the lookup table of a WIM file.
719 wimlib_print_lookup_table(WIMStruct *w)
721 for_lookup_table_entry(w->lookup_table,
722 do_print_lookup_table_entry,
726 /* Given a SHA1 message digest, return the corresponding entry in the WIM's
727 * lookup table, or NULL if there is none. */
728 struct wim_lookup_table_entry *
729 __lookup_resource(const struct wim_lookup_table *table, const u8 hash[])
732 struct wim_lookup_table_entry *lte;
733 struct hlist_node *pos;
735 wimlib_assert(table != NULL);
736 wimlib_assert(hash != NULL);
738 i = *(size_t*)hash % table->capacity;
739 hlist_for_each_entry(lte, pos, &table->array[i], hash_list)
740 if (hashes_equal(hash, lte->hash))
747 * Finds the dentry, lookup table entry, and stream index for a WIM file stream,
750 * This is only for pre-resolved inodes.
753 lookup_resource(WIMStruct *w,
756 struct wim_dentry **dentry_ret,
757 struct wim_lookup_table_entry **lte_ret,
760 struct wim_dentry *dentry;
761 struct wim_lookup_table_entry *lte;
763 const tchar *stream_name = NULL;
764 struct wim_inode *inode;
767 if (lookup_flags & LOOKUP_FLAG_ADS_OK) {
768 stream_name = path_stream_name(path);
770 p = (tchar*)stream_name - 1;
775 dentry = get_dentry(w, path);
781 inode = dentry->d_inode;
783 wimlib_assert(inode->i_resolved);
785 if (!(lookup_flags & LOOKUP_FLAG_DIRECTORY_OK)
786 && inode_is_directory(inode))
790 struct wim_ads_entry *ads_entry;
792 ads_entry = inode_get_ads_entry(inode, stream_name,
795 stream_idx = ads_idx + 1;
796 lte = ads_entry->lte;
807 *dentry_ret = dentry;
811 *stream_idx_ret = stream_idx;
816 /* Resolve an inode's lookup table entries
818 * This replaces the SHA1 hash fields (which are used to lookup an entry in the
819 * lookup table) with pointers directly to the lookup table entries. A circular
820 * linked list of streams sharing the same lookup table entry is created.
822 * This function always succeeds; unresolved lookup table entries are given a
826 inode_resolve_ltes(struct wim_inode *inode, struct wim_lookup_table *table)
829 if (!inode->i_resolved) {
830 struct wim_lookup_table_entry *lte;
831 /* Resolve the default file stream */
832 lte = __lookup_resource(table, inode->i_hash);
834 inode->i_resolved = 1;
836 /* Resolve the alternate data streams */
837 for (u16 i = 0; i < inode->i_num_ads; i++) {
838 struct wim_ads_entry *cur_entry = &inode->i_ads_entries[i];
839 lte = __lookup_resource(table, cur_entry->hash);
840 cur_entry->lte = lte;
846 inode_unresolve_ltes(struct wim_inode *inode)
848 if (inode->i_resolved) {
850 copy_hash(inode->i_hash, inode->i_lte->hash);
852 zero_out_hash(inode->i_hash);
854 for (u16 i = 0; i < inode->i_num_ads; i++) {
855 if (inode->i_ads_entries[i].lte)
856 copy_hash(inode->i_ads_entries[i].hash,
857 inode->i_ads_entries[i].lte->hash);
859 zero_out_hash(inode->i_ads_entries[i].hash);
861 inode->i_resolved = 0;
866 * Returns the lookup table entry for stream @stream_idx of the inode, where
867 * stream_idx = 0 means the default un-named file stream, and stream_idx >= 1
868 * corresponds to an alternate data stream.
870 * This works for both resolved and un-resolved inodes.
872 struct wim_lookup_table_entry *
873 inode_stream_lte(const struct wim_inode *inode, unsigned stream_idx,
874 const struct wim_lookup_table *table)
876 if (inode->i_resolved)
877 return inode_stream_lte_resolved(inode, stream_idx);
879 return inode_stream_lte_unresolved(inode, stream_idx, table);
883 /* Return the lookup table entry for the unnamed data stream of an inode, or
884 * NULL if there is none.
886 * You'd think this would be easier than it actually is, since the unnamed data
887 * stream should be the one referenced from the inode itself. Alas, if there
888 * are named data streams, Microsoft's "imagex.exe" program will put the unnamed
889 * data stream in one of the alternate data streams instead of inside the WIM
890 * dentry itself. So we need to check the alternate data streams too.
892 * Also, note that a dentry may appear to have more than one unnamed stream, but
893 * if the SHA1 message digest is all 0's then the corresponding stream does not
894 * really "count" (this is the case for the inode's own file stream when the
895 * file stream that should be there is actually in one of the alternate stream
896 * entries.). This is despite the fact that we may need to extract such a
897 * missing entry as an empty file or empty named data stream.
899 struct wim_lookup_table_entry *
900 inode_unnamed_lte(const struct wim_inode *inode,
901 const struct wim_lookup_table *table)
903 if (inode->i_resolved)
904 return inode_unnamed_lte_resolved(inode);
906 return inode_unnamed_lte_unresolved(inode, table);
910 lte_add_stream_size(struct wim_lookup_table_entry *lte, void *total_bytes_p)
912 *(u64*)total_bytes_p += lte->resource_entry.size;
917 lookup_table_total_stream_size(struct wim_lookup_table *table)
920 for_lookup_table_entry(table, lte_add_stream_size, &total_size);