提交 d3f7c7b1 编写于 作者: L Laine Stump

conf: fix domain parse flags

* 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.
上级 3ab1776b
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册