|
|
3a9410 |
From 71f605aed8cb1f27eef21953005b3251e41e1925 Mon Sep 17 00:00:00 2001
|
|
|
3a9410 |
Message-Id: <71f605aed8cb1f27eef21953005b3251e41e1925@dist-git>
|
|
|
3a9410 |
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
3a9410 |
Date: Fri, 13 May 2022 12:31:07 +0200
|
|
|
3a9410 |
Subject: [PATCH] util: refactor virDomainDeviceCCWAddressEqual into virccw
|
|
|
3a9410 |
|
|
|
3a9410 |
Refactor virDomainDeviceCCWAddressEqual into virccw and rename method as
|
|
|
3a9410 |
virCCWDeviceAddressEqual.
|
|
|
3a9410 |
|
|
|
3a9410 |
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
3a9410 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3a9410 |
(cherry picked from commit 784b87603517bd920910ccfb69daae8980a21d8d)
|
|
|
3a9410 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
|
|
3a9410 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
3a9410 |
---
|
|
|
3a9410 |
src/conf/device_conf.c | 12 ------------
|
|
|
3a9410 |
src/conf/device_conf.h | 2 --
|
|
|
3a9410 |
src/conf/domain_conf.c | 8 ++++----
|
|
|
3a9410 |
src/libvirt_private.syms | 2 +-
|
|
|
3a9410 |
src/util/virccw.c | 12 ++++++++++++
|
|
|
3a9410 |
src/util/virccw.h | 2 ++
|
|
|
3a9410 |
6 files changed, 19 insertions(+), 19 deletions(-)
|
|
|
3a9410 |
|
|
|
3a9410 |
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
|
|
3a9410 |
index 2385e81994..958e2f43cc 100644
|
|
|
3a9410 |
--- a/src/conf/device_conf.c
|
|
|
3a9410 |
+++ b/src/conf/device_conf.c
|
|
|
3a9410 |
@@ -298,18 +298,6 @@ virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
|
|
3a9410 |
return 0;
|
|
|
3a9410 |
}
|
|
|
3a9410 |
|
|
|
3a9410 |
-bool
|
|
|
3a9410 |
-virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
|
|
3a9410 |
- virCCWDeviceAddress *addr2)
|
|
|
3a9410 |
-{
|
|
|
3a9410 |
- if (addr1->cssid == addr2->cssid &&
|
|
|
3a9410 |
- addr1->ssid == addr2->ssid &&
|
|
|
3a9410 |
- addr1->devno == addr2->devno) {
|
|
|
3a9410 |
- return true;
|
|
|
3a9410 |
- }
|
|
|
3a9410 |
- return false;
|
|
|
3a9410 |
-}
|
|
|
3a9410 |
-
|
|
|
3a9410 |
int
|
|
|
3a9410 |
virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
|
|
3a9410 |
virDomainDeviceDriveAddress *addr)
|
|
|
3a9410 |
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
|
|
3a9410 |
index 0ed6991c23..01e2edccc9 100644
|
|
|
3a9410 |
--- a/src/conf/device_conf.h
|
|
|
3a9410 |
+++ b/src/conf/device_conf.h
|
|
|
3a9410 |
@@ -195,8 +195,6 @@ void virPCIDeviceAddressFormat(virBuffer *buf,
|
|
|
3a9410 |
|
|
|
3a9410 |
int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
|
|
3a9410 |
virCCWDeviceAddress *addr);
|
|
|
3a9410 |
-bool virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
|
|
3a9410 |
- virCCWDeviceAddress *addr2);
|
|
|
3a9410 |
|
|
|
3a9410 |
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
|
|
3a9410 |
virDomainDeviceDriveAddress *addr);
|
|
|
3a9410 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
3a9410 |
index 17383fc878..1e1c7f01b1 100644
|
|
|
3a9410 |
--- a/src/conf/domain_conf.c
|
|
|
3a9410 |
+++ b/src/conf/domain_conf.c
|
|
|
3a9410 |
@@ -15566,7 +15566,7 @@ virDomainDiskIndexByAddress(virDomainDef *def,
|
|
|
3a9410 |
return i;
|
|
|
3a9410 |
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
|
|
3a9410 |
ccw_addr &&
|
|
|
3a9410 |
- virDomainDeviceCCWAddressEqual(&vdisk->info.addr.ccw, ccw_addr)) {
|
|
|
3a9410 |
+ virCCWDeviceAddressEqual(&vdisk->info.addr.ccw, ccw_addr)) {
|
|
|
3a9410 |
return i;
|
|
|
3a9410 |
}
|
|
|
3a9410 |
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
|
|
3a9410 |
@@ -15755,8 +15755,8 @@ virDomainNetFindIdx(virDomainDef *def, virDomainNetDef *net)
|
|
|
3a9410 |
continue;
|
|
|
3a9410 |
|
|
|
3a9410 |
if (CCWAddrSpecified &&
|
|
|
3a9410 |
- !virDomainDeviceCCWAddressEqual(&def->nets[i]->info.addr.ccw,
|
|
|
3a9410 |
- &net->info.addr.ccw))
|
|
|
3a9410 |
+ !virCCWDeviceAddressEqual(&def->nets[i]->info.addr.ccw,
|
|
|
3a9410 |
+ &net->info.addr.ccw))
|
|
|
3a9410 |
continue;
|
|
|
3a9410 |
|
|
|
3a9410 |
if (net->info.alias && def->nets[i]->info.alias &&
|
|
|
3a9410 |
@@ -16192,7 +16192,7 @@ virDomainControllerFindByCCWAddress(virDomainDef *def,
|
|
|
3a9410 |
virDomainDeviceInfo *info = &def->controllers[i]->info;
|
|
|
3a9410 |
|
|
|
3a9410 |
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
|
|
3a9410 |
- virDomainDeviceCCWAddressEqual(&info->addr.ccw, addr))
|
|
|
3a9410 |
+ virCCWDeviceAddressEqual(&info->addr.ccw, addr))
|
|
|
3a9410 |
return i;
|
|
|
3a9410 |
}
|
|
|
3a9410 |
|
|
|
3a9410 |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
|
3a9410 |
index 9ed367d427..0d3ee4c20a 100644
|
|
|
3a9410 |
--- a/src/libvirt_private.syms
|
|
|
3a9410 |
+++ b/src/libvirt_private.syms
|
|
|
3a9410 |
@@ -131,7 +131,6 @@ virDeviceInfoPCIAddressIsWanted;
|
|
|
3a9410 |
virDomainDeviceAddressIsValid;
|
|
|
3a9410 |
virDomainDeviceAddressTypeToString;
|
|
|
3a9410 |
virDomainDeviceCcidAddressParseXML;
|
|
|
3a9410 |
-virDomainDeviceCCWAddressEqual;
|
|
|
3a9410 |
virDomainDeviceCCWAddressParseXML;
|
|
|
3a9410 |
virDomainDeviceDriveAddressParseXML;
|
|
|
3a9410 |
virDomainDeviceInfoAddressIsEqual;
|
|
|
3a9410 |
@@ -1902,6 +1901,7 @@ virBufferVasprintf;
|
|
|
3a9410 |
|
|
|
3a9410 |
# util/virccw.h
|
|
|
3a9410 |
virCCWDeviceAddressAsString;
|
|
|
3a9410 |
+virCCWDeviceAddressEqual;
|
|
|
3a9410 |
virCCWDeviceAddressIncrement;
|
|
|
3a9410 |
virCCWDeviceAddressIsValid;
|
|
|
3a9410 |
|
|
|
3a9410 |
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
|
|
3a9410 |
index c3dfda2613..e2785bd9ab 100644
|
|
|
3a9410 |
--- a/src/util/virccw.c
|
|
|
3a9410 |
+++ b/src/util/virccw.c
|
|
|
3a9410 |
@@ -30,6 +30,18 @@ virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr)
|
|
|
3a9410 |
addr->devno <= VIR_CCW_DEVICE_MAX_DEVNO;
|
|
|
3a9410 |
}
|
|
|
3a9410 |
|
|
|
3a9410 |
+bool
|
|
|
3a9410 |
+virCCWDeviceAddressEqual(virCCWDeviceAddress *addr1,
|
|
|
3a9410 |
+ virCCWDeviceAddress *addr2)
|
|
|
3a9410 |
+{
|
|
|
3a9410 |
+ if (addr1->cssid == addr2->cssid &&
|
|
|
3a9410 |
+ addr1->ssid == addr2->ssid &&
|
|
|
3a9410 |
+ addr1->devno == addr2->devno) {
|
|
|
3a9410 |
+ return true;
|
|
|
3a9410 |
+ }
|
|
|
3a9410 |
+ return false;
|
|
|
3a9410 |
+}
|
|
|
3a9410 |
+
|
|
|
3a9410 |
char*
|
|
|
3a9410 |
virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
|
|
3a9410 |
{
|
|
|
3a9410 |
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
|
|
3a9410 |
index c4daaff7b3..aebbd4ab6d 100644
|
|
|
3a9410 |
--- a/src/util/virccw.h
|
|
|
3a9410 |
+++ b/src/util/virccw.h
|
|
|
3a9410 |
@@ -36,6 +36,8 @@ struct _virCCWDeviceAddress {
|
|
|
3a9410 |
};
|
|
|
3a9410 |
|
|
|
3a9410 |
bool virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr);
|
|
|
3a9410 |
+bool virCCWDeviceAddressEqual(virCCWDeviceAddress *addr1,
|
|
|
3a9410 |
+ virCCWDeviceAddress *addr2);
|
|
|
3a9410 |
|
|
|
3a9410 |
char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
|
|
3a9410 |
ATTRIBUTE_NONNULL(1);
|
|
|
3a9410 |
--
|
|
|
3a9410 |
2.39.1
|
|
|
3a9410 |
|