Instead of printing something like ‘type=0’ or ‘type=3’, this changes the output to show the hole and zero flags separately. For example: $ ./nbdkit -U - --filter=log sh - logfile=/dev/stdout \ --run 'qemu-img map $nbd' <<'EOF' case "$1" in get_size) echo 1M ;; pread) dd if=/dev/zero count=$3 iflag=count_bytes ;; can_extents) exit 0 ;; extents) echo "0 32K zero" echo "32K 32K hole,zero" echo "64K 983040 " ;; *) exit 2 ;; esac EOF [...] 2019-04-01 11:49:40.818357 connection=1 Extents id=2 offset=0x0 count=0x100000 req_one=1 ... 2019-04-01 11:49:40.819848 connection=1 ...Extents id=2 extents=[{ offset=0x0, length=0x8000, hole=0, zero=1 }, { offset=0x8000, length=0x8000, hole=1, zero=1 }, { offset=0x10000, length=0xf0000, hole=0, zero=0 }] return=0 Updates commit ed868b00f192cd72e91265e4fcdf3c3fbe8b7613. Thanks: Martin Kletzander --- filters/log/log.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/filters/log/log.c b/filters/log/log.c index 4878db2..02a2522 100644 --- a/filters/log/log.c +++ b/filters/log/log.c @@ -382,8 +382,10 @@ log_extents (struct nbdkit_next_ops *next_ops, void *nxdata, if (i > 0) fprintf (fp, ", "); fprintf (fp, "{ offset=0x%" PRIx64 ", length=0x%" PRIx64 ", " - "type=%" PRIu32 " }", - e.offset, e.length, e.type); + "hole=%d, zero=%d }", + e.offset, e.length, + !!(e.type & NBDKIT_EXTENT_HOLE), + !!(e.type & NBDKIT_EXTENT_ZERO)); } fclose (fp); -- 2.20.1