[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 17 of 27 V4] libxl: make boolean members of libxl_domain_create_info into libxl_defbool
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330533036 0 # Node ID 865634b37f7020ad943fb63e1c57ea3f666a7d52 # Parent 023e6c3f206511f46ef9582aa245b92bf27ed390 libxl: make boolean members of libxl_domain_create_info into libxl_defbool This allows them to be set via the _init/_setdefault methods. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> diff -r 023e6c3f2065 -r 865634b37f70 tools/libxl/gentest.py --- a/tools/libxl/gentest.py Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/gentest.py Wed Feb 29 16:30:36 2012 +0000 @@ -20,8 +20,7 @@ def randomize_case(s): def randomize_enum(e): return random.choice([v.name for v in e.values]) -handcoded = ["libxl_defbool", # Temp until a user appears in the next patch - "libxl_cpumap", "libxl_key_value_list", +handcoded = ["libxl_cpumap", "libxl_key_value_list", "libxl_cpuid_policy_list", "libxl_file_reference", "libxl_string_list"] diff -r 023e6c3f2065 -r 865634b37f70 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_create.c Wed Feb 29 16:30:36 2012 +0000 @@ -53,8 +53,6 @@ void libxl_domain_config_dispose(libxl_d void libxl_domain_create_info_init(libxl_domain_create_info *c_info) { memset(c_info, '\0', sizeof(*c_info)); - c_info->hap = 1; - c_info->oos = 1; } int libxl__domain_create_info_setdefault(libxl__gc *gc, @@ -63,6 +61,11 @@ int libxl__domain_create_info_setdefault if (!c_info->type) return ERROR_INVAL; + if (c_info->type == LIBXL_DOMAIN_TYPE_HVM) { + libxl_defbool_setdefault(&c_info->hap, true); + libxl_defbool_setdefault(&c_info->oos, true); + } + return 0; } @@ -366,8 +369,8 @@ int libxl__domain_make(libxl__gc *gc, li flags = 0; if (info->type == LIBXL_DOMAIN_TYPE_HVM) { flags |= XEN_DOMCTL_CDF_hvm_guest; - flags |= info->hap ? XEN_DOMCTL_CDF_hap : 0; - flags |= info->oos ? 0 : XEN_DOMCTL_CDF_oos_off; + flags |= libxl_defbool_val(info->hap) ? XEN_DOMCTL_CDF_hap : 0; + flags |= libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off; } *domid = -1; @@ -519,6 +522,9 @@ static int do_domain_create(libxl__gc *g ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info); if (ret) goto error_out; + ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info); + if (ret) goto error_out; + ret = libxl__domain_make(gc, &d_config->c_info, &domid); if (ret) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot make domain: %d", ret); diff -r 023e6c3f2065 -r 865634b37f70 tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_types.idl Wed Feb 29 16:30:36 2012 +0000 @@ -211,8 +211,8 @@ libxl_version_info = Struct("version_inf libxl_domain_create_info = Struct("domain_create_info",[ ("type", libxl_domain_type), - ("hap", bool), - ("oos", bool), + ("hap", libxl_defbool), + ("oos", libxl_defbool), ("ssidref", uint32), ("name", string), ("uuid", libxl_uuid), diff -r 023e6c3f2065 -r 865634b37f70 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Wed Feb 29 16:30:36 2012 +0000 @@ -555,8 +555,7 @@ static void parse_config_data(const char !strncmp(buf, "hvm", strlen(buf))) c_info->type = LIBXL_DOMAIN_TYPE_HVM; - if (!xlu_cfg_get_long (config, "hap", &l, 0)) - c_info->hap = l; + xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0); if (xlu_cfg_replace_string (config, "name", &c_info->name, 0)) { fprintf(stderr, "Domain name must be specified.\n"); @@ -572,8 +571,7 @@ static void parse_config_data(const char libxl_uuid_generate(&c_info->uuid); } - if (!xlu_cfg_get_long(config, "oos", &l, 0)) - c_info->oos = l; + xlu_cfg_get_defbool(config, "oos", &c_info->oos, 0); if (!xlu_cfg_get_string (config, "pool", &buf, 0)) { c_info->poolid = -1; diff -r 023e6c3f2065 -r 865634b37f70 tools/libxl/xl_sxp.c --- a/tools/libxl/xl_sxp.c Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/xl_sxp.c Wed Feb 29 16:30:36 2012 +0000 @@ -41,8 +41,8 @@ void printf_info_sexp(int domid, libxl_d printf("(domain\n\t(domid %d)\n", domid); printf("\t(create_info)\n"); printf("\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM); - printf("\t(hap %d)\n", c_info->hap); - printf("\t(oos %d)\n", c_info->oos); + printf("\t(hap %s)\n", libxl_defbool_to_string(c_info->hap)); + printf("\t(oos %s)\n", libxl_defbool_to_string(c_info->oos)); printf("\t(ssidref %d)\n", c_info->ssidref); printf("\t(name %s)\n", c_info->name); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |