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

[libvirt] [PATCHv2 09/27] libxl: reject unknown flags



* src/libxl/libxl_driver.c (libxlOpen, libxlDomainReboot)
(libxlDomainXMLFromNative, libxlDomainXMLToNative)
(libxlDomainCreateWithFlags): Reject unknown flags.
---
 src/libxl/libxl_driver.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 586d562..57497cb 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1059,8 +1059,10 @@ libxlActive(void)
 static virDrvOpenStatus
 libxlOpen(virConnectPtr conn,
           virConnectAuthPtr auth ATTRIBUTE_UNUSED,
-          unsigned int flags ATTRIBUTE_UNUSED)
+          unsigned int flags)
 {
+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
     if (conn->uri == NULL) {
         if (libxl_driver == NULL)
             return VIR_DRV_OPEN_DECLINED;
@@ -1477,13 +1479,15 @@ cleanup:
 }

 static int
-libxlDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
+libxlDomainReboot(virDomainPtr dom, unsigned int flags)
 {
     libxlDriverPrivatePtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;
     libxlDomainObjPrivatePtr priv;

+    virCheckFlags(0, -1);
+
     libxlDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     if (!vm) {
@@ -2506,7 +2510,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
 static char *
 libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
                          const char * nativeConfig,
-                         unsigned int flags ATTRIBUTE_UNUSED)
+                         unsigned int flags)
 {
     libxlDriverPrivatePtr driver = conn->privateData;
     const libxl_version_info *ver_info;
@@ -2514,6 +2518,8 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
     virConfPtr conf = NULL;
     char *xml = NULL;

+    virCheckFlags(0, NULL);
+
     if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
         libxlError(VIR_ERR_INVALID_ARG,
                    _("unsupported config type %s"), nativeFormat);
@@ -2546,7 +2552,7 @@ cleanup:
 static char *
 libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
                        const char * domainXml,
-                       unsigned int flags ATTRIBUTE_UNUSED)
+                       unsigned int flags)
 {
     libxlDriverPrivatePtr driver = conn->privateData;
     const libxl_version_info *ver_info;
@@ -2555,6 +2561,8 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
     int len = MAX_CONFIG_SIZE;
     char *ret = NULL;

+    virCheckFlags(0, NULL);
+
     if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
         libxlError(VIR_ERR_INVALID_ARG,
                    _("unsupported config type %s"), nativeFormat);
@@ -2617,7 +2625,7 @@ libxlNumDefinedDomains(virConnectPtr conn)

 static int
 libxlDomainCreateWithFlags(virDomainPtr dom,
-                           unsigned int flags ATTRIBUTE_UNUSED)
+                           unsigned int flags)
 {
     libxlDriverPrivatePtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
-- 
1.7.4.4


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