[libvirt] [PATCH v2 0/2] Enhance checking of supported flags in drivers

Jiri Denemark jdenemar at redhat.com
Tue Apr 13 16:25:53 UTC 2010


I think we need a simple and consistent way of checking whether flags passed
to API entry points in drivers are valid/supported or not. So far some entry
points don't check flags at all and some checks for 0 when no flags are
expected/supported.

The first patch introduces a macro which can be called with a whitelist of
supported flags (more info about it inside the patch). The second patch changes
all API calls introduced in 0.8.0 release to use the macro for checking valid
flags.

I'm not sure if we can change existing API calls to do the same as it could
break some badly written apps which pass invalid flags. My opinion is that we
may often do that as such apps don't use the API in a documented/valid way.

Changes in v2:
- virCheckFlags moved from checks.h to existing internal.h

Jirka

Jiri Denemark (2):
  Introduce virCheckFlags for consistent flags checking
  Use virCheckFlags for APIs added in 0.8.0

 src/esx/esx_driver.c           |   43 ++++++++++++-------------
 src/internal.h                 |   23 +++++++++++++
 src/nwfilter/nwfilter_driver.c |    4 ++-
 src/qemu/qemu_driver.c         |   68 +++++++++++++++++++---------------------
 src/storage/storage_driver.c   |    6 +---
 src/vbox/vbox_tmpl.c           |   41 ++++++++++++++++-------
 src/xen/xend_internal.c        |    4 ++
 7 files changed, 111 insertions(+), 78 deletions(-)




More information about the libvir-list mailing list