From patchwork Sat Oct 29 01:10:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9402983 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 973596022E for ; Sat, 29 Oct 2016 01:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8422A2A6E9 for ; Sat, 29 Oct 2016 01:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 775962A707; Sat, 29 Oct 2016 01:13:11 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 05CEA2A6E9 for ; Sat, 29 Oct 2016 01:13:11 +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 1c0IAG-0003xF-8X; Sat, 29 Oct 2016 01:10:28 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0IAE-0003w6-GR for xen-devel@lists.xenproject.org; Sat, 29 Oct 2016 01:10:26 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 47/F6-30618-107F3185; Sat, 29 Oct 2016 01:10:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsVybKJshy7jd+E Ig8vreCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oznJz4xFRxSqXi+8j5TA+M32S5GLg4hgamM En92nWWBcLYzSWxdOYeti5GTg03AUOLvk01gtoiAjETnpUWMIEXMAlsZJX5e+AKWEBawk+g4+ 4IZxGYRUJX4//M9E4jNK+AmsXNNOzuILSEgJ3Hy2GRWEJtTwF3ix8q/UNvaGCWedF5ngSjKkJ jXM4cVwvaSWHTjEpStJnH13CbmCYx8CxgZVjFqFKcWlaUW6Rqa6CUVZaZnlOQmZuboGhqY6eW mFhcnpqfmJCYV6yXn525iBAYLAxDsYLy+MeAQoyQHk5Io77cvwhFCfEn5KZUZicUZ8UWlOanF hxhlODiUJHgZvwHlBItS01Mr0jJzgGELk5bg4FES4X30FSjNW1yQmFucmQ6ROsWoKCXOywzSJ wCSyCjNg2uDxcolRlkpYV5GoEOEeApSi3IzS1DlXzGKczAqCfP+BxnPk5lXAjf9FdBiJqDF09 MFQBaXJCKkpBoY2aw04t5GK9q+rWL1Vpr9uLHF9FVHbW1H+pVs8+37fTPr2r5mB+xYPfup2zS tzlSruNXh7wyP+T7bVt96ok28eA1zyuRdIX+5rqRpdpjsXrLa6e6mG9cyvRYqzP4ffq1kzmZO 3/Du0xkV9x+tCdruv+vAghMZdrkp7b+nHpmdvyFyo96CyP36SizFGYmGWsxFxYkAGN1YrpACA AA= X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-9.tower-21.messagelabs.com!1477703423!40489081!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7426 invoked from network); 29 Oct 2016 01:10:24 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-9.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 29 Oct 2016 01:10:24 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DBC520489; Sat, 29 Oct 2016 01:10:22 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.hsd1.ca.comcast.net (96-82-76-110-static.hfc.comcastbusiness.net [96.82.76.110]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B2AD20481; Sat, 29 Oct 2016 01:10:21 +0000 (UTC) From: Stefano Stabellini To: peter.maydell@linaro.org Date: Fri, 28 Oct 2016 18:10:04 -0700 Message-Id: <1477703413-18852-4-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477703413-18852-1-git-send-email-sstabellini@kernel.org> References: <1477703413-18852-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Quan Xu , sstabellini@kernel.org, qemu-devel@nongnu.org, anthony.perard@citrix.com, xen-devel@lists.xenproject.org, Emil Condrea Subject: [Xen-devel] [PULL 04/13] xen: Move xenstore_update to xen_pvdev.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: Emil Condrea * xenstore_update -> xen_pvdev.c Signed-off-by: Emil Condrea Signed-off-by: Stefano Stabellini Signed-off-by: Quan Xu Acked-by: Anthony PERARD --- 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);