[libvirt] [PATCH v3 1/3] qemu: extract PCI handling structs
Ján Tomko
jtomko at redhat.com
Mon May 5 12:07:15 UTC 2014
On 05/03/2014 06:31 PM, Roman Bogorodskiy wrote:
> Extract PCI handling related structs that could be shared
> with other drivers.
>
> List of structs moved to virpci.h and new names:
>
> qemuDomainPCIAddressBus -> virDomainPCIAddressBus
> qemuDomainPCIAddressBusPtr -> virDomainPCIAddressBusPtr
> _qemuDomainPCIAddressSet -> virDomainPCIAddressSet
> qemuDomainPCIAddressSetPtr -> virDomainPCIAddressSetPtr
> qemuDomainPCIConnectFlags -> virDomainPCIConnectFlags
I would drop the 'Domain', to make the prefix match the file.
>
> Also, extract qemuDomainPCIAddressAsString function and rename
> it into virPCIDeviceAddressAsString.
If that was moved into the second patch, this one would touch two less files
(unless I missed something).
> ---
> src/Makefile.am | 2 +-
> src/libvirt_private.syms | 1 +
> src/qemu/qemu_command.c | 201 +++++++++++++++++++----------------------------
> src/qemu/qemu_command.h | 40 +++-------
> src/qemu/qemu_domain.h | 5 +-
> src/util/virpci.c | 14 ++++
> src/util/virpci.h | 48 +++++++++++
> tools/Makefile.am | 1 +
> 8 files changed, 158 insertions(+), 154 deletions(-)
> @@ -2134,10 +2093,10 @@ int qemuDomainPCIAddressEnsureAddr(qemuDomainPCIAddressSetPtr addrs,
> * function is only used for hot-plug, though, and hot-plug is
> * only supported for standard PCI devices, so we can safely use
> * the setting below */
> - qemuDomainPCIConnectFlags flags = (QEMU_PCI_CONNECT_HOTPLUGGABLE |
> - QEMU_PCI_CONNECT_TYPE_PCI);
> + virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
> + VIR_PCI_CONNECT_TYPE_PCI);
Indentation is off here.
>
> - if (!(addrStr = qemuDomainPCIAddressAsString(&dev->addr.pci)))
> + if (!(addrStr = virPCIDeviceAddressAsString(&dev->addr.pci)))
> goto cleanup;
>
> if (dev->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
> diff --git a/src/util/virpci.h b/src/util/virpci.h
> index 20ffe54..21fe261 100644
> --- a/src/util/virpci.h
> +++ b/src/util/virpci.h
> @@ -26,6 +26,7 @@
>
> # include "internal.h"
> # include "virobject.h"
> +# include "domain_conf.h"
Hmm, this requires the Makefile changes just to get around the cross-inclusion
syntax check rule, that is probably not a good idea.
It's needed for virDevicePCIAddress and virDomainControllerModelPCI.
We have virDevicePCIAddress (defined in device_conf.h) for guest devices and
virPCIDeviceAddress (here in virpci.h) for host devices.
virDomainControllerModelPCI is needed by the PCIAddressBusSetModel set
function, which fills out the flags and {min,max}Slots and also the model,
but I can't find any function using it.
I think the right thing is to drop the include - change the guest devices to
use the address type defined here in virpci.h and stop storing the model with
the address bus.
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140505/05efc881/attachment-0001.sig>
More information about the libvir-list
mailing list