[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/6] xl: Implement XENMEM_claim_pages support via 'claim_mode' global config
On Fri, Apr 12, 2013 at 03:51:04PM -0400, Konrad Rzeszutek Wilk wrote: > > Of these I prefer 1. Opinions ? Whatever we do needs to be in 4.3. > > There is also option 5. Define a new macro: > > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > index 4922313..4a6ee76 100644 > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -359,6 +359,11 @@ typedef struct { > int val; > } libxl_defbool; > > +#define DEFINE_BOOL(name, _val) \ > + libxl_defbool name = { .val = _val } > +#define DEFINE_FALSE_BOOL(name) DEFINE_BOOL(name, LIBXL__DEFBOOL_FALSE) > +#define DEFINE_TRUE_BOOL(name) DEFINE_BOOL(name, LIBXL__DEFBOOL_TRUE) > + > void libxl_defbool_set(libxl_defbool *db, bool b); > /* Resets to default */ > void libxl_defbool_unset(libxl_defbool *db); > > > And use DEFINE_FALSE_BOOL(claim_mode) in the xl.h file. > Correction (But now that I look at it, it is not that much nicer as you end up with LIBXL__DEFBOOL in the header file. <sigh> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 03a9782..436b60c 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -222,10 +222,6 @@ void libxl_key_value_list_dispose(libxl_key_value_list *pkvl) free(kvl); } -#define LIBXL__DEFBOOL_DEFAULT (0) -#define LIBXL__DEFBOOL_FALSE (-1) -#define LIBXL__DEFBOOL_TRUE (1) - void libxl_defbool_set(libxl_defbool *db, bool b) { db->val = b ? LIBXL__DEFBOOL_TRUE : LIBXL__DEFBOOL_FALSE; diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 4922313..308a315 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -359,6 +359,15 @@ typedef struct { int val; } libxl_defbool; +#define LIBXL__DEFBOOL_DEFAULT (0) +#define LIBXL__DEFBOOL_FALSE (-1) +#define LIBXL__DEFBOOL_TRUE (1) + +#define DEFINE_BOOL(name, _val) \ + libxl_defbool name = { .val = _val } +#define DEFINE_FALSE_BOOL(name) DEFINE_BOOL(name, LIBXL__DEFBOOL_FALSE) +#define DEFINE_TRUE_BOOL(name) DEFINE_BOOL(name, LIBXL__DEFBOOL_TRUE) + void libxl_defbool_set(libxl_defbool *db, bool b); /* Resets to default */ void libxl_defbool_unset(libxl_defbool *db); diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c index 3c141bf..4b42b87 100644 --- a/tools/libxl/xl.c +++ b/tools/libxl/xl.c @@ -46,7 +46,7 @@ char *default_vifscript = NULL; char *default_bridge = NULL; char *default_gatewaydev = NULL; enum output_format default_output_format = OUTPUT_FORMAT_JSON; -libxl_defbool claim_mode; +DEFINE_FALSE_BOOL(claim_mode); static xentoollog_level minmsglevel = XTL_PROGRESS; @@ -170,7 +170,6 @@ static void parse_global_config(const char *configfile, if (!xlu_cfg_get_string (config, "blkdev_start", &buf, 0)) blkdev_start = strdup(buf); - libxl_defbool_setdefault(&claim_mode, false); (void)xlu_cfg_get_defbool (config, "claim_mode", &claim_mode, 0); xlu_cfg_destroy(config); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |