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

[libvirt] [PATCH 1/2] conf: Rename some device_conf predicates



The affected functions are

  virDeviceInfoPCIAddressWanted()
  virDeviceInfoPCIAddressPresent()

which get renamed to

  virDeviceInfoPCIAddressIsWanted()
  virDeviceInfoPCIAddressIsPresent()

to comply with the naming convention used for other
predicates.

Signed-off-by: Andrea Bolognani <abologna redhat com>
---
 src/bhyve/bhyve_device.c       |  6 ++--
 src/conf/device_conf.h         |  4 +--
 src/conf/domain_addr.c         |  2 +-
 src/qemu/qemu_domain_address.c | 52 +++++++++++++++++-----------------
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c
index 03aa6c93bd..207ac6a2dd 100644
--- a/src/bhyve/bhyve_device.c
+++ b/src/bhyve/bhyve_device.c
@@ -110,7 +110,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
             ((def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) &&
              (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI))) {
             if (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
-                !virDeviceInfoPCIAddressWanted(&def->controllers[i]->info))
+                !virDeviceInfoPCIAddressIsWanted(&def->controllers[i]->info))
                 continue;
 
             if (virDomainPCIAddressReserveNextAddr(addrs,
@@ -122,7 +122,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
     }
 
     for (i = 0; i < def->nnets; i++) {
-        if (!virDeviceInfoPCIAddressWanted(&def->nets[i]->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&def->nets[i]->info))
             continue;
         if (virDomainPCIAddressReserveNextAddr(addrs,
                                                &def->nets[i]->info,
@@ -148,7 +148,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
     }
 
     for (i = 0; i < def->nvideos; i++) {
-        if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&def->videos[i]->info))
             continue;
         if (virDomainPCIAddressReserveNextAddr(addrs,
                                                &def->videos[i]->info,
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index a31ce9c376..8c2bda2f4f 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -196,7 +196,7 @@ virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr)
 }
 
 static inline bool
-virDeviceInfoPCIAddressWanted(const virDomainDeviceInfo *info)
+virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info)
 {
     return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
         (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
@@ -204,7 +204,7 @@ virDeviceInfoPCIAddressWanted(const virDomainDeviceInfo *info)
 }
 
 static inline bool
-virDeviceInfoPCIAddressPresent(const virDomainDeviceInfo *info)
+virDeviceInfoPCIAddressIsPresent(const virDomainDeviceInfo *info)
 {
     return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
        !virPCIDeviceAddressIsEmpty(&info->addr.pci);
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 16f7ffa928..b62fd53c66 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -706,7 +706,7 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
     if (!(addrStr = virDomainPCIAddressAsString(&dev->addr.pci)))
         goto cleanup;
 
-    if (virDeviceInfoPCIAddressPresent(dev)) {
+    if (virDeviceInfoPCIAddressIsPresent(dev)) {
         /* We do not support hotplug multi-function PCI device now, so we should
          * reserve the whole slot. The function of the PCI device must be 0.
          */
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 6671eccf6f..38278b3c3d 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -673,7 +673,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
             return pciFlags;
         }
 
-        if (virDeviceInfoPCIAddressPresent(hostdev->info)) {
+        if (virDeviceInfoPCIAddressIsPresent(hostdev->info)) {
             /* A guest-side address has already been assigned, so
              * we can avoid reading the PCI config, and just use
              * pcieFlags, since the pciConnectFlags checking is
@@ -1260,7 +1260,7 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
     int ret = -1;
     virPCIDeviceAddressPtr addr = &info->addr.pci;
 
-    if (!virDeviceInfoPCIAddressPresent(info) ||
+    if (!virDeviceInfoPCIAddressIsPresent(info) ||
         ((device->type == VIR_DOMAIN_DEVICE_HOSTDEV) &&
          (device->data.hostdev->parent.type != VIR_DOMAIN_DEVICE_NONE))) {
         /* If a hostdev has a parent, its info will be a part of the
@@ -1458,7 +1458,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
         /* First IDE controller lives on the PIIX3 at slot=1, function=1 */
         if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
             cont->idx == 0) {
-            if (virDeviceInfoPCIAddressPresent(&cont->info)) {
+            if (virDeviceInfoPCIAddressIsPresent(&cont->info)) {
                 if (cont->info.addr.pci.domain != 0 ||
                     cont->info.addr.pci.bus != 0 ||
                     cont->info.addr.pci.slot != 1 ||
@@ -1478,7 +1478,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
                    cont->idx == 0 &&
                    (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI ||
                     cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT)) {
-            if (virDeviceInfoPCIAddressPresent(&cont->info)) {
+            if (virDeviceInfoPCIAddressIsPresent(&cont->info)) {
                 if (cont->info.addr.pci.domain != 0 ||
                     cont->info.addr.pci.bus != 0 ||
                     cont->info.addr.pci.slot != 1 ||
@@ -1526,7 +1526,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
          */
         virDomainVideoDefPtr primaryVideo = def->videos[0];
 
-        if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
+        if (virDeviceInfoPCIAddressIsWanted(&primaryVideo->info)) {
             memset(&tmp_addr, 0, sizeof(tmp_addr));
             tmp_addr.slot = 2;
 
@@ -1607,7 +1607,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
              * address.
              */
             if (cont->idx == 0) {
-                if (virDeviceInfoPCIAddressPresent(&cont->info)) {
+                if (virDeviceInfoPCIAddressIsPresent(&cont->info)) {
                     if (cont->info.addr.pci.domain != 0 ||
                         cont->info.addr.pci.bus != 0 ||
                         cont->info.addr.pci.slot != 0x1F ||
@@ -1715,7 +1715,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
          * on pc machinetypes).
          */
         virDomainVideoDefPtr primaryVideo = def->videos[0];
-        if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
+        if (virDeviceInfoPCIAddressIsWanted(&primaryVideo->info)) {
             memset(&tmp_addr, 0, sizeof(tmp_addr));
             tmp_addr.slot = 1;
 
@@ -1781,7 +1781,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
             virDomainSoundDefPtr sound = def->sounds[i];
 
             if (sound->model != VIR_DOMAIN_SOUND_MODEL_ICH9 ||
-                !virDeviceInfoPCIAddressWanted(&sound->info)) {
+                !virDeviceInfoPCIAddressIsWanted(&sound->info)) {
                 continue;
             }
             if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0)
@@ -1871,7 +1871,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 
             if (model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
                 model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT ||
-                !virDeviceInfoPCIAddressWanted(&cont->info))
+                !virDeviceInfoPCIAddressIsWanted(&cont->info))
                 continue;
 
             if (qemuDomainPCIAddressReserveNextAddr(addrs, &cont->info) < 0)
@@ -1880,7 +1880,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     }
 
     for (i = 0; i < def->nfss; i++) {
-        if (!virDeviceInfoPCIAddressWanted(&def->fss[i]->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&def->fss[i]->info))
             continue;
 
         /* Only support VirtIO-9p-pci so far. If that changes,
@@ -1898,7 +1898,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
          * instead of here.
          */
         if ((net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) ||
-            !virDeviceInfoPCIAddressWanted(&net->info)) {
+            !virDeviceInfoPCIAddressIsWanted(&net->info)) {
             continue;
         }
 
@@ -1910,7 +1910,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     for (i = 0; i < def->nsounds; i++) {
         virDomainSoundDefPtr sound = def->sounds[i];
 
-        if (!virDeviceInfoPCIAddressWanted(&sound->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&sound->info))
             continue;
 
         /* Skip ISA sound card, PCSPK and usb-audio */
@@ -1948,7 +1948,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             cont->idx == 0)
             continue;
 
-        if (!virDeviceInfoPCIAddressWanted(&cont->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&cont->info))
             continue;
 
         /* USB2 needs special handling to put all companions in the same slot */
@@ -1959,7 +1959,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             for (j = 0; j < def->ncontrollers; j++) {
                 if (IS_USB2_CONTROLLER(def->controllers[j]) &&
                     def->controllers[j]->idx == cont->idx &&
-                    virDeviceInfoPCIAddressPresent(&def->controllers[j]->info)) {
+                    virDeviceInfoPCIAddressIsPresent(&def->controllers[j]->info)) {
                     addr = def->controllers[j]->info.addr.pci;
                     foundAddr = true;
                     break;
@@ -2019,7 +2019,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             continue;
 
         /* don't touch s390 devices */
-        if (virDeviceInfoPCIAddressPresent(&def->disks[i]->info) ||
+        if (virDeviceInfoPCIAddressIsPresent(&def->disks[i]->info) ||
             def->disks[i]->info.type ==
             VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 ||
             def->disks[i]->info.type ==
@@ -2032,7 +2032,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO))
             continue;
 
-        if (!virDeviceInfoPCIAddressWanted(&def->disks[i]->info)) {
+        if (!virDeviceInfoPCIAddressIsWanted(&def->disks[i]->info)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("virtio disk cannot have an address of type '%s'"),
                            virDomainDeviceAddressTypeToString(def->disks[i]->info.type));
@@ -2046,7 +2046,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     /* Host PCI devices */
     for (i = 0; i < def->nhostdevs; i++) {
         virDomainHostdevSubsysPtr subsys = &def->hostdevs[i]->source.subsys;
-        if (!virDeviceInfoPCIAddressWanted(def->hostdevs[i]->info))
+        if (!virDeviceInfoPCIAddressIsWanted(def->hostdevs[i]->info))
             continue;
         if (def->hostdevs[i]->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
             continue;
@@ -2065,7 +2065,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     /* VirtIO balloon */
     if (def->memballoon &&
         def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
-        virDeviceInfoPCIAddressWanted(&def->memballoon->info)) {
+        virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) {
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs,
                                                 &def->memballoon->info) < 0)
@@ -2075,7 +2075,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     /* VirtIO RNG */
     for (i = 0; i < def->nrngs; i++) {
         if (def->rngs[i]->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
-            !virDeviceInfoPCIAddressWanted(&def->rngs[i]->info))
+            !virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
             continue;
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info) < 0)
@@ -2085,7 +2085,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     /* A watchdog - check if it is a PCI device */
     if (def->watchdog &&
         def->watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB &&
-        virDeviceInfoPCIAddressWanted(&def->watchdog->info)) {
+        virDeviceInfoPCIAddressIsWanted(&def->watchdog->info)) {
         if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->watchdog->info) < 0)
             goto error;
     }
@@ -2095,7 +2095,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
         if (def->videos[i]->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
             continue;
 
-        if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&def->videos[i]->info))
             continue;
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[i]->info) < 0)
@@ -2104,7 +2104,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 
     /* Shared Memory */
     for (i = 0; i < def->nshmems; i++) {
-        if (!virDeviceInfoPCIAddressWanted(&def->shmems[i]->info))
+        if (!virDeviceInfoPCIAddressIsWanted(&def->shmems[i]->info))
             continue;
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->shmems[i]->info) < 0)
@@ -2112,7 +2112,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     }
     for (i = 0; i < def->ninputs; i++) {
         if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO ||
-            !virDeviceInfoPCIAddressWanted(&def->inputs[i]->info))
+            !virDeviceInfoPCIAddressIsWanted(&def->inputs[i]->info))
             continue;
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->inputs[i]->info) < 0)
@@ -2125,7 +2125,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
         virDomainChrDefPtr chr = def->serials[i];
 
         if (chr->targetType != VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI ||
-            !virDeviceInfoPCIAddressWanted(&chr->info))
+            !virDeviceInfoPCIAddressIsWanted(&chr->info))
             continue;
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs, &chr->info) < 0)
@@ -2139,7 +2139,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
     }
 
     if (def->vsock &&
-        virDeviceInfoPCIAddressWanted(&def->vsock->info)) {
+        virDeviceInfoPCIAddressIsWanted(&def->vsock->info)) {
 
         if (qemuDomainPCIAddressReserveNextAddr(addrs,
                                                 &def->vsock->info) < 0)
@@ -2977,7 +2977,7 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
     if (!devstr)
         devstr = info->alias;
 
-    if (virDeviceInfoPCIAddressPresent(info))
+    if (virDeviceInfoPCIAddressIsPresent(info))
         virDomainPCIAddressReleaseAddr(priv->pciaddrs, &info->addr.pci);
 
     if (virDomainUSBAddressRelease(priv->usbaddrs, info) < 0)
-- 
2.17.1


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