static int blob_rollback_export(struct blob_descriptor *blob, void *_blob_table) { struct blob_table *blob_table = _blob_table; blob->refcnt -= blob->out_refcnt; if (blob->was_exported) { blob_table_unlink(blob_table, blob); free_blob_descriptor(blob); } return 0; }
static void destroy_image_metadata(struct wim_image_metadata *imd, struct blob_table *table, bool free_metadata_blob_descriptor) { free_dentry_tree(imd->root_dentry, table); imd->root_dentry = NULL; free_wim_security_data(imd->security_data); imd->security_data = NULL; if (free_metadata_blob_descriptor) { free_blob_descriptor(imd->metadata_blob); imd->metadata_blob = NULL; } if (!table) { struct blob_descriptor *blob, *tmp; list_for_each_entry_safe(blob, tmp, &imd->unhashed_blobs, unhashed_list) free_blob_descriptor(blob); } INIT_LIST_HEAD(&imd->unhashed_blobs); INIT_HLIST_HEAD(&imd->inode_list); }
/* Checksum all blobs that are unhashed (other than the metadata blobs), merging * them into the blob table as needed. This is a no-op unless files have been * added to an image in the same WIMStruct. */ int wim_checksum_unhashed_blobs(WIMStruct *wim) { int ret; if (!wim_has_metadata(wim)) return 0; for (int i = 0; i < wim->hdr.image_count; i++) { struct blob_descriptor *blob, *tmp; struct wim_image_metadata *imd = wim->image_metadata[i]; image_for_each_unhashed_blob_safe(blob, tmp, imd) { struct blob_descriptor *new_blob; ret = hash_unhashed_blob(blob, wim->blob_table, &new_blob); if (ret) return ret; if (new_blob != blob) free_blob_descriptor(blob); } } return 0; }