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