render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
3a9410
From d370e2e984b4501060ea0d7a10629db0bfe51ef2 Mon Sep 17 00:00:00 2001
3a9410
Message-Id: <d370e2e984b4501060ea0d7a10629db0bfe51ef2@dist-git>
3a9410
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
3a9410
Date: Fri, 13 May 2022 12:31:11 +0200
3a9410
Subject: [PATCH] nodedev: refactor css format from ccw format method
3a9410
3a9410
In preparation for easier extension later.
3a9410
3a9410
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
3a9410
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3a9410
(cherry picked from commit c5864885060b136214b4bcef25d604cc3d147014)
3a9410
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
3a9410
Signed-off-by: Thomas Huth <thuth@redhat.com>
3a9410
---
3a9410
 src/conf/node_device_conf.c | 21 +++++++++++++++++----
3a9410
 1 file changed, 17 insertions(+), 4 deletions(-)
3a9410
3a9410
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
3a9410
index a6ebf4b66f..1e00f65717 100644
3a9410
--- a/src/conf/node_device_conf.c
3a9410
+++ b/src/conf/node_device_conf.c
3a9410
@@ -632,10 +632,21 @@ virNodeDeviceCapCCWDefFormat(virBuffer *buf,
3a9410
                       data->ccw_dev.ssid);
3a9410
     virBufferAsprintf(buf, "<devno>0x%04x</devno>\n",
3a9410
                       data->ccw_dev.devno);
3a9410
-    if (data->ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
3a9410
+}
3a9410
+
3a9410
+
3a9410
+static void
3a9410
+virNodeDeviceCapCSSDefFormat(virBuffer *buf,
3a9410
+                             const virNodeDevCapData *data)
3a9410
+{
3a9410
+    virNodeDevCapCCW ccw_dev = data->ccw_dev;
3a9410
+
3a9410
+    virNodeDeviceCapCCWDefFormat(buf, data);
3a9410
+
3a9410
+    if (ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
3a9410
         virNodeDeviceCapMdevTypesFormat(buf,
3a9410
-                                        data->ccw_dev.mdev_types,
3a9410
-                                        data->ccw_dev.nmdev_types);
3a9410
+                                        ccw_dev.mdev_types,
3a9410
+                                        ccw_dev.nmdev_types);
3a9410
 }
3a9410
 
3a9410
 
3a9410
@@ -724,9 +735,11 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
3a9410
             virNodeDeviceCapMdevDefFormat(&buf, data);
3a9410
             break;
3a9410
         case VIR_NODE_DEV_CAP_CCW_DEV:
3a9410
-        case VIR_NODE_DEV_CAP_CSS_DEV:
3a9410
             virNodeDeviceCapCCWDefFormat(&buf, data);
3a9410
             break;
3a9410
+        case VIR_NODE_DEV_CAP_CSS_DEV:
3a9410
+            virNodeDeviceCapCSSDefFormat(&buf, data);
3a9410
+            break;
3a9410
         case VIR_NODE_DEV_CAP_VDPA:
3a9410
             virNodeDeviceCapVDPADefFormat(&buf, data);
3a9410
             break;
3a9410
-- 
3a9410
2.39.1
3a9410