On 4/1/19 6:53 AM, Richard W.M. Jones wrote:
 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. 
Yes, that's nicer.
 
 Thanks: Martin Kletzander
 ---
  filters/log/log.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-) 
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  
qemu.org | 
libvirt.org