Re: [libvirt PATCH v2 03/15] conf: move/rename hostdev PCI driver type enum to device_conf.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 06, 2023 at 02:38:48 -0500, Laine Stump wrote:
> Currently this enum is defined in domain_conf.h and named
> virDomainHostdevSubsysPCIDriverType. I want to use it in parts of the
> network and networkport config, so am moving its definition to
> device_conf.h which is / can be included by all interested parties,
> and renaming it to be less specific to its old usage (all the other
> parts still apply, at least functionally, to the new usage). The name
> change (which includes enum values) does cause a lot of churn, but
> it's all mechanical.
> 
> Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
> ---

[...]


> @@ -23342,8 +23335,9 @@ virDomainHostdevDefFormatSubsysPCI(virBuffer *buf,
>              virBufferAsprintf(&sourceAttrBuf, " writeFiltering='%s'",
>                                virTristateBoolTypeToString(def->writeFiltering));
>  
> -    if (pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
> -        const char *backend = virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend);
> +    if (pcisrc->backend != VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_DEFAULT) {
> +        const char *backend
> +            = virDeviceHostdevPCIDriverTypeToString(pcisrc->backend);

Please no pointless linebreaks. The times of max 80 colums are gone.

>  
>          if (!backend) {
>              virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -29841,17 +29835,17 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDef *iface,
>          switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.driver) {
>          case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
>              actual->data.hostdev.def.source.subsys.u.pci.backend =
> -                VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT;
> +                VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_DEFAULT;
>              break;
>  
>          case VIR_NETWORK_FORWARD_DRIVER_NAME_KVM:
>              actual->data.hostdev.def.source.subsys.u.pci.backend =
> -                VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
> +                VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_KVM;
>              break;
>  
>          case VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO:
>              actual->data.hostdev.def.source.subsys.u.pci.backend =
> -                VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
> +                VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_VFIO;
>              break;

I'd argue that the above is in the same category now that you are
changing it.

[...]

> @@ -11332,14 +11332,15 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
>                              virQEMUCaps *qemuCaps)
>  {
>      bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO();
> -    virDomainHostdevSubsysPCIBackendType *backend = &hostdev->source.subsys.u.pci.backend;
> +    virDeviceHostdevPCIDriverType *driverType
> +        = &hostdev->source.subsys.u.pci.backend;

Same.

>  
>      /* assign defaults for hostdev passthrough */
> -    switch (*backend) {
> -    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
> +    switch (*driverType) {
> +    case VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_DEFAULT:
>          if (supportsPassthroughVFIO) {
>              if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
> -                *backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
> +                *driverType = VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_VFIO;
>              } else {
>                  virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>                                 _("VFIO PCI device assignment is not supported by this version of QEMU"));


[...]

> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
> index be13979cef..ac4225a783 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -1092,9 +1092,11 @@ get_files(vahControl * ctl)
>              case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
>                  virPCIDevice *pci = virPCIDeviceNew(&dev->source.subsys.u.pci.addr);
>  
> -                virDomainHostdevSubsysPCIBackendType backend = dev->source.subsys.u.pci.backend;
> -                if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO ||
> -                        backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
> +                virDeviceHostdevPCIDriverType driverType
> +                    = dev->source.subsys.u.pci.backend;

ditto

> +
> +                if (driverType == VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_VFIO ||
> +                    driverType == VIR_DEVICE_HOSTDEV_PCI_DRIVER_TYPE_DEFAULT) {
>                      needsVfio = true;
>                  }


Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux