* src/qemu/qemu_driver.c (qemudOpen, qemuDomainScreenshot)
(qemuDomainXMLFromNative, qemuDomainXMLToNative)
(qemudDomainBlockPeek, qemuCPUCompare, qemuCPUBaseline): Reject
unknown flags.
* src/qemu/qemu_migration.c (qemuMigrationConfirm): Likewise.
(_qemuMigrationCookie, qemuMigrationCookieXMLParse)
(qemuMigrationCookieXMLParseStr, qemuMigrationBakeCookie)
(qemuMigrationEatCookie): Make flags unsigned.
---
src/qemu/qemu_driver.c | 30 +++++++++++++++++++++++-------
src/qemu/qemu_migration.c | 16 +++++++++-------
2 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4f12beb..a2fe4b8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -800,8 +800,10 @@ static int qemuDomainSnapshotSetCurrentInactive(virDomainObjPtr vm,
static virDrvOpenStatus qemudOpen(virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
+ virCheckFlags(0, VIR_DRV_OPEN_ERROR);
+
if (conn->uri == NULL) {
if (qemu_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
@@ -2686,7 +2688,7 @@ static char *
qemuDomainScreenshot(virDomainPtr dom,
virStreamPtr st,
unsigned int screen,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
@@ -2695,6 +2697,8 @@ qemuDomainScreenshot(virDomainPtr dom,
int tmp_fd = -1;
char *ret = NULL;
+ virCheckFlags(0, NULL);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
@@ -3881,11 +3885,14 @@ cleanup:
static char *qemuDomainXMLFromNative(virConnectPtr conn,
const char *format,
const char *config,
- unsigned int flags ATTRIBUTE_UNUSED) {
+ unsigned int flags)
+{
struct qemud_driver *driver = conn->privateData;
virDomainDefPtr def = NULL;
char *xml = NULL;
+ virCheckFlags(0, NULL);
+
if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
qemuReportError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), format);
@@ -3908,7 +3915,8 @@ cleanup:
static char *qemuDomainXMLToNative(virConnectPtr conn,
const char *format,
const char *xmlData,
- unsigned int flags ATTRIBUTE_UNUSED) {
+ unsigned int flags)
+{
struct qemud_driver *driver = conn->privateData;
virDomainDefPtr def = NULL;
virDomainChrSourceDef monConfig;
@@ -3917,6 +3925,8 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
char *ret = NULL;
int i;
+ virCheckFlags(0, NULL);
+
qemuDriverLock(driver);
if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
@@ -6164,12 +6174,14 @@ qemudDomainBlockPeek (virDomainPtr dom,
const char *path,
unsigned long long offset, size_t size,
void *buffer,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
int fd = -1, ret = -1, i;
+ virCheckFlags(0, -1);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
@@ -7240,11 +7252,13 @@ out:
static int
qemuCPUCompare(virConnectPtr conn,
const char *xmlDesc,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
struct qemud_driver *driver = conn->privateData;
int ret = VIR_CPU_COMPARE_ERROR;
+ virCheckFlags(0, VIR_CPU_COMPARE_ERROR);
+
qemuDriverLock(driver);
if (!driver->caps || !driver->caps->host.cpu) {
@@ -7264,10 +7278,12 @@ static char *
qemuCPUBaseline(virConnectPtr conn ATTRIBUTE_UNUSED,
const char **xmlCPUs,
unsigned int ncpus,
- unsigned int flags ATTRIBUTE_UNUSED)
+ unsigned int flags)
{
char *cpu;
+ virCheckFlags(0, NULL);
+
cpu = cpuBaselineXML(xmlCPUs, ncpus, NULL, 0);
return cpu;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d7b27a0..a01cbd1 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -76,8 +76,8 @@ struct _qemuMigrationCookieGraphics {
typedef struct _qemuMigrationCookie qemuMigrationCookie;
typedef qemuMigrationCookie *qemuMigrationCookiePtr;
struct _qemuMigrationCookie {
- int flags;
- int flagsMandatory;
+ unsigned int flags;
+ unsigned int flagsMandatory;
/* Host properties */
unsigned char localHostuuid[VIR_UUID_BUFLEN];
@@ -446,7 +446,7 @@ error:
static int
qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
xmlXPathContextPtr ctxt,
- int flags)
+ unsigned int flags)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
char *tmp;
@@ -580,7 +580,7 @@ error:
static int
qemuMigrationCookieXMLParseStr(qemuMigrationCookiePtr mig,
const char *xml,
- int flags)
+ unsigned int flags)
{
xmlDocPtr doc = NULL;
xmlXPathContextPtr ctxt = NULL;
@@ -614,7 +614,7 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
virDomainObjPtr dom,
char **cookieout,
int *cookieoutlen,
- int flags)
+ unsigned int flags)
{
if (!cookieout || !cookieoutlen)
return 0;
@@ -645,7 +645,7 @@ qemuMigrationEatCookie(struct qemud_driver *driver,
virDomainObjPtr dom,
const char *cookiein,
int cookieinlen,
- int flags)
+ unsigned int flags)
{
qemuMigrationCookiePtr mig = NULL;
@@ -2605,7 +2605,7 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
virDomainObjPtr vm,
const char *cookiein,
int cookieinlen,
- unsigned int flags ATTRIBUTE_UNUSED,
+ unsigned int flags,
int retcode)
{
qemuMigrationCookiePtr mig;
@@ -2616,6 +2616,8 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
driver, conn, vm, NULLSTR(cookiein), cookieinlen,
flags, retcode);
+ virCheckFlags(0, -1);
+
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0)))
return -1;
--
1.7.4.4