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

[libvirt] [PATCHv2 17/27] vmware: reject unknown flags



* src/vmware/vmware_driver.c (vmwareOpen, vmwareDomainReboot)
(vmwareDomainCreateXML, vmwareDomainCreateWithFlags): Reject
unknown flags.
---
 src/vmware/vmware_driver.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 3f0cfae..55694ef 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -74,11 +74,13 @@ vmwareDataFreeFunc(void *data)
 static virDrvOpenStatus
 vmwareOpen(virConnectPtr conn,
            virConnectAuthPtr auth ATTRIBUTE_UNUSED,
-           unsigned int flags ATTRIBUTE_UNUSED)
+           unsigned int flags)
 {
     struct vmware_driver *driver;
     char * vmrun = NULL;

+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
     if (conn->uri == NULL) {
         /* @TODO accept */
         return VIR_DRV_OPEN_DECLINED;
@@ -446,11 +448,10 @@ vmwareDomainResume(virDomainPtr dom)
 }

 static int
-vmwareDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
+vmwareDomainReboot(virDomainPtr dom, unsigned int flags)
 {
     struct vmware_driver *driver = dom->conn->privateData;
     const char * vmxPath = NULL;
-
     virDomainObjPtr vm;
     const char *cmd[] = {
         VMRUN, "-T", PROGRAM_SENTINAL,
@@ -458,6 +459,8 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
     };
     int ret = -1;

+    virCheckFlags(0, -1);
+
     vmwareDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     vmwareDriverUnlock(driver);
@@ -492,7 +495,7 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)

 static virDomainPtr
 vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
-                      unsigned int flags ATTRIBUTE_UNUSED)
+                      unsigned int flags)
 {
     struct vmware_driver *driver = conn->privateData;
     virDomainDefPtr vmdef = NULL;
@@ -503,6 +506,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
     vmwareDomainPtr pDomain = NULL;
     virVMXContext ctx;

+    virCheckFlags(0, NULL);
+
     ctx.formatFileName = vmwareCopyVMXFileName;

     vmwareDriverLock(driver);
@@ -562,12 +567,14 @@ cleanup:

 static int
 vmwareDomainCreateWithFlags(virDomainPtr dom,
-                            unsigned int flags ATTRIBUTE_UNUSED)
+                            unsigned int flags)
 {
     struct vmware_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;

+    virCheckFlags(0, -1);
+
     vmwareDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     if (!vm) {
-- 
1.7.4.4


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