From patchwork Thu Oct 5 09:07:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 9986623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8CFDC602B8 for ; Thu, 5 Oct 2017 09:09:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83723287CF for ; Thu, 5 Oct 2017 09:09:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78446287E7; Thu, 5 Oct 2017 09:09:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0ABE0287CF for ; Thu, 5 Oct 2017 09:09:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e027v-00028S-Og; Thu, 05 Oct 2017 09:07:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e027u-00025a-A3 for xen-devel@lists.xenproject.org; Thu, 05 Oct 2017 09:07:30 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 9A/17-02048-156F5D95; Thu, 05 Oct 2017 09:07:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRWlGSWpSXmKPExsVyMfS6i677t6u RBpe/mVt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmH7k5lK/ikU3Hm8yKWBsZXyl2MnBxCAtMZ JRZvMAWxWQReskhc6o/pYuTikBDoZ5Vo+jSPBSQhIZAlsfTzHDYIO03i7LOvQDYHkF0hMf1hF sQceYmDLZfZQXqFBKYySazZeI4dJMEmoCVx//YKsF4RASWJe6smM4HYzAIpEnvXtTGC2MICVh KfHj1lgjhCVWLB1g9gvbwCDhIvp75ghdgrJ3HzXCcziM0p4Chx9OthNojFDhJzDnxim8AouIC RYRWjenFqUVlqka6FXlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGYLAxAMEOxgvt zocYJTmYlER5j7+7GinEl5SfUpmRWJwRX1Sak1p8iFGDg0Pg59O/LYxSLHn5ealKErxcH4DqB ItS01Mr0jJzgPEAUyrBwaMkwnvjPVCat7ggMbc4Mx0idYrRkuPCnUt/mDgO7LkFJDtu3v3DJA Q2T0qclxdkngBIQ0ZpHtw4WMxeYpSVEuZlBDpWiKcgtSg3swRV/hWjOAejkjDvDZApPJl5JXB bXwEdxAR00JymKyAHlSQipKQaGKvfxM0y/Xo2fXtsxIvAe/fv1e84Ycg3r97A1unP6wN7LzA8 +s43ryboXI8k93VXkyI/5s/ZXXOuMizfK7n50PNjgvvCLXlLZh5/F11QH7EqKdOydLXfPL7HL h/f1rIvrJ4ss2axuL+MzW62y2tzRNPOLP9lHHnyCev8mLz/6xj0NS571L4//lGJpTgj0VCLua g4EQAfFaf+1AIAAA== X-Env-Sender: al1img@gmail.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1507194439!117321226!1 X-Originating-IP: [209.85.215.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8589 invoked from network); 5 Oct 2017 09:07:19 -0000 Received: from mail-lf0-f68.google.com (HELO mail-lf0-f68.google.com) (209.85.215.68) by server-10.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Oct 2017 09:07:19 -0000 Received: by mail-lf0-f68.google.com with SMTP id h80so5534962lfe.1 for ; Thu, 05 Oct 2017 02:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7V5FRaKaWjLnTovDos2J+DFYXjduwOzEEFaDV/1tOjw=; b=Tvgr9iFDOmUwogwB7O8iKRlimvgScq81oJoTpIuKAI0VHTOIMuFYCsf0RGmTo+CA09 5GnSmjoBdwP3KnpKeOd0RneogiM+5hY2NPc1J397HhE8stjeYsDwRSxOSijEKl95ch1q V65G5XVsJQmBToW+8KwkVzickmgput3GH+hv6GaqDt8DkXdmvredlOiyGgv4o+avazTP x0g7Nsxet4LELrUlC1OfONIFBBIpvw1hlZSgswF9ky0pgPXW3fjOgpXDCMURmSuFVOAu SkxCvMmMCLRRy1/XrC51fry2hIDQyHpVMqADwJyE7kJb8s5dqOD4qtVtJISjQKkLVUXi K3jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7V5FRaKaWjLnTovDos2J+DFYXjduwOzEEFaDV/1tOjw=; b=mqCe1YY3iHOZDOfpJ30iYFui25+WYWhfQXuErvfJFSkS1aJS76w7jEJss3/6FPTI4C LvX8oAO3OqdspcYYA/LgF79VCDkAGRyxFgsHHQ2Xnsv/AvUb7XmDMUil5+Nu5kULfh1O 2eeRXXtXprIMXGuINzqr4eXPoVUe3G8EuFAcC5s+XNjS9qUOQU2p41xhH0mf6PT1IWGq 6ghDbTSRpfnb68DctdKd9DtCTEpFggm1cTJLFpzksZYaAObiSp914nvbJLuB5G4Vx1Zz unxFGP4hDOX7En+qp97HgmiRzyN+PDZX0j273iCg7tTonGeoCwsuvV7agnYExw2u0lsY 4Wvg== X-Gm-Message-State: AMCzsaXqGhFiiAIOo+Jq+T1VBKRuRw4aRUJv7/yLgjhHl/z8zk+gPE8+ idjYElnCqyfKaEx9A4rsg8EfqA== X-Google-Smtp-Source: AOwi7QBYxFkW69NY6Qa1i+dFZjUAZK26oEPVbZpvLMyr1a/g1A3ju7YQhUAu4VXlFATnFFNmBFSfyg== X-Received: by 10.46.82.92 with SMTP id g89mr1838041ljb.139.1507194439028; Thu, 05 Oct 2017 02:07:19 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-52.209.223.85.sovam.net.ua. [85.223.209.52]) by smtp.gmail.com with ESMTPSA id l11sm2861584lfi.3.2017.10.05.02.07.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Oct 2017 02:07:18 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Thu, 5 Oct 2017 12:07:06 +0300 Message-Id: <1507194431-17588-2-git-send-email-al1img@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507194431-17588-1-git-send-email-al1img@gmail.com> References: <1507194431-17588-1-git-send-email-al1img@gmail.com> Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, Oleksandr Grytsov Subject: [Xen-devel] [PATCH 1/6] libxl: move vkb device to libxl_vkb.c X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Grytsov 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 Acked-by: Wei Liu --- 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: + */