[PATCH 4/8] nodedev: refactor CCW state format for use in ccwgroup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Refactor to allow reuse in ccwgroup.

Reviewed-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
---
 src/conf/node_device_conf.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 433334511f..bfd81b1692 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -659,6 +659,17 @@ virNodeDeviceCapCSSDefFormat(virBuffer *buf,
 }
 
 
+static void
+virNodeDeviceCapCCWStateTypeFormat(virBuffer *buf,
+                                   const virNodeDevCCWStateType state_type)
+{
+    if (state_type != VIR_NODE_DEV_CCW_STATE_LAST) {
+        const char *state = virNodeDevCCWStateTypeToString(state_type);
+        virBufferEscapeString(buf, "<state>%s</state>\n", state);
+    }
+}
+
+
 char *
 virNodeDeviceDefFormat(const virNodeDeviceDef *def, unsigned int flags)
 {
@@ -746,10 +757,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def, unsigned int flags)
             virNodeDeviceCapMdevDefFormat(&buf, data, inactive_state);
             break;
         case VIR_NODE_DEV_CAP_CCW_DEV:
-            if (data->ccw_dev.state != VIR_NODE_DEV_CCW_STATE_LAST) {
-                const char *state = virNodeDevCCWStateTypeToString(data->ccw_dev.state);
-                virBufferEscapeString(&buf, "<state>%s</state>\n", state);
-            }
+            virNodeDeviceCapCCWStateTypeFormat(&buf, data->ccw_dev.state);
             virCCWDeviceAddressFormat(&buf, data->ccw_dev.dev_addr);
             break;
         case VIR_NODE_DEV_CAP_CSS_DEV:
-- 
2.47.0



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux