]> wimlib.net Git - wimlib/commitdiff
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 ce82b14a44411310ee24dd92b873246ad17f345d..0d09bf64dcf9c9abff406c9678a289c416bb7d8c 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 446b55551b29337b6e2d5fdd08e027b58fa2162b..a8864af0cdccf97f7e355175f252311db7a1c49d 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 52cd441fe2ad38008c4f643b2020ef181a841c73..ca4814f044d07f2b5c118ad49cd8428069e2a9db 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)
 {