From 79f4c4e694c36e81b585047767d981fdf79c5870 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 25 Aug 2014 12:58:49 -0600 Subject: [PATCH] domain_conf: fix internal flag verification While working on virDomainBlockCopy, I noticed we had a verify() concerning internal XML flags that was incomplete after several recent flag additions; move that up higher in the code to make it harder to forget to modify on the next flag addition. Adjust some formatting while at it. * src/conf/domain_conf.c (verify): Move closer to internal flag definitions. Cover missing flags ALLOW_ROM and ALLOW_BOOT. Signed-off-by: Eric Blake --- src/conf/domain_conf.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dd512cafbf..3b295ab3f9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -89,19 +89,33 @@ struct _virDomainXMLOption { /* Private flags used internally by virDomainSaveStatus and - * virDomainLoadStatus. */ + * virDomainLoadStatus, in addition to the public virDomainXMLFlags. */ typedef enum { /* dump internal domain status information */ - VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16), + VIR_DOMAIN_XML_INTERNAL_STATUS = 1 << 16, /* dump/parse element */ - VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET = (1<<17), + VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET = 1 << 17, /* dump/parse original states of host PCI device */ - VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES = (1<<18), - VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM = (1<<19), - VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT = (1<<20), - VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST = (1<<21), + VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES = 1 << 18, + VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM = 1 << 19, + VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT = 1 << 20, + VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST = 1 << 21, } virDomainXMLInternalFlags; +#define DUMPXML_FLAGS \ + (VIR_DOMAIN_XML_SECURE | \ + VIR_DOMAIN_XML_INACTIVE | \ + VIR_DOMAIN_XML_UPDATE_CPU | \ + VIR_DOMAIN_XML_MIGRATABLE) + +verify(((VIR_DOMAIN_XML_INTERNAL_STATUS | + VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET | + VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES | + VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM | + VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT | + VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST) + & DUMPXML_FLAGS) == 0); + VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST, "custom-argv", "custom-monitor", @@ -10359,7 +10373,7 @@ virDomainDeviceDefParse(const char *xmlStr, } /* callback to fill driver specific device aspects */ - if (virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0) + if (virDomainDeviceDefPostParse(dev, def, caps, xmlopt) < 0) goto error; cleanup: @@ -17726,18 +17740,6 @@ virDomainHugepagesFormat(virBufferPtr buf, } -#define DUMPXML_FLAGS \ - (VIR_DOMAIN_XML_SECURE | \ - VIR_DOMAIN_XML_INACTIVE | \ - VIR_DOMAIN_XML_UPDATE_CPU | \ - VIR_DOMAIN_XML_MIGRATABLE) - -verify(((VIR_DOMAIN_XML_INTERNAL_STATUS | - VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET | - VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES | - VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST) - & DUMPXML_FLAGS) == 0); - static bool virDomainDefHasCapabilitiesFeatures(virDomainDefPtr def) { -- GitLab