Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
libxkutil/xmlgen.c | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 6b07b00..dbf60bd 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1295,20 +1295,42 @@ static const char *input_xml(xmlNodePtr root, struct domain
*dominfo)
{
int i;
+ CU_DEBUG("Enter input_xml()");
+
for (i = 0; i < dominfo->dev_input_ct; i++) {
- xmlNodePtr tmp;
struct virt_device *_dev = &dominfo->dev_input[i];
if (_dev->type == CIM_RES_TYPE_UNKNOWN)
continue;
struct input_device *dev = &_dev->dev.input;
- tmp = xmlNewChild(root, NULL, BAD_CAST "input", NULL);
- if (tmp == NULL)
+ dev->others = add_node_to_others(dev->others,
+ "input",
+ NULL,
+ TYPE_NODE,
+ "devices");
+
+ if (dev->others == NULL) {
+ CU_DEBUG("add node <input> failed.");
return XML_ERROR;
+ }
- xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type);
- xmlNewProp(tmp, BAD_CAST "bus", BAD_CAST dev->bus);
+ dev->others = add_node_to_others(dev->others,
+ "type",
+ dev->type,
+ TYPE_PROP,
+ "input");
+
+ dev->others = add_node_to_others(dev->others,
+ "bus",
+ dev->bus,
+ TYPE_PROP,
+ "input");
+
+ dev->others = others_to_xml(root, dev->others,
"devices");
+ if (dev->others) {
+ CU_DEBUG("others_to_xml failed.");
+ }
}
return NULL;
--
1.7.1