[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 1/6] libxl: move vkb device to libxl_vkb.c
From: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> Logically it is better to move vkb to separate file as vkb device used not only by vfb and console. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/Makefile | 2 +- tools/libxl/libxl_console.c | 53 --------------------------------- tools/libxl/libxl_vkb.c | 59 +++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 54 deletions(-) create mode 100644 tools/libxl/libxl_vkb.c diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 035e66e22e..c6eb5e77fa 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -140,7 +140,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \ libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \ libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \ libxl_9pfs.o libxl_domain.o libxl_vdispl.o \ - libxl_pvcalls.o $(LIBXL_OBJS-y) + libxl_pvcalls.o libxl_vkb.o $(LIBXL_OBJS-y) LIBXL_OBJS += libxl_genid.o LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 9a02a23c2a..36d79f5adc 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -638,45 +638,6 @@ int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid, return rc; } -static int libxl__device_vkb_setdefault(libxl__gc *gc, uint32_t domid, - libxl_device_vkb *vkb, bool hotplug) -{ - return libxl__resolve_domid(gc, vkb->backend_domname, &vkb->backend_domid); -} - -static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid, - libxl_device_vkb *vkb, - libxl__device *device) -{ - device->backend_devid = vkb->devid; - device->backend_domid = vkb->backend_domid; - device->backend_kind = LIBXL__DEVICE_KIND_VKBD; - device->devid = vkb->devid; - device->domid = domid; - device->kind = LIBXL__DEVICE_KIND_VKBD; - - return 0; -} - -int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, - const libxl_asyncop_how *ao_how) -{ - AO_CREATE(ctx, domid, ao_how); - int rc; - - rc = libxl__device_add(gc, domid, &libxl__vkb_devtype, vkb); - if (rc) { - LOGD(ERROR, domid, "Unable to add vkb device"); - goto out; - } - -out: - libxl__ao_complete(egc, ao, rc); - return AO_INPROGRESS; -} - -static LIBXL_DEFINE_UPDATE_DEVID(vkb) - static int libxl__device_vfb_setdefault(libxl__gc *gc, uint32_t domid, libxl_device_vfb *vfb, bool hotplug) { @@ -746,8 +707,6 @@ static int libxl__set_xenstore_vfb(libxl__gc *gc, uint32_t domid, } /* The following functions are defined: - * libxl_device_vkb_remove - * libxl_device_vkb_destroy * libxl_device_vfb_remove * libxl_device_vfb_destroy */ @@ -756,18 +715,6 @@ static int libxl__set_xenstore_vfb(libxl__gc *gc, uint32_t domid, * 1. add support for secondary consoles to xenconsoled * 2. dynamically add/remove qemu chardevs via qmp messages. */ -/* vkb */ - -#define libxl__add_vkbs NULL -#define libxl_device_vkb_list NULL -#define libxl_device_vkb_compare NULL - -LIBXL_DEFINE_DEVICE_REMOVE(vkb) - -DEFINE_DEVICE_TYPE_STRUCT(vkb, VKBD, - .skip_attach = 1 -); - #define libxl__add_vfbs NULL #define libxl_device_vfb_list NULL #define libxl_device_vfb_compare NULL diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c new file mode 100644 index 0000000000..7652ad23ce --- /dev/null +++ b/tools/libxl/libxl_vkb.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2016 EPAM Systems Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +#include "libxl_internal.h" + +static int libxl__device_vkb_setdefault(libxl__gc *gc, uint32_t domid, + libxl_device_vkb *vkb, bool hotplug) +{ + return libxl__resolve_domid(gc, vkb->backend_domname, &vkb->backend_domid); +} + +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, + const libxl_asyncop_how *ao_how) +{ + AO_CREATE(ctx, domid, ao_how); + int rc; + + rc = libxl__device_add(gc, domid, &libxl__vkb_devtype, vkb); + if (rc) { + LOGD(ERROR, domid, "Unable to add vkb device"); + goto out; + } + +out: + libxl__ao_complete(egc, ao, rc); + return AO_INPROGRESS; +} + +static LIBXL_DEFINE_DEVICE_FROM_TYPE(vkb) +static LIBXL_DEFINE_UPDATE_DEVID(vkb) + +#define libxl__add_vkbs NULL +#define libxl_device_vkb_list NULL +#define libxl_device_vkb_compare NULL + +LIBXL_DEFINE_DEVICE_REMOVE(vkb) + +DEFINE_DEVICE_TYPE_STRUCT(vkb, VKBD, + .skip_attach = 1 +); + +/* + * Local variables: + * mode: C + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |