[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 10 of 23] libxl: vfb/vkb: use _init/_setdefault
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1329148132 0 # Node ID a72b3dca661fd1a0b40d8252d56017355afe3b38 # Parent 69c16a2a8927d81acc0cf0e127a5a4b7a9a1a886 libxl: vfb/vkb: use _init/_setdefault Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r 69c16a2a8927 -r a72b3dca661f tools/libxl/libxl.c --- a/tools/libxl/libxl.c Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl.c Mon Feb 13 15:48:52 2012 +0000 @@ -2100,9 +2100,13 @@ out: } /******************************************************************************/ -int libxl_device_vkb_init(libxl_ctx *ctx, libxl_device_vkb *vkb) +void libxl_device_vkb_init(libxl_device_vkb *vkb) { memset(vkb, 0x00, sizeof(libxl_device_vkb)); +} + +int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb) +{ return 0; } @@ -2128,6 +2132,9 @@ int libxl_device_vkb_add(libxl_ctx *ctx, libxl__device device; int rc; + rc = libxl__device_vkb_setdefault(gc, vkb); + if (rc) goto out; + front = flexarray_make(16, 1); if (!front) { rc = ERROR_NOMEM; @@ -2205,12 +2212,11 @@ out: } /******************************************************************************/ -int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb) +void libxl_device_vfb_init(libxl_device_vfb *vfb) { memset(vfb, 0x00, sizeof(libxl_device_vfb)); vfb->vnc.enable = 1; vfb->vnc.passwd = NULL; - vfb->vnc.listen = strdup("127.0.0.1"); vfb->vnc.display = 0; vfb->vnc.findunused = 1; vfb->keymap = NULL; @@ -2218,6 +2224,15 @@ int libxl_device_vfb_init(libxl_ctx *ctx vfb->sdl.opengl = 0; vfb->sdl.display = NULL; vfb->sdl.xauthority = NULL; +} + +int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb) +{ + if (!vfb->vnc.listen) { + vfb->vnc.listen = strdup("127.0.0.1"); + if (!vfb->vnc.listen) return ERROR_NOMEM; + } + return 0; } @@ -2242,6 +2257,9 @@ int libxl_device_vfb_add(libxl_ctx *ctx, libxl__device device; int rc; + rc = libxl__device_vfb_setdefault(gc, vfb); + if (rc) goto out; + front = flexarray_make(16, 1); if (!front) { rc = ERROR_NOMEM; diff -r 69c16a2a8927 -r a72b3dca661f tools/libxl/libxl.h --- a/tools/libxl/libxl.h Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl.h Mon Feb 13 15:48:52 2012 +0000 @@ -540,7 +540,7 @@ int libxl_device_nic_getinfo(libxl_ctx * libxl_device_nic *nic, libxl_nicinfo *nicinfo); /* Keyboard */ -int libxl_device_vkb_init(libxl_ctx *ctx, libxl_device_vkb *vkb); +void libxl_device_vkb_init(libxl_device_vkb *vkb); int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb); int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, @@ -548,7 +548,7 @@ int libxl_device_vkb_remove(libxl_ctx *c int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb); /* Framebuffer */ -int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb); +void libxl_device_vfb_init(libxl_device_vfb *vfb); int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb); int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb, diff -r 69c16a2a8927 -r a72b3dca661f tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl_create.c Mon Feb 13 15:48:52 2012 +0000 @@ -594,9 +594,7 @@ static int do_domain_create(libxl__gc *g libxl__device_console_add(gc, domid, &console, &state); libxl_device_console_dispose(&console); - ret = libxl_device_vkb_init(ctx, &vkb); - if ( ret ) - goto error_out; + libxl_device_vkb_init(&vkb); libxl_device_vkb_add(ctx, domid, &vkb); libxl_device_vkb_dispose(&vkb); diff -r 69c16a2a8927 -r a72b3dca661f tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl_dm.c Mon Feb 13 15:48:52 2012 +0000 @@ -610,8 +610,8 @@ static int libxl__vfb_and_vkb_from_hvm_g if (b_info->type != LIBXL_DOMAIN_TYPE_HVM) return ERROR_INVAL; - memset(vfb, 0x00, sizeof(libxl_device_vfb)); - memset(vkb, 0x00, sizeof(libxl_device_vkb)); + libxl_device_vfb_init(vfb); + libxl_device_vkb_init(vkb); vfb->backend_domid = 0; vfb->devid = 0; diff -r 69c16a2a8927 -r a72b3dca661f tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl_internal.h Mon Feb 13 15:48:52 2012 +0000 @@ -194,6 +194,8 @@ _hidden int libxl__domain_build_info_set _hidden int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk); _hidden int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic); +_hidden int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb); +_hidden int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb); struct libxl__evgen_domain_death { uint32_t domid; diff -r 69c16a2a8927 -r a72b3dca661f tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Mon Feb 13 15:48:52 2012 +0000 @@ -933,12 +933,12 @@ skip: d_config->vfbs = (libxl_device_vfb *) realloc(d_config->vfbs, sizeof(libxl_device_vfb) * (d_config->num_vfbs + 1)); vfb = d_config->vfbs + d_config->num_vfbs; - libxl_device_vfb_init(ctx, vfb); + libxl_device_vfb_init(vfb); vfb->devid = d_config->num_vfbs; d_config->vkbs = (libxl_device_vkb *) realloc(d_config->vkbs, sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1)); vkb = d_config->vkbs + d_config->num_vkbs; - libxl_device_vkb_init(ctx, vkb); + libxl_device_vkb_init(vkb); vkb->devid = d_config->num_vkbs; p = strtok(buf2, ","); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |