[Libvirt-cim] [PATCH 09/47] Fix xml parsing algorithm for parse_emu_device()

Xu Wang gesaint at linux.vnet.ibm.com
Tue Oct 8 06:13:43 UTC 2013


Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>
---
 libxkutil/device_parsing.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index 2b3ca81..a6857a2 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1055,15 +1055,27 @@ static int parse_emu_device(xmlNode *node, struct virt_device **vdevs)
         struct virt_device *vdev = NULL;
         struct emu_device *edev = NULL;
 
+        CU_DEBUG("Enter parse_emu_device().");
+
         vdev = calloc(1, sizeof(*vdev));
-        if (vdev == NULL)
+        if (vdev == NULL) {
+                CU_DEBUG("calloc failed.");
                 goto err;
+        }
 
         edev = &(vdev->dev.emu);
 
-        edev->path = get_node_content(node);
-        if (edev->path == NULL)
+        edev->others = parse_data_to_others(node, BAD_CAST "devices");
+
+        edev->path = fetch_from_others(&edev->others,
+                                       (char *)node->name,
+                                       TYPE_NODE,
+                                       "devices");
+
+        if (edev->path == NULL) {
+                CU_DEBUG("no path");
                 goto err;
+        }
 
         vdev->type = CIM_RES_TYPE_EMU;
 
-- 
1.7.1




More information about the Libvirt-cim mailing list