On 04/17/2014 03:59 PM, Max Reitz wrote:
Implement progress output for the commit command by querying the
progress of the block job.
Signed-off-by: Max Reitz <address@hidden>
---
qemu-img-cmds.hx | 4 ++--
qemu-img.c | 24 ++++++++++++++++++++++--
qemu-img.texi | 2 +-
3 files changed, 25 insertions(+), 5 deletions(-)
+
+ /* A block job may finish instantanously without publishing any progress,
s/instantanously/instantaneously/
@@ -733,7 +739,7 @@ static int img_commit(int argc, char **argv)
fmt = NULL;
cache = BDRV_DEFAULT_CACHE;
for(;;) {
- c = getopt(argc, argv, "f:ht:q");
+ c = getopt(argc, argv, "f:ht:qp");
Here, 'p' is last,...
if (c == -1) {
break;
}
@@ -748,11 +754,20 @@ static int img_commit(int argc, char **argv)
case 't':
cache = optarg;
break;
+ case 'p':
+ progress = true;
+ break;
case 'q':
...but here, 'q' is last. The OCD side of me likes to list getopt()
arguments in the same order as the case statements in order to more
easily map the two to each other and ensure we aren't missing anything
(the truly OCD person insists on sorting things alphabetically, or at
least case-insensitively). As order doesn't actually matter to the
compiler, it doesn't invalidate this patch; but something to consider if
you respin for other reasons. :)