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