]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_domain_address: use virPCIDeviceAddressEqual() in conditionals
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 20 Sep 2019 13:52:55 +0000 (10:52 -0300)
committerErik Skultety <eskultet@redhat.com>
Mon, 23 Sep 2019 07:11:14 +0000 (09:11 +0200)
commite1d539022489e697598412b299c07e6b714a951c
tree48ba363fd50fcca0d67b993f344e8bdf3eb30a9f
parent06709296cb906e0241b76b949dec8275999e2e3f
qemu_domain_address: use virPCIDeviceAddressEqual() in conditionals

A common operation in qemu_domain_address is comparing a
virPCIDeviceAddress and assigning domain, bus, slot and function
to a specific value. The former can be done with the existing
virPCIDeviceAddressEqual() helper, as long as we provide
a virPCIDeviceAddress to compare it to.

The later can be done by direct assignment of the now existing
virPCIDeviceAddress struct. The defined values of domain, bus,
slot and function will be assigned to info->addr.pci, the other
values are zeroed (which happens to be their default values too).
It's also worth noticing that all these assignments are being
conditioned by virDeviceInfoPCIAddressIsPresent() calls, thus it's
sensible to discard any non-zero values that might happen to exist
in @cont->info.addr, if we settled beforehand that @cont->info.addr
is not present or bogus.

Suggested-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/qemu/qemu_domain_address.c