From 8679240bb2e419f931771a977fa18c00f88e450a Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 23 Nov 2012 20:09:54 -0600 Subject: [PATCH] Improve progress messages for NTFS apply --- programs/imagex.c | 22 +++++++++++++--------- src/extract.c | 7 +++++-- src/wimlib.h | 6 ++++++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/programs/imagex.c b/programs/imagex.c index 96f9a934..f3b75e0b 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -398,15 +398,22 @@ static int imagex_progress_func(enum wimlib_progress_msg msg, putchar('\n'); break; case WIMLIB_PROGRESS_MSG_EXTRACT_IMAGE_BEGIN: - printf("Applying image %d (%s) to `%s'\n", + printf("Applying image %d (%s) from `%s' to %s `%s'\n", info->extract.image, info->extract.image_name, + info->extract.wimfile_name, + ((info->extract.extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) ? + "NTFS volume" : "directory"), info->extract.target); break; - /*case WIMLIB_PROGRESS_MSG_EXTRACT_IMAGE_END:*/ - /*printf("Done applying image %d!\n",*/ - /*info->extract.image);*/ - /*break;*/ + case WIMLIB_PROGRESS_MSG_EXTRACT_IMAGE_END: + printf("Done applying WIM image.\n", + info->extract.image); + if (info->extract.extract_flags & WIMLIB_EXTRACT_FLAG_NTFS) { + printf("Unmounting NTFS volume `%s'...\n", + info->extract.target); + } + break; /*case WIMLIB_PROGRESS_MSG_EXTRACT_DIR_STRUCTURE_BEGIN:*/ /*printf("Applying directory structure to %s\n",*/ /*info->extract.target);*/ @@ -617,11 +624,8 @@ static int imagex_apply(int argc, const char **argv) ret = stat(target, &stbuf); if (ret == 0) { - if (S_ISBLK(stbuf.st_mode) || S_ISREG(stbuf.st_mode)) { + if (S_ISBLK(stbuf.st_mode) || S_ISREG(stbuf.st_mode)) extract_flags |= WIMLIB_EXTRACT_FLAG_NTFS; - printf("Applying `%s' image %d to NTFS volume `%s'\n", - wimfile, image, target); - } } else { if (errno != ENOENT) { imagex_error_with_errno("Failed to stat `%s'", target); diff --git a/src/extract.c b/src/extract.c index b7a15c04..c42adac8 100644 --- a/src/extract.c +++ b/src/extract.c @@ -583,9 +583,12 @@ static int extract_single_image(WIMStruct *w, int image, args.progress_func = progress_func; if (progress_func) { - args.progress.extract.image = image; + args.progress.extract.wimfile_name = w->filename; + args.progress.extract.image = image; + args.progress.extract.extract_flags = (extract_flags & + WIMLIB_EXTRACT_MASK_PUBLIC); args.progress.extract.image_name = wimlib_get_image_name(w, image); - args.progress.extract.target = target; + args.progress.extract.target = target; } #ifdef WITH_NTFS_3G diff --git a/src/wimlib.h b/src/wimlib.h index 6effa1c1..c81b42f4 100644 --- a/src/wimlib.h +++ b/src/wimlib.h @@ -414,6 +414,12 @@ union wimlib_progress_info { /** Number of the image being extracted (1-based). */ int image; + /** Flags passed to to wimlib_extract_image() */ + int extract_flags; + + /** Full path to the WIM file being extracted. */ + const char *wimfile_name; + /** Name of the image being extracted. */ const char *image_name; -- 2.43.0