[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: make boolean members of libxl_domain_create_info into libxl_defbool
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330604774 0 # Node ID 5c9077a5722c4edf87b298dcd192632f031200ae # Parent 2aae04f3240cfc43ab31073ac6f5a4f2a702b80c 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 2aae04f3240c -r 5c9077a5722c tools/libxl/gentest.py --- a/tools/libxl/gentest.py Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/gentest.py Thu Mar 01 12:26:14 2012 +0000 @@ -20,8 +20,7 @@ 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 2aae04f3240c -r 5c9077a5722c tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/libxl_create.c Thu Mar 01 12:26:14 2012 +0000 @@ -53,8 +53,6 @@ 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 @@ 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 @@ 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 @@ 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 2aae04f3240c -r 5c9077a5722c tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/libxl_types.idl Thu Mar 01 12:26:14 2012 +0000 @@ -211,8 +211,8 @@ 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 2aae04f3240c -r 5c9077a5722c tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 01 12:26:14 2012 +0000 @@ -555,8 +555,7 @@ !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 @@ 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 2aae04f3240c -r 5c9077a5722c tools/libxl/xl_sxp.c --- a/tools/libxl/xl_sxp.c Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/xl_sxp.c Thu Mar 01 12:26:14 2012 +0000 @@ -41,8 +41,8 @@ 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-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |