]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodedev: refactor css format from ccw format method
authorBoris Fiuczynski <fiuczy@linux.ibm.com>
Fri, 13 May 2022 10:31:11 +0000 (12:31 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 23 May 2022 14:32:03 +0000 (16:32 +0200)
In preparation for easier extension later.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/node_device_conf.c

index 67c8c4a3fdce3958053da23ad17b85a432861303..97779078e8f18035429b1066d7dfe4d2399a6a42 100644 (file)
@@ -634,10 +634,21 @@ virNodeDeviceCapCCWDefFormat(virBuffer *buf,
                       data->ccw_dev.ssid);
     virBufferAsprintf(buf, "<devno>0x%04x</devno>\n",
                       data->ccw_dev.devno);
-    if (data->ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
+}
+
+
+static void
+virNodeDeviceCapCSSDefFormat(virBuffer *buf,
+                             const virNodeDevCapData *data)
+{
+    virNodeDevCapCCW ccw_dev = data->ccw_dev;
+
+    virNodeDeviceCapCCWDefFormat(buf, data);
+
+    if (ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
         virNodeDeviceCapMdevTypesFormat(buf,
-                                        data->ccw_dev.mdev_types,
-                                        data->ccw_dev.nmdev_types);
+                                        ccw_dev.mdev_types,
+                                        ccw_dev.nmdev_types);
 }
 
 
@@ -726,9 +737,11 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
             virNodeDeviceCapMdevDefFormat(&buf, data);
             break;
         case VIR_NODE_DEV_CAP_CCW_DEV:
-        case VIR_NODE_DEV_CAP_CSS_DEV:
             virNodeDeviceCapCCWDefFormat(&buf, data);
             break;
+        case VIR_NODE_DEV_CAP_CSS_DEV:
+            virNodeDeviceCapCSSDefFormat(&buf, data);
+            break;
         case VIR_NODE_DEV_CAP_VDPA:
             virNodeDeviceCapVDPADefFormat(&buf, data);
             break;