[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: add libxl_domain_build_info_init_type
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330604775 0 # Node ID 8dcccb97371f266174a91434264f3643d6ffde0e # Parent 8e0512bc1b474709ed3cc8961f3d17590f7f8d8d libxl: add libxl_domain_build_info_init_type Use instead of parameterising libxl_domain_build_info_init. This allows callers to initialise a libxl_domain_build_info but not to commit to a particular type later on (e.g. after they've parsed the domain config) Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r 8e0512bc1b47 -r 8dcccb97371f tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/libxl.h Thu Mar 01 12:26:15 2012 +0000 @@ -382,8 +382,9 @@ /* domain related functions */ void libxl_domain_create_info_init(libxl_domain_create_info *c_info); -void libxl_domain_build_info_init(libxl_domain_build_info *b_info, - const libxl_domain_create_info *c_info); +void libxl_domain_build_info_init(libxl_domain_build_info *b_info); +void libxl_domain_build_info_init_type(libxl_domain_build_info *b_info, + libxl_domain_type type); typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv); int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid); int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd); diff -r 8e0512bc1b47 -r 8dcccb97371f tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/libxl_create.c Thu Mar 01 12:26:15 2012 +0000 @@ -69,23 +69,29 @@ return 0; } -void libxl_domain_build_info_init(libxl_domain_build_info *b_info, - const libxl_domain_create_info *c_info) +void libxl_domain_build_info_init(libxl_domain_build_info *b_info) { memset(b_info, '\0', sizeof(*b_info)); - b_info->type = c_info->type; + b_info->type = -1; b_info->max_memkb = LIBXL_MEMKB_DEFAULT; b_info->target_memkb = LIBXL_MEMKB_DEFAULT; b_info->shadow_memkb = LIBXL_MEMKB_DEFAULT; b_info->video_memkb = LIBXL_MEMKB_DEFAULT; +} + +void libxl_domain_build_info_init_type(libxl_domain_build_info *b_info, + libxl_domain_type type) +{ + assert(b_info->type == -1); + b_info->type = type; switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: b_info->u.hvm.timer_mode = LIBXL_TIMER_MODE_DEFAULT; break; case LIBXL_DOMAIN_TYPE_PV: - b_info->u.pv.slack_memkb = 0; + b_info->u.pv.slack_memkb = LIBXL_MEMKB_DEFAULT; break; default: abort(); diff -r 8e0512bc1b47 -r 8dcccb97371f tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/libxl_dm.c Thu Mar 01 12:26:15 2012 +0000 @@ -701,7 +701,8 @@ libxl_uuid_generate(&dm_config.c_info.uuid); - libxl_domain_build_info_init(&dm_config.b_info, &dm_config.c_info); + libxl_domain_build_info_init(&dm_config.b_info); + libxl_domain_build_info_init_type(&dm_config.b_info, LIBXL_DOMAIN_TYPE_PV); dm_config.b_info.max_vcpus = 1; dm_config.b_info.max_memkb = 32 * 1024; diff -r 8e0512bc1b47 -r 8dcccb97371f tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 01 12:26:15 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 01 12:26:15 2012 +0000 @@ -582,7 +582,8 @@ exit(1); } - libxl_domain_build_info_init(b_info, c_info); + libxl_domain_build_info_init(b_info); + libxl_domain_build_info_init_type(b_info, c_info->type); /* the following is the actual config parsing with overriding values in the structures */ if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) { @@ -699,7 +700,7 @@ if (!xlu_cfg_get_long (config, "videoram", &l, 0)) b_info->video_memkb = l * 1024; - switch(c_info->type) { + switch(b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: if (!xlu_cfg_get_string (config, "kernel", &buf, 0)) fprintf(stderr, "WARNING: ignoring \"kernel\" directive for HVM guest. " _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |