- * compression type. The lookup table entry for the metadata resource
- * is updated. */
- ret = write_wim_resource_from_buffer(buf, metadata_original_size,
- w->out_fp,
- wimlib_get_compression_type(w),
- <e->output_resource_entry,
- lte->hash);
- if (ret != 0)
- goto out;
-
- /* It's very likely the SHA1 message digest of the metadata resource
- * changed, so re-insert the lookup table entry into the lookup table.
- *
- * We do not check for other lookup table entries having the same SHA1
- * message digest. It's possible for 2 absolutely identical images to
- * be added, therefore causing 2 identical metadata resources to be in
- * the WIM. However, in this case, it's expected for 2 separate lookup
- * table entries to be created, even though this doesn't make a whole
- * lot of sense since they will share the same SHA1 message digest.
- * */
- lookup_table_unlink(w->lookup_table, lte);
- lookup_table_insert(w->lookup_table, lte);
- lte->out_refcnt = 1;
-
- /* Make sure that the lookup table entry for this metadata resource is
- * marked with the metadata flag. */
- lte->output_resource_entry.flags |= WIM_RESHDR_FLAG_METADATA;
-out:
- /* All the data has been written to the new WIM; no need for the buffer
- * anymore */
+ * compression type, in the process updating the blob descriptor for the
+ * metadata resource. */
+ ret = write_wim_resource_from_buffer(buf,
+ len,
+ true,
+ &wim->out_fd,
+ wim->out_compression_type,
+ wim->out_chunk_size,
+ &imd->metadata_blob->out_reshdr,
+ imd->metadata_blob->hash,
+ write_resource_flags);
+