From e08e0d6d920e1f3f154270efc4849d51efd65593 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 15 Aug 2013 19:23:59 -0500 Subject: [PATCH] pipable WIM extraction: Take into account HARDLINKBYTES --- include/wimlib/xml.h | 3 +++ src/extract.c | 9 ++++++++- src/xml.c | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) 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) { -- 2.43.0