[PATCH 03/10] conf: fix domain parse flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Change all flags args from int to unsigned int

* Allow passing flags in virDomainObjParseFile (and propogate those
  flags all the way down the call chain). Previously the flags were
  hardcoded (to VIR_DOMAIN_XML_INTERNAL_STATUS) several layers down
  the chain. Pass that value in at the one place that is currently
  calling virDomainObjParseFile.
---
 src/conf/domain_conf.c |   30 +++++++++++++++++-------------
 src/conf/domain_conf.h |   13 +++++++------
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 109a947..772422d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5160,7 +5160,7 @@ error:
 virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
                                               const virDomainDefPtr def,
                                               const char *xmlStr,
-                                              int flags)
+                                              unsigned int flags)
 {
     xmlDocPtr xml;
     xmlNodePtr node;
@@ -6703,7 +6703,8 @@ no_memory:
 
 static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps,
                                             xmlDocPtr xml,
-                                            xmlXPathContextPtr ctxt)
+                                            xmlXPathContextPtr ctxt,
+                                            unsigned int flags)
 {
     char *tmp = NULL;
     long val;
@@ -6726,8 +6727,7 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps,
 
     oldnode = ctxt->node;
     ctxt->node = config;
-    obj->def = virDomainDefParseXML(caps, xml, config, ctxt,
-                                    VIR_DOMAIN_XML_INTERNAL_STATUS);
+    obj->def = virDomainDefParseXML(caps, xml, config, ctxt, flags);
     ctxt->node = oldnode;
     if (!obj->def)
         goto error;
@@ -6816,14 +6816,14 @@ virDomainDefParse(const char *xmlStr,
 
 virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
                                         const char *xmlStr,
-                                        int flags)
+                                        unsigned int flags)
 {
     return virDomainDefParse(xmlStr, NULL, caps, flags);
 }
 
 virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
                                       const char *filename,
-                                      int flags)
+                                      unsigned int flags)
 {
     return virDomainDefParse(NULL, filename, caps, flags);
 }
@@ -6832,7 +6832,7 @@ virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
 virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
                                       xmlDocPtr xml,
                                       xmlNodePtr root,
-                                      int flags)
+                                      unsigned int flags)
 {
     xmlXPathContextPtr ctxt = NULL;
     virDomainDefPtr def = NULL;
@@ -6861,7 +6861,8 @@ cleanup:
 static virDomainObjPtr
 virDomainObjParseNode(virCapsPtr caps,
                       xmlDocPtr xml,
-                      xmlNodePtr root)
+                      xmlNodePtr root,
+                      unsigned int flags)
 {
     xmlXPathContextPtr ctxt = NULL;
     virDomainObjPtr obj = NULL;
@@ -6879,7 +6880,7 @@ virDomainObjParseNode(virCapsPtr caps,
     }
 
     ctxt->node = root;
-    obj = virDomainObjParseXML(caps, xml, ctxt);
+    obj = virDomainObjParseXML(caps, xml, ctxt, flags);
 
 cleanup:
     xmlXPathFreeContext(ctxt);
@@ -6888,13 +6889,15 @@ cleanup:
 
 
 virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
-                                      const char *filename)
+                                      const char *filename,
+                                      unsigned int flags)
 {
     xmlDocPtr xml;
     virDomainObjPtr obj = NULL;
 
     if ((xml = virXMLParseFile(filename))) {
-        obj = virDomainObjParseNode(caps, xml, xmlDocGetRootElement(xml));
+        obj = virDomainObjParseNode(caps, xml,
+                                    xmlDocGetRootElement(xml), flags);
         xmlFreeDoc(xml);
     }
 
@@ -9500,7 +9503,7 @@ virDomainHostdevDefFormat(virBufferPtr buf,
 
 
 char *virDomainDefFormat(virDomainDefPtr def,
-                         int flags)
+                         unsigned int flags)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     unsigned char *uuid;
@@ -10138,7 +10141,8 @@ static virDomainObjPtr virDomainLoadStatus(virCapsPtr caps,
     if ((statusFile = virDomainConfigFile(statusDir, name)) == NULL)
         goto error;
 
-    if (!(obj = virDomainObjParseFile(caps, statusFile)))
+    if (!(obj = virDomainObjParseFile(caps, statusFile,
+                                      VIR_DOMAIN_XML_INTERNAL_STATUS)))
         goto error;
 
     virUUIDFormat(obj->def->uuid, uuidstr);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 258289a..9d28f51 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1378,20 +1378,21 @@ void virDomainRemoveInactive(virDomainObjListPtr doms,
 virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
                                               const virDomainDefPtr def,
                                               const char *xmlStr,
-                                              int flags);
+                                              unsigned int flags);
 virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
                                         const char *xmlStr,
-                                        int flags);
+                                        unsigned int flags);
 virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
                                       const char *filename,
-                                      int flags);
+                                      unsigned int flags);
 virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
                                       xmlDocPtr doc,
                                       xmlNodePtr root,
-                                      int flags);
+                                      unsigned int flags);
 
 virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
-                                      const char *filename);
+                                      const char *filename,
+                                      unsigned int flags);
 
 bool virDomainDefCheckABIStability(virDomainDefPtr src,
                                    virDomainDefPtr dst);
@@ -1399,7 +1400,7 @@ bool virDomainDefCheckABIStability(virDomainDefPtr src,
 int virDomainDefAddImplicitControllers(virDomainDefPtr def);
 
 char *virDomainDefFormat(virDomainDefPtr def,
-                         int flags);
+                         unsigned int flags);
 
 int virDomainCpuSetParse(const char **str,
                          char sep,
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]