pipable WIM extraction: Take into account HARDLINKBYTES
authorEric Biggers <ebiggers3@gmail.com>
Fri, 16 Aug 2013 00:23:59 +0000 (19:23 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 16 Aug 2013 00:23:59 +0000 (19:23 -0500)
include/wimlib/xml.h
src/extract.c
src/xml.c

index ce82b14..0d09bf6 100644 (file)
@@ -10,6 +10,9 @@ struct resource_entry;
 extern u64
 wim_info_get_total_bytes(const struct wim_info *info);
 
+extern u64
+wim_info_get_image_hard_link_bytes(const struct wim_info *info, int image);
+
 extern u64
 wim_info_get_image_total_bytes(const struct wim_info *info, int image);
 
index 446b555..a8864af 100644 (file)
@@ -2056,10 +2056,17 @@ extract_tree(WIMStruct *wim, const tchar *wim_source_path, const tchar *target,
                 * However, we can get a reasonably accurate estimate by taking
                 * <TOTALBYTES> from the corresponding <IMAGE> in the WIM XML
                 * data.  This does assume that a full image is being extracted,
-                * but currently there is no API for doing otherwise.  */
+                * but currently there is no API for doing otherwise.  (Also,
+                * subtract <HARDLINKBYTES> from this if hard links are
+                * supported by the extraction mode.)  */
                ctx.progress.extract.total_bytes =
                        wim_info_get_image_total_bytes(wim->wim_info,
                                                       wim->current_image);
+               if (ctx.supported_features.hard_links) {
+                       ctx.progress.extract.total_bytes -=
+                               wim_info_get_image_hard_link_bytes(wim->wim_info,
+                                                                  wim->current_image);
+               }
        }
 
        /* Handle the special case of extracting a file to standard
index 52cd441..ca4814f 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -137,6 +137,12 @@ wim_info_get_total_bytes(const struct wim_info *info)
        return info->total_bytes;
 }
 
+u64
+wim_info_get_image_hard_link_bytes(const struct wim_info *info, int image)
+{
+       return info->images[image - 1].hard_link_bytes;
+}
+
 u64
 wim_info_get_image_total_bytes(const struct wim_info *info, int image)
 {