]> wimlib.net Git - wimlib/blobdiff - src/wim.c
mount_image.c: Implement versioned unmount messages
[wimlib] / src / wim.c
index c76be36f65176bd02967dd1ec390770a134ba9ce..5a38688be443976a220e2e90f38cc8443ea70c46 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -3,7 +3,6 @@
  */
 
 /*
- * Copyright (C) 2010 Carl Thijssen
  * Copyright (C) 2012 Eric Biggers
  *
  * wimlib - Library for working with WIM files
@@ -40,7 +39,7 @@
 #endif
 
 #include "wimlib_internal.h"
-#include "io.h"
+#include "buffer_io.h"
 #include "lookup_table.h"
 #include "xml.h"
 
@@ -59,7 +58,7 @@ static int print_files(WIMStruct *w)
                                  NULL);
 }
 
-WIMStruct *new_wim_struct()
+static WIMStruct *new_wim_struct()
 {
        WIMStruct *w = CALLOC(1, sizeof(WIMStruct));
 #ifdef WITH_FUSE
@@ -149,7 +148,7 @@ static int append_metadata_resource_entry(struct lookup_table_entry *lte,
 }
 
 /* Returns the compression type given in the flags of a WIM header. */
-int wim_hdr_flags_compression_type(int wim_hdr_flags)
+static int wim_hdr_flags_compression_type(int wim_hdr_flags)
 {
        if (wim_hdr_flags & WIM_HDR_FLAG_COMPRESSION) {
                if (wim_hdr_flags & WIM_HDR_FLAG_COMPRESS_LZX)
@@ -580,6 +579,20 @@ WIMLIBAPI int wimlib_open_wim(const char *wim_file, int open_flags,
        return ret;
 }
 
+void destroy_image_metadata(struct image_metadata *imd,
+                           struct lookup_table *table)
+{
+       free_dentry_tree(imd->root_dentry, table);
+       free_security_data(imd->security_data);
+
+       /* Get rid of the lookup table entry for this image's metadata resource
+        * */
+       if (table) {
+               lookup_table_unlink(table, imd->metadata_lte);
+               free_lookup_table_entry(imd->metadata_lte);
+       }
+}
+
 /* Frees the memory for the WIMStruct, including all internal memory; also
  * closes all files associated with the WIMStruct.  */
 WIMLIBAPI void wimlib_free(WIMStruct *w)