[libvirt] [PATCHv2 12/27] phyp: reject unknown flags

Eric Blake eblake at redhat.com
Fri Jul 8 19:25:54 UTC 2011


* src/phyp/phyp_driver.c (phypOpen, phypDomainReboot)
(phypVIOSDriverOpen): Reject unknown flags.
---
 src/phyp/phyp_driver.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index d1ab5b4..dd5ab85 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1128,7 +1128,7 @@ exit:

 static virDrvOpenStatus
 phypOpen(virConnectPtr conn,
-         virConnectAuthPtr auth, unsigned int flags ATTRIBUTE_UNUSED)
+         virConnectAuthPtr auth, unsigned int flags)
 {
     LIBSSH2_SESSION *session = NULL;
     ConnectionData *connection_data = NULL;
@@ -1138,6 +1138,8 @@ phypOpen(virConnectPtr conn,
     char *char_ptr;
     char *managed_system = NULL;

+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
     if (!conn || !conn->uri)
         return VIR_DRV_OPEN_DECLINED;

@@ -3389,7 +3391,7 @@ cleanup:
 }

 static int
-phypDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
+phypDomainReboot(virDomainPtr dom, unsigned int flags)
 {
     int result = -1;
     ConnectionData *connection_data = dom->conn->networkPrivateData;
@@ -3402,6 +3404,8 @@ phypDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
     char *ret = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;

+    virCheckFlags(0, -1);
+
     virBufferAddLit(&buf, "chsysstate");
     if (system_type == HMC)
         virBufferAsprintf(&buf, " -m %s", managed_system);
@@ -3725,8 +3729,10 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
 static virDrvOpenStatus
 phypVIOSDriverOpen(virConnectPtr conn,
                    virConnectAuthPtr auth ATTRIBUTE_UNUSED,
-                   unsigned int flags ATTRIBUTE_UNUSED)
+                   unsigned int flags)
 {
+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
     if (conn->driver->no != VIR_DRV_PHYP)
         return VIR_DRV_OPEN_DECLINED;

-- 
1.7.4.4




More information about the libvir-list mailing list