]> xenbits.xensource.com Git - libvirt.git/commit
virpci.c: simplify virPCIDeviceNew() signature
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 4 Jan 2021 12:54:28 +0000 (09:54 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 29 Jan 2021 20:52:10 +0000 (17:52 -0300)
commitb0264e9404e1469fb174ad2839305c291a8a73dd
treee72664f1461c873ba8972de35e9ae8d130ba4e29
parent0e0c974b20449df3e71fd9dc423ecdd4d962020e
virpci.c: simplify virPCIDeviceNew() signature

The current virPCIDeviceNew() signature, receiving 4 uints in sequence
(domain, bus, slot, function), is not neat.

We already have a way to represent a PCI address in virPCIDeviceAddress
that is used in the code. Aside from the test files, most of
virPCIDeviceNew() callers have access to a virPCIDeviceAddress reference,
but then we need to retrieve the 4 required uints (addr.domain, addr.bus,
addr.slot, addr.function) to satisfy virPCIDeviceNew(). The result is
that we have extra verbosity/boilerplate to retrieve an information that
is already available in virPCIDeviceAddress.

A better way is presented by virNVMEDeviceNew(), where the caller just
supplies a virPCIDeviceAddress pointer and the function handles the
details internally.

This patch changes virPCIDeviceNew() to receive a virPCIDeviceAddress
pointer instead of 4 uints.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
15 files changed:
src/hypervisor/virhostdev.c
src/libxl/libxl_driver.c
src/node_device/node_device_udev.c
src/qemu/qemu_domain_address.c
src/qemu/qemu_driver.c
src/security/security_apparmor.c
src/security/security_dac.c
src/security/security_selinux.c
src/security/virt-aa-helper.c
src/util/virnetdev.c
src/util/virnvme.c
src/util/virpci.c
src/util/virpci.h
tests/virhostdevtest.c
tests/virpcitest.c