[Libvirt-cim] [PATCH 17/47] Fix xml parsing algorithm in parse_feature()

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


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

diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index 3412b5b..e0d11e4 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1833,17 +1833,29 @@ static int parse_os(struct domain *dominfo)
         return 1;
 }
 
-static int parse_features(struct domain *dominfo, xmlNode *features)
+static int parse_features(struct domain *dominfo)
 {
-        xmlNode *child;
+        CU_DEBUG("Enter parse_features()");
+
+        if (seek_in_others(&dominfo->others,
+                           "acpi",
+                           TYPE_NODE,
+                           "features")) {
+                dominfo->acpi = true;
+        }
 
-        for (child = features->children; child != NULL; child = child->next) {
-                if (XSTREQ(child->name, "acpi"))
-                        dominfo->acpi = true;
-                else if (XSTREQ(child->name, "apic"))
-                        dominfo->apic = true;
-                else if (XSTREQ(child->name, "pae"))
-                        dominfo->pae = true;
+        if (seek_in_others(&dominfo->others,
+                           "apic",
+                           TYPE_NODE,
+                           "features")) {
+                dominfo->apic = true;
+        }
+
+        if (seek_in_others(&dominfo->others,
+                           "pae",
+                           TYPE_NODE,
+                           "features")) {
+                dominfo->pae = true;
         }
 
         return 1;
@@ -1977,7 +1989,7 @@ static int parse_domain(xmlNodeSet *nsv, struct domain *dominfo)
                            "features",
                            TYPE_NODE,
                            (char *)nodes[0]->name)) {
-                /* parse_features(); */
+                parse_features(dominfo);
         }
 
         return 1;
-- 
1.7.1




More information about the Libvirt-cim mailing list