Improve progress messages for NTFS apply
authorEric Biggers <ebiggers3@gmail.com>
Sat, 24 Nov 2012 02:09:54 +0000 (20:09 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 24 Nov 2012 02:09:54 +0000 (20:09 -0600)
programs/imagex.c
src/extract.c
src/wimlib.h

index 96f9a93..f3b75e0 100644 (file)
@@ -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);
index b7a15c0..c42adac 100644 (file)
@@ -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
index 6effa1c..c81b42f 100644 (file)
@@ -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;