From: Boris Fiuczynski Date: Tue, 4 Feb 2025 17:11:39 +0000 (+0100) Subject: nodedev: refactor CCW state format for use in ccwgroup X-Git-Tag: v11.1.0-rc1~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=20560cb6c4873cafe4f0cbd46b7d8f7e1533c4ea;p=thirdparty%2Flibvirt.git nodedev: refactor CCW state format for use in ccwgroup Refactor to allow reuse in ccwgroup. Reviewed-by: Marc Hartmayer Signed-off-by: Boris Fiuczynski Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik --- diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 433334511f..5024379c4d 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -659,6 +659,18 @@ 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, "%s\n", state); + } +} + + char * virNodeDeviceDefFormat(const virNodeDeviceDef *def, unsigned int flags) { @@ -746,10 +758,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, "%s\n", state); - } + virNodeDeviceCapCCWStateTypeFormat(&buf, data->ccw_dev.state); virCCWDeviceAddressFormat(&buf, data->ccw_dev.dev_addr); break; case VIR_NODE_DEV_CAP_CSS_DEV: