Move XML formating code into a new method. Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> Reviewed-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxx> --- src/conf/node_device_conf.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 6fd5b1b038..ebabf20b67 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -533,6 +533,20 @@ virNodeDeviceCapMdevDefFormat(virBufferPtr buf, } } + +static void +virNodeDeviceCapCCWDefFormat(virBufferPtr buf, + const virNodeDevCapData *data) +{ + virBufferAsprintf(buf, "<cssid>0x%x</cssid>\n", + data->ccw_dev.cssid); + virBufferAsprintf(buf, "<ssid>0x%x</ssid>\n", + data->ccw_dev.ssid); + virBufferAsprintf(buf, "<devno>0x%04x</devno>\n", + data->ccw_dev.devno); +} + + char * virNodeDeviceDefFormat(const virNodeDeviceDef *def) { @@ -619,12 +633,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) break; case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_CSS_DEV: - virBufferAsprintf(&buf, "<cssid>0x%x</cssid>\n", - data->ccw_dev.cssid); - virBufferAsprintf(&buf, "<ssid>0x%x</ssid>\n", - data->ccw_dev.ssid); - virBufferAsprintf(&buf, "<devno>0x%04x</devno>\n", - data->ccw_dev.devno); + virNodeDeviceCapCCWDefFormat(&buf, data); break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: -- 2.25.1