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

Jiri Denemark jdenemar at redhat.com
Fri Apr 9 14:40:59 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). I don't particularily
like introducing a new header file but non of existing header files looked
like a good place to stick this macro in. If you think such a place exist,
I'll be very happy to adapt the patch.

The second patch changes all API calls introduced since the last 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.
But even if my thinking is correct, we don't want to change it before 0.8.0.

Jirka

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

 src/Makefile.am                |    3 +-
 src/esx/esx_driver.c           |   44 ++++++++++++-------------
 src/nwfilter/nwfilter_driver.c |    5 ++-
 src/qemu/qemu_driver.c         |   69 +++++++++++++++++++---------------------
 src/storage/storage_driver.c   |    7 +---
 src/util/checks.h              |   37 +++++++++++++++++++++
 src/vbox/vbox_tmpl.c           |   42 +++++++++++++++++-------
 src/xen/xend_internal.c        |    5 +++
 8 files changed, 133 insertions(+), 79 deletions(-)
 create mode 100644 src/util/checks.h




More information about the libvir-list mailing list