libxl: vfb/vkb: use _init/_setdefault

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Ian Campbell committed 2012-03-01 12:26:14 +00:00
1 parent 5c5a36663a
commit 31278f6850
6 files changed
+30 -12

No files matched your search

+21 -3
View File
@@ -2101,9 +2101,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;
}
@@ -2129,6 +2133,9 @@ int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
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 @@ 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;
@@ -2219,6 +2225,15 @@ int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb)
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 @@ int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
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;
+2 -2
View File
@@ -536,7 +536,7 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
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_remove(libxl_ctx *ctx, uint32_t domid,
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,
+1 -3
View File
@@ -595,9 +595,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
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);
+2 -2
View File
@@ -616,8 +616,8 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
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;
+2
View File
@@ -194,6 +194,8 @@ _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,
_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;
+2 -2
View File
@@ -940,12 +940,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, ",");
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.