[libvirt] [PATCH 4/8] conf: Allow NULL for virDomainDeviceInfoCallback

Ján Tomko jtomko at redhat.com
Mon May 20 12:59:19 UTC 2019


On Mon, May 20, 2019 at 01:37:49PM +0200, Andrea Bolognani wrote:
>The virDomainDeviceInfoIterate() function was initially
>written with the expectation that all devices would embed a
>virDomainDeviceInfo, and thus the user-provided callback
>would never be passed NULL; however, that doesn't really
>represent reality, as multiple devices don't have any
>virDomainDeviceInfo associated with them.

virDomainDeviceInfoIterate is specifically meant for iterating
over device infos.

Commit 88d24aaccc1e31ff1ce682f9496cf08cc7f7c216 :
    conf: domain: Introduce virDomainDeviceIterateFlags
documented this function as iterating over devices (but did not
implement this for every device) and then
commit dd45c2710f6fd2d4f8a47f97960532d0e0091e7d
    conf: domain: gfx: Iterate over graphics devices when doing validation
added one of them.

Of course, there is a huge overlap between iterating over all devices
and just those with an info, but since the callers do request *Info*
I don't think they should expect it to be NULL.

Jano

>
>Since we still want to be able to iterate over those devices,
>clarify that callbacks are expected to be able to handle NULL
>being passed to them, and update all existing callbacks so
>that they actually do so.
>
>Signed-off-by: Andrea Bolognani <abologna at redhat.com>
>---
> src/bhyve/bhyve_device.c       |  4 ++++
> src/conf/domain_addr.c         |  9 +++++++++
> src/conf/domain_conf.c         | 34 +++++++++++++++++++++++++++++++-
> src/libxl/libxl_driver.c       |  3 +++
> src/qemu/qemu_domain_address.c | 36 +++++++++++++++++++++++++++++++---
> src/qemu/qemu_hotplug.c        |  3 +++
> 6 files changed, 85 insertions(+), 4 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190520/7079c9a1/attachment-0001.sig>


More information about the libvir-list mailing list