]> git.ipfire.org Git - thirdparty/libvirt.git/commit
fdstream: introduce virFDStreamOpenBlockDevice
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Fri, 15 Aug 2014 08:11:35 +0000 (12:11 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 25 Aug 2014 06:46:13 +0000 (10:46 +0400)
commitf5b4c141556de71a1bdf012f76cbf6919f180e99
tree49da341e2556f86326eb82987a8946f0837e0924
parenteb626b49fdb1644829f94f6e624216ed3d558931
fdstream: introduce virFDStreamOpenBlockDevice

virStorageBackendVolDownloadLocal and virStorageBackendVolUploadLocal
use virFDStreamOpenFile function to work with the volume fd.

virFDStreamOpenFile calls virFDStreamOpenFileInternal that implements
handling of the non-blocking I/O. If a file is not a character device and
not a fifo, it uses libvirt_iohelper.

On FreeBSD, it doesn't work as expected because disk devices (including
ZFS volumes) are exposed as character devices, and ZFS volumes do not
support open(2) with O_NONBLOCK.

To overcome this, introduce a forceIOHelper flag to
virFDStreamOpenFileInternal that forces using libvirt_iohelper. And
introduce virFDStreamOpenBlockDevice that calls
virFDStreamOpenFileInternal with the forceIOHelper set to true.
src/fdstream.c
src/fdstream.h
src/libvirt_private.syms
src/storage/storage_backend.c