Re: [PATCH 06/20] util: reject unknown flags

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

 



On Wed, Jul 06, 2011 at 05:23:49PM -0600, Eric Blake wrote:
> * 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/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,

  Hummm, shouldn't we forbid ATTRIBUTE_UNUSED from .h forward
declarations and keep them only in the actual implementation block.
I don't think it's a good idea to expos this to the compiler who might
make an optimization there seeing it in the .h while the equivalent
implementation may have removed it.

  ACK, the main danger of that patch is using virCheckFlags(0, -1)
systematically while the routine may use a different convention, I
didn't checked this (I'm lazy :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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