[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: vfb/vkb: use _init/_setdefault
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330604774 0 # Node ID e5bc6847f24882143b71318e2683772f4f34251e # Parent bc49dfa119baa61a9fa22d44e26191f8d0fc24f6 libxl: vfb/vkb: use _init/_setdefault Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- diff -r bc49dfa119ba -r e5bc6847f248 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/libxl.c Thu Mar 01 12:26:14 2012 +0000 @@ -2101,9 +2101,13 @@ } /******************************************************************************/ -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; } @@ -2129,6 +2133,9 @@ 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; @@ -2206,12 +2213,11 @@ } /******************************************************************************/ -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; @@ -2219,6 +2225,15 @@ 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; } @@ -2243,6 +2258,9 @@ 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 bc49dfa119ba -r e5bc6847f248 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/libxl.h Thu Mar 01 12:26:14 2012 +0000 @@ -536,7 +536,7 @@ 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, @@ -544,7 +544,7 @@ 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 bc49dfa119ba -r e5bc6847f248 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 @@ -595,9 +595,7 @@ 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 bc49dfa119ba -r e5bc6847f248 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/libxl_dm.c Thu Mar 01 12:26:14 2012 +0000 @@ -616,8 +616,8 @@ 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 bc49dfa119ba -r e5bc6847f248 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Thu Mar 01 12:26:14 2012 +0000 +++ b/tools/libxl/libxl_internal.h Thu Mar 01 12:26:14 2012 +0000 @@ -194,6 +194,8 @@ _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 bc49dfa119ba -r e5bc6847f248 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 @@ -940,12 +940,12 @@ 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-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |