[libvirt] [PATCHv3 6/6] build: add syntax check for proper flags use

Matthias Bolte matthias.bolte at googlemail.com
Fri Jul 15 15:52:41 UTC 2011


2011/7/15 Eric Blake <eblake at redhat.com>:
> Enforce the recent flags cleanups - we want to use 'unsigned int flags'
> in any of our APIs (except where backwards compatibility is important,
> in the public migration APIs), and that all flags are checked for
> validity (except when there are stub functions that completely
> ignore the flags argument).
>
> There are a few minor tweaks done here to avoid false positives:
> signed arguments passed to open() are renamed oflags, and flags
> arguments that are legitimately ignored are renamed flags_unused.
>
> * cfg.mk (sc_flags_usage): New rule.
> (exclude_file_name_regexp--sc_flags_usage): And a few exemptions.
> (sc_flags_debug): Tweak wording.
> * src/util/iohelper.c (runIO, main): Rename variable.
> * src/util/util.c (virSetInherit): Likewise.
> * src/fdstream.h (virFDStreamOpenFile, virFDStreamCreateFile):
> Likewise.
> * src/fdstream.c (virFDStreamOpenFileInternal)
> (virFDStreamOpenFile, virFDStreamCreateFile): Likewise.
> * src/util/command.c (virExecWithHook) [WIN32]: Likewise.
> * src/util/util.c (virFileOpenAs, virDirCreate) [WIN32]: Likewise.
> * src/locking/lock_manager.c (virLockManagerPluginNew)
> [!HAVE_DLFCN_H]: Likewise.
> * src/locking/lock_driver_nop.c (virLockManagerNopNew)
> (virLockManagerNopAddResource, virLockManagerNopAcquire)
> (virLockManagerNopRelease, virLockManagerNopInquire): Likewise.
> ---
>
> v3: minor tweaks to make syntax check rules catch a few more cases
>
>  cfg.mk                        |   30 ++++++++++++++++++++++++++----
>  src/fdstream.c                |   28 ++++++++++++++--------------
>  src/fdstream.h                |    6 +++---
>  src/locking/lock_driver_nop.c |   10 +++++-----
>  src/locking/lock_manager.c    |    7 ++++---
>  src/util/command.c            |    2 +-
>  src/util/iohelper.c           |   18 +++++++++---------
>  src/util/util.c               |   14 +++++++-------
>  8 files changed, 69 insertions(+), 46 deletions(-)

ACK.

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list