]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virshStreamSkip: Emulate skip for block devices
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 2 Jul 2020 13:49:33 +0000 (15:49 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 24 Aug 2020 11:32:53 +0000 (13:32 +0200)
commitc2e1c414ef139068cc3a0d78bb0ef2ecd92c1bc4
treeb2f930bf50078f9a2f93700efed7eefc0f10fdc0
parent8a0c327f112d959ee54333426c4ae99370ad4daa
virshStreamSkip: Emulate skip for block devices

This callback is called when the server sends us STREAM_HOLE
meaning there is no real data, only zeroes. For regular files
we would just seek() beyond EOF and ftruncate() to create the
hole. But for block devices this won't work. Not only we can't
seek() beyond EOF, and ftruncate() will fail, this approach won't
fill the device with zeroes. We have to do it manually.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852528

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tools/virsh-util.c