On 09/20/21 13:04, Richard W.M. Jones wrote:
--- copy/main.c | 6 +++++- copy/test-verbose.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/copy/main.c b/copy/main.c index 70534b5a..15a64544 100644 --- a/copy/main.c +++ b/copy/main.c @@ -39,6 +39,7 @@ #include <libnbd.h>
#include "ispowerof2.h" +#include "human-size.h" #include "version.h" #include "nbdcopy.h"
@@ -508,8 +509,11 @@ open_local (const char *filename, direction d) static void print_rw (struct rw *rw, const char *prefix, FILE *fp) { + char buf[HUMAN_SIZE_LONGEST]; + fprintf (fp, "%s: %s \"%s\"\n", prefix, rw->ops->ops_name, rw->name); - fprintf (fp, "%s: size=%" PRIi64 "\n", prefix, rw->size); + fprintf (fp, "%s: size=%" PRIi64 " (%s)\n", + prefix, rw->size, human_size (buf, rw->size, NULL)); }
/* Default implementation of rw->ops->get_extents for backends which
Hopefully rw->size is never negative here...
diff --git a/copy/test-verbose.sh b/copy/test-verbose.sh index afd57580..4cc67d37 100755 --- a/copy/test-verbose.sh +++ b/copy/test-verbose.sh @@ -28,11 +28,11 @@ requires nbdkit --version file=test-verbose.out cleanup_fn rm -f $file
-$VG nbdcopy -v -- [ nbdkit null ] null: 2>$file +$VG nbdcopy -v -- [ nbdkit memory 1M ] null: 2>$file
(1) I don't understand this change. Why do we replace "null" with "memory 1M"? (Side question that I've been meaning to ask: what is this "$VG" magic?)
cat $file
# Check some known strings appear in the output. grep '^nbdcopy: src: nbd_ops' $file -grep '^nbdcopy: src: size=0' $file +grep '^nbdcopy: src: size=1048576 (1M)' $file grep '^nbdcopy: dst: null_ops' $file
Ah, the test case is modified at once so it generate more interesting output. Can you note that in the commit message please? Acked-by: Laszlo Ersek <lersek@redhat.com> Thanks! Laszlo