From: Oleksandr Grytsov <al1img@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com,
Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Subject: [PATCH v1 1/6] libxl: move vkb device to libxl_vkb.c
Date: Wed, 1 Nov 2017 17:05:02 +0200 [thread overview]
Message-ID: <1509548707-6134-2-git-send-email-al1img@gmail.com> (raw)
In-Reply-To: <1509548707-6134-1-git-send-email-al1img@gmail.com>
From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
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@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
tools/libxl/Makefile | 1 +
tools/libxl/libxl_console.c | 53 ---------------------------------
tools/libxl/libxl_vkb.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 73 insertions(+), 53 deletions(-)
create mode 100644 tools/libxl/libxl_vkb.c
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 2d52435..df1b710 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -139,6 +139,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_vsnd.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 624bd01..09facaf 100644
--- a/tools/libxl/libxl_console.c
+++ b/tools/libxl/libxl_console.c
@@ -583,45 +583,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, "vkb")
-
static int libxl__device_vfb_setdefault(libxl__gc *gc, uint32_t domid,
libxl_device_vfb *vfb, bool hotplug)
{
@@ -706,8 +667,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
*/
@@ -716,18 +675,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,
- .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 0000000..0d01262
--- /dev/null
+++ b/tools/libxl/libxl_vkb.c
@@ -0,0 +1,72 @@
+/*
+ * 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);
+}
+
+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, "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,
+ .skip_attach = 1
+);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-11-01 15:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 15:05 [PATCH v1 0/6] libxl: create standalone vkb device Oleksandr Grytsov
2017-11-01 15:05 ` Oleksandr Grytsov [this message]
2017-11-01 15:05 ` [PATCH v1 2/6] libxl: fix vkb XS entry and type Oleksandr Grytsov
2017-11-01 15:05 ` [PATCH v1 3/6] libxl: add backend type and id to vkb Oleksandr Grytsov
2018-02-06 14:25 ` Wei Liu
2018-02-06 16:45 ` Oleksandr Grytsov
2018-02-06 16:54 ` Wei Liu
2017-11-01 15:05 ` [PATCH v1 4/6] libxl: vkb add list and info functions Oleksandr Grytsov
2018-02-06 14:26 ` Wei Liu
2018-02-06 14:27 ` Wei Liu
2017-11-01 15:05 ` [PATCH v1 5/6] xl: add vkb config parser and CLI Oleksandr Grytsov
2018-02-06 14:27 ` Wei Liu
2017-11-01 15:05 ` [PATCH v1 6/6] docs: add vkb device to xl.cfg and xl Oleksandr Grytsov
2018-02-06 14:28 ` Wei Liu
2017-11-14 12:39 ` [PATCH v1 0/6] libxl: create standalone vkb device Oleksandr Grytsov
2017-11-20 13:44 ` Oleksandr Grytsov
2018-01-09 11:31 ` Oleksandr Grytsov
2018-02-05 11:03 ` Oleksandr Grytsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509548707-6134-2-git-send-email-al1img@gmail.com \
--to=al1img@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=oleksandr_grytsov@epam.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).