-wimlib_open_wim(const tchar *wimfile, int open_flags,
- WIMStruct **wim_ret, wimlib_progress_func_t progress_func)
-{
- open_flags &= WIMLIB_OPEN_MASK_PUBLIC;
- return open_wim_as_WIMStruct(wimfile, open_flags, wim_ret,
- progress_func);
-}
-
-void
-destroy_image_metadata(struct wim_image_metadata *imd,
- struct wim_lookup_table *table,
- bool free_metadata_lte)
-{
- 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_lte) {
- free_lookup_table_entry(imd->metadata_lte);
- imd->metadata_lte = NULL;
- }
- if (table == NULL) {
- struct wim_lookup_table_entry *lte, *tmp;
- list_for_each_entry_safe(lte, tmp, &imd->unhashed_streams, unhashed_list)
- free_lookup_table_entry(lte);
- }
- INIT_LIST_HEAD(&imd->unhashed_streams);
- INIT_LIST_HEAD(&imd->inode_list);
-#ifdef WITH_NTFS_3G
- if (imd->ntfs_vol) {
- do_ntfs_umount(imd->ntfs_vol);
- imd->ntfs_vol = NULL;
- }
-#endif
-}
-
-void
-put_image_metadata(struct wim_image_metadata *imd,
- struct wim_lookup_table *table)
-{
- if (imd && --imd->refcnt == 0) {
- destroy_image_metadata(imd, table, true);
- FREE(imd);
- }
-}
-
-/* Appends the specified image metadata structure to the array of image metadata
- * for a WIM, and increments the image count. */
-int
-append_image_metadata(WIMStruct *wim, struct wim_image_metadata *imd)