On Wed, Mar 29, 2017 at 14:51:13 +0200, Erik Skultety wrote:
Make the code look cleaner by moving the capability specific bits
into
separate functions.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/conf/node_device_conf.c | 578 ++++++++++++++++++++++++--------------------
1 file changed, 322 insertions(+), 256 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 7d0baa9d1a..72fb9a5611 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -155,6 +155,320 @@ virPCIEDeviceInfoFormat(virBufferPtr buf,
}
+static void
+virNodeDeviceCapSystemDefFormat(virBufferPtr buf,
+ const virNodeDevCapData *data)
+{
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ if (data->system.product_name)
+ virBufferEscapeString(buf, "<product>%s</product>\n",
+ data->system.product_name);
+ virBufferAddLit(buf, "<hardware>\n");
+ virBufferAdjustIndent(buf, 2);
+ if (data->system.hardware.vendor_name)
+ virBufferEscapeString(buf, "<vendor>%s</vendor>\n",
+ data->system.hardware.vendor_name);
+ if (data->system.hardware.version)
+ virBufferEscapeString(buf, "<version>%s</version>\n",
+ data->system.hardware.version);
virBufferEscapeString automatically skips formatting of the whole string
if the argument is NULL. So the condition is not necessary.