[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: add named enum for timer mode.
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1328027679 0 # Node ID 759be09a0e385c60cdf43b0fe1cb6149661f430d # Parent 8eedc39f60e36779ad6885a7622bf16252113c39 libxl: add named enum for timer mode. Unlike previous iterations of this patch the enum values now match the underlying domctl values. I looked at updating xl.cfg(5) for these while I was here but frankly, even after reading the comment in xen/include/public/hvm/params.h, I don't have a clue what they mean, no_missed_ticks_pending in particular might as well be written in klingon... For the same reason I didn't try and give the enum more user-friendly names. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Tue Jan 31 16:34:39 2012 +0000 +++ b/tools/libxl/libxl.h Tue Jan 31 16:34:39 2012 +0000 @@ -203,6 +203,8 @@ typedef struct libxl__ctx libxl_ctx; +#define LIBXL_TIMER_MODE_DEFAULT LIBXL_TIMER_MODE_NO_DELAY_FOR_MISSED_TICKS + #include "_libxl_types.h" const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx); diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl_dom.c --- a/tools/libxl/libxl_dom.c Tue Jan 31 16:34:39 2012 +0000 +++ b/tools/libxl/libxl_dom.c Tue Jan 31 16:34:39 2012 +0000 @@ -251,6 +251,13 @@ return ret == 0 ? 0 : ERROR_FAIL; } +static unsigned long timer_mode(const libxl_domain_build_info *info) +{ + const libxl_timer_mode mode = info->u.hvm.timer_mode; + assert(mode != LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS && + mode <= LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING); + return ((unsigned long)mode); +} static int hvm_build_set_params(xc_interface *handle, uint32_t domid, libxl_domain_build_info *info, int store_evtchn, unsigned long *store_mfn, @@ -282,7 +289,7 @@ xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->u.hvm.viridian); xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) info->u.hvm.hpet); #endif - xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode); + xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, timer_mode(info)); xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align); xc_set_hvm_param(handle, domid, HVM_PARAM_NESTEDHVM, info->u.hvm.nested_hvm); xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn); diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Tue Jan 31 16:34:39 2012 +0000 +++ b/tools/libxl/libxl_types.idl Tue Jan 31 16:34:39 2012 +0000 @@ -91,6 +91,14 @@ (3, "native_paravirt"), ]) +# Consistent with the values defined for HVM_PARAM_TIMER_MODE. +libxl_timer_mode = Enumeration("timer_mode", [ + (0, "delay_for_missed_ticks"), + (1, "no_delay_for_missed_ticks"), + (2, "no_missed_ticks_pending"), + (3, "one_missed_tick_pending"), + ]) + # # Complex libxl types # @@ -229,7 +237,7 @@ ("timeoffset", string), ("hpet", bool), ("vpt_align", bool), - ("timer_mode", integer), + ("timer_mode", libxl_timer_mode), ("nested_hvm", bool), ("no_incr_generationid", bool), ("nographic", bool), diff -r 8eedc39f60e3 -r 759be09a0e38 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue Jan 31 16:34:39 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Tue Jan 31 16:34:39 2012 +0000 @@ -358,7 +358,9 @@ printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian); printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet); printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align); - printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode); + printf("\t\t\t(timer_mode %s)\n", + libxl_timer_mode_to_string(b_info->u.hvm.timer_mode)); + printf("\t\t\t(nestedhvm %d)\n", b_info->u.hvm.nested_hvm); printf("\t\t\t(no_incr_generationid %d)\n", b_info->u.hvm.no_incr_generationid); @@ -840,8 +842,30 @@ b_info->u.hvm.hpet = l; if (!xlu_cfg_get_long (config, "vpt_align", &l, 0)) b_info->u.hvm.vpt_align = l; - if (!xlu_cfg_get_long (config, "timer_mode", &l, 0)) + + if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) { + const char *s = libxl_timer_mode_to_string(l); + fprintf(stderr, "WARNING: specifying \"timer_mode\" as an integer is deprecated. " + "Please use the named parameter variant. %s%s%s\n", + s ? "e.g. timer_mode=\"" : "", + s ? s : "", + s ? "\"" : ""); + + if (l < LIBXL_TIMER_MODE_DELAY_FOR_MISSED_TICKS || + l > LIBXL_TIMER_MODE_ONE_MISSED_TICK_PENDING) { + fprintf(stderr, "ERROR: invalid value %ld for \"timer_mode\"\n", l); + exit (1); + } b_info->u.hvm.timer_mode = l; + } else if (!xlu_cfg_get_string(config, "timer_mode", &buf, 0)) { + fprintf(stderr, "got a timer mode string: \"%s\"\n", buf); + if (libxl_timer_mode_from_string(buf, &b_info->u.hvm.timer_mode)) { + fprintf(stderr, "ERROR: invalid value \"%s\" for \"timer_mode\"\n", + buf); + exit (1); + } + } + if (!xlu_cfg_get_long (config, "nestedhvm", &l, 0)) b_info->u.hvm.nested_hvm = l; break; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |