
On 07/14/2011 08:24 AM, Eric Blake wrote:
Rather than making the iohelper subject to a race in reopening the file, it is nicer to pass an already-open fd by inheritance.
The old synopsis form must continue to work - if someone updates their libvirt package and installs a new libvirt_iohelper but without restarting the old libvirtd daemon, then the daemon can still make calls using the old syntax but the new iohelper.
* src/util/iohelper.c (runIO): Split code for open... (prepare): ...to new function. (usage): Update synopsis. (main): Allow alternate calling form. * src/fdstream.c (virFDStreamOpenFileInternal): Use alternate form. --- src/fdstream.c | 32 ++++-------- src/util/iohelper.c | 142 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 110 insertions(+), 64 deletions(-)
Squash this in if my v2 command patch goes in first: https://www.redhat.com/archives/libvir-list/2011-July/msg00864.html diff --git i/src/fdstream.c w/src/fdstream.c index 754431b..b70c831 100644 --- i/src/fdstream.c +++ w/src/fdstream.c @@ -570,7 +570,7 @@ virFDStreamOpenFileInternal(virStreamPtr st, path, NULL); virCommandAddArgFormat(cmd, "%llu", length); - virCommandTransferFD(cmd, fd); + virCommandTransferFD(cmd, &fd); virCommandAddArgFormat(cmd, "%d", fd); if (oflags == O_RDONLY) { -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org