From patchwork Thu Oct 13 06:01:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Condrea X-Patchwork-Id: 9374357 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 BCEDA60839 for ; Thu, 13 Oct 2016 06:02:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF3E62985A for ; Thu, 13 Oct 2016 06:02:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A35F52985C; Thu, 13 Oct 2016 06:02:56 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C3002985A for ; Thu, 13 Oct 2016 06:02:56 +0000 (UTC) Received: from localhost ([::1]:37767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buZ6V-0008UZ-7Z for patchwork-qemu-devel@patchwork.kernel.org; Thu, 13 Oct 2016 02:02:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buZ5r-0008SA-Pu for qemu-devel@nongnu.org; Thu, 13 Oct 2016 02:02:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buZ5p-0000R2-To for qemu-devel@nongnu.org; Thu, 13 Oct 2016 02:02:15 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:33975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buZ5p-0000Qd-Ig for qemu-devel@nongnu.org; Thu, 13 Oct 2016 02:02:13 -0400 Received: by mail-lf0-x241.google.com with SMTP id x23so5023213lfi.1 for ; Wed, 12 Oct 2016 23:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tEQ2TLslxyHdel4wJIXXvEH5QU7crq/qNkzsMRvw+h0=; b=fe3wrj6fvvjS4wjUDu6jnXTfBQwq8r2gZ4meooSV/S0c7I/UWbb3fT82LZiAwHyBJz eTnHwzrB/GtXUKuOriRw5xoM8az08LiIVEQSbJDd9drBOuRtaV2Rq9HzLVua6fTmAt09 beRaJGGCof/l7VY2cbwof/EIBpO2JI04QWjahTu5kDmz1c0Yz2gWo5I0CVogw2yjoAXT DnC4LzZulk/30x5eeemiO4po+MJx8ah+LeHUo8ZtE1Ht9+ts4YHh9iRm7rI2VVKBWFyk cXqx/XYR0gnWwKkJCwLGB1wJJrIUFesdhXskCdP9n/oTA5QBl5s618/g2PIoK6bVdjba XH4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tEQ2TLslxyHdel4wJIXXvEH5QU7crq/qNkzsMRvw+h0=; b=LFHIdpfBVHaMaQdd5FXT9rniH3RVLjC/lc5fhZshSGKcxPoKk+GwBBgKTNa+9Iig3q mYnceykYux/1irDWpfZI0Ejkr8GyO7RsKj/jUXCjcYSKPITg2igEaEsXsYrEFpYYkTCu cebnJNZwZb7N7yCsqYLJ7ep6USHw7fdgzhur3zKWvgXSe/PdWqBKP2ifhr6F8DytPEk+ 6QRgKNRAWvwZVKXWK1I5WwcuJArW1p+yEyXyiwXXI4/6iYdg0dn5c0pnzMdKHwZQV8Dm 2c0ixqVEuFUfXDhNgN/LdQ3v+MggLDmi5BvObrvvZGtLov3nJrcnN/8/zZST2keuFc5D piMg== X-Gm-Message-State: AA6/9RneESsmrYvc+RjaQYt2YlmrQcWgcnGbOxk1DjhHFGiVVXhJyWEt9JUJ3B8JuqExfA== X-Received: by 10.28.8.7 with SMTP id 7mr799265wmi.65.1476338532721; Wed, 12 Oct 2016 23:02:12 -0700 (PDT) Received: from localhost.localdomain ([79.112.35.35]) by smtp.gmail.com with ESMTPSA id rv12sm19588230wjb.29.2016.10.12.23.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Oct 2016 23:02:11 -0700 (PDT) From: Emil Condrea To: qemu-devel@nongnu.org Date: Thu, 13 Oct 2016 09:01:45 +0300 Message-Id: <1476338514-14492-5-git-send-email-emilcondrea@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476338514-14492-1-git-send-email-emilcondrea@gmail.com> References: <1476338514-14492-1-git-send-email-emilcondrea@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH v2 04/13] xen: Move xenstore_update to xen_pvdev.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xuquan8@huawei.com, sstabellini@kernel.org, wei.liu2@citrix.com, stefanb@linux.vnet.ibm.com, xen-devel@lists.xen.org, anthony.perard@citrix.com, dgdegra@tycho.nsa.gov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP * xenstore_update -> xen_pvdev.c Signed-off-by: Emil Condrea --- hw/xen/xen_backend.c | 30 +++--------------------------- hw/xen/xen_pvdev.c | 23 +++++++++++++++++++++++ include/hw/xen/xen_backend.h | 3 +++ include/hw/xen/xen_pvdev.h | 1 + 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index b32b0dd..e3a7d95 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -556,8 +556,8 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops) return 0; } -static void xenstore_update_be(char *watch, char *type, int dom, - struct XenDevOps *ops) +void xenstore_update_be(char *watch, char *type, int dom, + struct XenDevOps *ops) { struct XenDevice *xendev; char path[XEN_BUFSIZE], *bepath; @@ -590,7 +590,7 @@ static void xenstore_update_be(char *watch, char *type, int dom, } } -static void xenstore_update_fe(char *watch, struct XenDevice *xendev) +void xenstore_update_fe(char *watch, struct XenDevice *xendev) { char *node; unsigned int len; @@ -607,30 +607,6 @@ static void xenstore_update_fe(char *watch, struct XenDevice *xendev) xen_be_frontend_changed(xendev, node); xen_be_check_state(xendev); } - -static void xenstore_update(void *unused) -{ - char **vec = NULL; - intptr_t type, ops, ptr; - unsigned int dom, count; - - vec = xs_read_watch(xenstore, &count); - if (vec == NULL) { - goto cleanup; - } - - if (sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR, - &type, &dom, &ops) == 3) { - xenstore_update_be(vec[XS_WATCH_PATH], (void *)type, dom, (void*)ops); - } - if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1) { - xenstore_update_fe(vec[XS_WATCH_PATH], (void *)ptr); - } - -cleanup: - free(vec); -} - static void xen_be_evtchn_event(void *opaque) { struct XenDevice *xendev = opaque; diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index a1dc2be..22a1abe 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -95,6 +95,29 @@ int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval) return rc; } +void xenstore_update(void *unused) +{ + char **vec = NULL; + intptr_t type, ops, ptr; + unsigned int dom, count; + + vec = xs_read_watch(xenstore, &count); + if (vec == NULL) { + goto cleanup; + } + + if (sscanf(vec[XS_WATCH_TOKEN], "be:%" PRIxPTR ":%d:%" PRIxPTR, + &type, &dom, &ops) == 3) { + xenstore_update_be(vec[XS_WATCH_PATH], (void *)type, dom, (void*)ops); + } + if (sscanf(vec[XS_WATCH_TOKEN], "fe:%" PRIxPTR, &ptr) == 1) { + xenstore_update_fe(vec[XS_WATCH_PATH], (void *)ptr); + } + +cleanup: + free(vec); +} + const char *xenbus_strstate(enum xenbus_state state) { static const char *const name[] = { diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 973cb4b..2e54150 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -19,6 +19,9 @@ int xenstore_write_be_int(struct XenDevice *xendev, const char *node, int ival); int xenstore_write_be_int64(struct XenDevice *xendev, const char *node, int64_t ival); char *xenstore_read_be_str(struct XenDevice *xendev, const char *node); int xenstore_read_be_int(struct XenDevice *xendev, const char *node, int *ival); +void xenstore_update_fe(char *watch, struct XenDevice *xendev); +void xenstore_update_be(char *watch, char *type, int dom, + struct XenDevOps *ops); char *xenstore_read_fe_str(struct XenDevice *xendev, const char *node); int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival); int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, diff --git a/include/hw/xen/xen_pvdev.h b/include/hw/xen/xen_pvdev.h index cd3d6bc..3c4cc01 100644 --- a/include/hw/xen/xen_pvdev.h +++ b/include/hw/xen/xen_pvdev.h @@ -60,6 +60,7 @@ int xenstore_write_int64(const char *base, const char *node, int64_t ival); char *xenstore_read_str(const char *base, const char *node); int xenstore_read_int(const char *base, const char *node, int *ival); int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval); +void xenstore_update(void *unused); const char *xenbus_strstate(enum xenbus_state state);