]> wimlib.net Git - wimlib/blobdiff - src/metadata_resource.c
Update LZMS LRU queue handling
[wimlib] / src / metadata_resource.c
index e632198940f332928b2e543b78e55e7fd8aa6d77..2d780e96d82f25f9fa59b885db7d308527f8fe51 100644 (file)
@@ -31,6 +31,7 @@
 #include "wimlib/metadata.h"
 #include "wimlib/resource.h"
 #include "wimlib/security.h"
+#include "wimlib/write.h"
 
 /*
  * Reads a metadata resource for an image in the WIM file.  The metadata
@@ -71,13 +72,9 @@ read_metadata_resource(WIMStruct *wim, struct wim_image_metadata *imd)
        struct wim_inode *inode;
 
        metadata_lte = imd->metadata_lte;
-       metadata_len = wim_resource_size(metadata_lte);
+       metadata_len = metadata_lte->size;
 
-       DEBUG("Reading metadata resource: original_size = %"PRIu64", "
-             "size = %"PRIu64", offset = %"PRIu64"",
-             metadata_lte->resource_entry.original_size,
-             metadata_lte->resource_entry.size,
-             metadata_lte->resource_entry.offset);
+       DEBUG("Reading metadata resource.");
 
        /* There is no way the metadata resource could possibly be less than (8
         * + WIM_DENTRY_DISK_SIZE) bytes, where the 8 is for security data (with
@@ -90,7 +87,7 @@ read_metadata_resource(WIMStruct *wim, struct wim_image_metadata *imd)
        }
 
        /* Read the metadata resource into memory.  (It may be compressed.) */
-       ret = read_full_resource_into_alloc_buf(metadata_lte, &buf);
+       ret = read_full_stream_into_alloc_buf(metadata_lte, &buf);
        if (ret)
                return ret;
 
@@ -246,7 +243,7 @@ prepare_metadata_resource(WIMStruct *wim, int image,
         */
        recalculate_security_data_length(sd);
        subdir_offset = (((u64)sd->total_length + 7) & ~7) +
-                       dentry_correct_total_length(root) + 8;
+                       dentry_out_total_length(root) + 8;
 
        /* Calculate the subdirectory offsets for the entire dentry tree.  */
        calculate_subdir_offsets(root, &subdir_offset);
@@ -296,8 +293,9 @@ write_metadata_resource(WIMStruct *wim, int image, int write_resource_flags)
         * the metadata resource.  */
        ret = write_wim_resource_from_buffer(buf, len, WIM_RESHDR_FLAG_METADATA,
                                             &wim->out_fd,
-                                            wim->compression_type,
-                                            &imd->metadata_lte->output_resource_entry,
+                                            wim->out_compression_type,
+                                            wim->out_chunk_size,
+                                            &imd->metadata_lte->out_reshdr,
                                             imd->metadata_lte->hash,
                                             write_resource_flags);