[PATCH 18/20] vmware: reject unknown flags

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

 



* 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..11dc504 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(0, 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

--
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]