* src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Drop unused attribute. * src/interface/netcf_driver.c (interfaceOpenInterface) (interfaceDefineXML, interfaceCreate, interfaceDestroy): Reject unknown flags. * src/network/bridge_driver.c (networkOpenNetwork) (networkGetXMLDesc): Likewise. * src/nwfilter/nwfilter_driver.c (nwfilterOpen): Likewise. * src/secret/secret_driver.c (secretOpen, secretDefineXML) (secretGetXMLDesc, secretSetValue): Likewise. * src/util/logging.c (virLogDefineFilter, virLogDefineOutput): Likewise. --- src/interface/netcf_driver.c | 16 ++++++++++++---- src/network/bridge_driver.c | 9 +++++++-- src/nodeinfo.h | 6 +++--- src/nwfilter/nwfilter_driver.c | 4 +++- src/secret/secret_driver.c | 17 +++++++++++++---- src/util/logging.c | 10 ++++++++-- 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c index 8900722..8e78211 100644 --- a/src/interface/netcf_driver.c +++ b/src/interface/netcf_driver.c @@ -121,10 +121,12 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf, virInterfac static virDrvOpenStatus interfaceOpenInterface(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { struct interface_driver *driverState; + virCheckFlags(0, VIR_DRV_OPEN_ERROR); + if (VIR_ALLOC(driverState) < 0) { virReportOOMError(); @@ -387,7 +389,7 @@ cleanup: static virInterfacePtr interfaceDefineXML(virConnectPtr conn, const char *xml, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { struct interface_driver *driver = conn->interfacePrivateData; struct netcf_if *iface = NULL; @@ -395,6 +397,8 @@ static virInterfacePtr interfaceDefineXML(virConnectPtr conn, virInterfaceDefPtr ifacedef = NULL; virInterfacePtr ret = NULL; + virCheckFlags(0, NULL); + interfaceDriverLock(driver); ifacedef = virInterfaceDefParseString(xml); @@ -461,12 +465,14 @@ cleanup: } static int interfaceCreate(virInterfacePtr ifinfo, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { struct interface_driver *driver = ifinfo->conn->interfacePrivateData; struct netcf_if *iface = NULL; int ret = -1; + virCheckFlags(0, -1); + interfaceDriverLock(driver); iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo); @@ -493,12 +499,14 @@ cleanup: } static int interfaceDestroy(virInterfacePtr ifinfo, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { struct interface_driver *driver = ifinfo->conn->interfacePrivateData; struct netcf_if *iface = NULL; int ret = -1; + virCheckFlags(0, -1); + interfaceDriverLock(driver); iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo); diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 554a8ac..895700c 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2010,7 +2010,10 @@ cleanup: static virDrvOpenStatus networkOpenNetwork(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ + virCheckFlags(0, VIR_DRV_OPEN_ERROR); + if (!driverState) return VIR_DRV_OPEN_DECLINED; @@ -2416,12 +2419,14 @@ cleanup: } static char *networkGetXMLDesc(virNetworkPtr net, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { struct network_driver *driver = net->conn->networkPrivateData; virNetworkObjPtr network; char *ret = NULL; + virCheckFlags(0, NULL); + networkDriverLock(driver); network = virNetworkFindByUUID(&driver->networks, net->uuid); networkDriverUnlock(driver); diff --git a/src/nodeinfo.h b/src/nodeinfo.h index 9b2658f..e5ac1e0 100644 --- a/src/nodeinfo.h +++ b/src/nodeinfo.h @@ -1,7 +1,7 @@ /* * nodeinfo.c: Helper routines for OS specific node information * - * Copyright (C) 2006-2008 Red Hat, Inc. + * Copyright (C) 2006-2008, 2011 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -34,12 +34,12 @@ int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED, int cpuNum, virNodeCPUStatsPtr params, int *nparams, - unsigned int flags ATTRIBUTE_UNUSED); + unsigned int flags); int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, int cellNum, virNodeMemoryStatsPtr params, int *nparams, - unsigned int flags ATTRIBUTE_UNUSED); + unsigned int flags); int nodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems, int startCell, diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index bfe7f2f..7988944 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -272,8 +272,10 @@ cleanup: static virDrvOpenStatus nwfilterOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { + virCheckFlags(0, VIR_DRV_OPEN_ERROR); + if (!driverState) return VIR_DRV_OPEN_DECLINED; diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 552b7e4..7751924 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -525,7 +525,10 @@ cleanup: static virDrvOpenStatus secretOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags ATTRIBUTE_UNUSED) { + unsigned int flags) +{ + virCheckFlags(0, VIR_DRV_OPEN_ERROR); + if (driverState == NULL) return VIR_DRV_OPEN_DECLINED; @@ -667,7 +670,7 @@ cleanup: static virSecretPtr secretDefineXML(virConnectPtr conn, const char *xml, - unsigned int flags ATTRIBUTE_UNUSED) + unsigned int flags) { virSecretDriverStatePtr driver = conn->secretPrivateData; virSecretPtr ret = NULL; @@ -675,6 +678,8 @@ secretDefineXML(virConnectPtr conn, const char *xml, virSecretDefPtr backup = NULL; virSecretDefPtr new_attrs; + virCheckFlags(0, NULL); + new_attrs = virSecretDefParseString(xml); if (new_attrs == NULL) return NULL; @@ -778,12 +783,14 @@ cleanup: } static char * -secretGetXMLDesc(virSecretPtr obj, unsigned int flags ATTRIBUTE_UNUSED) +secretGetXMLDesc(virSecretPtr obj, unsigned int flags) { virSecretDriverStatePtr driver = obj->conn->secretPrivateData; char *ret = NULL; virSecretEntryPtr secret; + virCheckFlags(0, NULL); + secretDriverLock(driver); secret = secretFindByUUID(driver, obj->uuid); @@ -805,7 +812,7 @@ cleanup: static int secretSetValue(virSecretPtr obj, const unsigned char *value, - size_t value_size, unsigned int flags ATTRIBUTE_UNUSED) + size_t value_size, unsigned int flags) { virSecretDriverStatePtr driver = obj->conn->secretPrivateData; int ret = -1; @@ -813,6 +820,8 @@ secretSetValue(virSecretPtr obj, const unsigned char *value, size_t old_value_size; virSecretEntryPtr secret; + virCheckFlags(0, -1); + if (VIR_ALLOC_N(new_value, value_size) < 0) { virReportOOMError(); return -1; diff --git a/src/util/logging.c b/src/util/logging.c index c86fcda..4cc8e93 100644 --- a/src/util/logging.c +++ b/src/util/logging.c @@ -481,10 +481,13 @@ static int virLogResetFilters(void) { * Returns -1 in case of failure or the filter number if successful */ int virLogDefineFilter(const char *match, int priority, - int flags ATTRIBUTE_UNUSED) { + int flags) +{ int i; char *mdup = NULL; + virCheckFlags(0, -1); + if ((match == NULL) || (priority < VIR_LOG_DEBUG) || (priority > VIR_LOG_ERROR)) return -1; @@ -579,10 +582,13 @@ static int virLogResetOutputs(void) { */ int virLogDefineOutput(virLogOutputFunc f, virLogCloseFunc c, void *data, int priority, int dest, const char *name, - int flags ATTRIBUTE_UNUSED) { + int flags) +{ int ret = -1; char *ndup = NULL; + virCheckFlags(0, -1); + if (f == NULL) return -1; -- 1.7.4.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list