From: Eric Biggers Date: Fri, 16 Aug 2013 00:23:59 +0000 (-0500) Subject: pipable WIM extraction: Take into account HARDLINKBYTES X-Git-Tag: v1.5.0~67 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=e08e0d6d920e1f3f154270efc4849d51efd65593;ds=sidebyside pipable WIM extraction: Take into account HARDLINKBYTES --- diff --git a/include/wimlib/xml.h b/include/wimlib/xml.h index ce82b14a..0d09bf64 100644 --- a/include/wimlib/xml.h +++ b/include/wimlib/xml.h @@ -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); diff --git a/src/extract.c b/src/extract.c index 446b5555..a8864af0 100644 --- a/src/extract.c +++ b/src/extract.c @@ -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 * from the corresponding 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 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 diff --git a/src/xml.c b/src/xml.c index 52cd441f..ca4814f0 100644 --- 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) {