From: Boris Fiuczynski Date: Fri, 23 Oct 2020 17:31:49 +0000 (+0200) Subject: conf: node_device: refactor CSS formatting X-Git-Tag: v6.10.0-rc1~334 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d20735adf5de26f678a8b4e7608188e64858697f;p=thirdparty%2Flibvirt.git conf: node_device: refactor CSS formatting Move XML formatting code into a new method. Signed-off-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer Reviewed-by: Bjoern Walk Signed-off-by: Ján Tomko Reviewed-by: Ján Tomko --- diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index b2aa7771a0..fea70100a7 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -541,6 +541,20 @@ virNodeDeviceCapVDPADefFormat(virBufferPtr buf, virBufferEscapeString(buf, "%s\n", data->vdpa.chardev); } + +static void +virNodeDeviceCapCCWDefFormat(virBufferPtr buf, + const virNodeDevCapData *data) +{ + virBufferAsprintf(buf, "0x%x\n", + data->ccw_dev.cssid); + virBufferAsprintf(buf, "0x%x\n", + data->ccw_dev.ssid); + virBufferAsprintf(buf, "0x%04x\n", + data->ccw_dev.devno); +} + + char * virNodeDeviceDefFormat(const virNodeDeviceDef *def) { @@ -627,12 +641,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) break; case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_CSS_DEV: - virBufferAsprintf(&buf, "0x%x\n", - data->ccw_dev.cssid); - virBufferAsprintf(&buf, "0x%x\n", - data->ccw_dev.ssid); - virBufferAsprintf(&buf, "0x%04x\n", - data->ccw_dev.devno); + virNodeDeviceCapCCWDefFormat(&buf, data); break; case VIR_NODE_DEV_CAP_VDPA: virNodeDeviceCapVDPADefFormat(&buf, data);