From patchwork Tue Oct 25 05:50:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Condrea X-Patchwork-Id: 9394069 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 1460760231 for ; Tue, 25 Oct 2016 06:07:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06FB329375 for ; Tue, 25 Oct 2016 06:07:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE18629379; Tue, 25 Oct 2016 06:07:28 +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 702DA29375 for ; Tue, 25 Oct 2016 06:07:28 +0000 (UTC) Received: from localhost ([::1]:51995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byutT-0003z1-MR for patchwork-qemu-devel@patchwork.kernel.org; Tue, 25 Oct 2016 02:07:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byuec-0000vG-ED for qemu-devel@nongnu.org; Tue, 25 Oct 2016 01:52:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byueb-0004VS-Ev for qemu-devel@nongnu.org; Tue, 25 Oct 2016 01:52:06 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:39498) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byueb-0004VG-8X for qemu-devel@nongnu.org; Tue, 25 Oct 2016 01:52:05 -0400 Received: by mail-wm0-x242.google.com with SMTP id m83so252899wmc.6 for ; Mon, 24 Oct 2016 22:52:05 -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=EeTfX9QdFs4++hLnf+fa9WaOAYgrSjtkIz1LyesdMmotMj580L0yixYQnKmViMJeAd TRA3giBH0Lg9omFhdCYRwINaNRWTbsKNHDSl/L4nvs5HcRZUycqbRI1dBUXDbqSV9QAD aq39c4wTdh5Z4pzezWgYqYHlzVRihBUGTv+1rZmdUedwtuyfW91fdtnvosEdIw4TN+/9 FnXci4bRB2Vq5SNrDQUxTfK42Xmtc3aOPyk3vMjn5/ljkurF6hBswt+kidaCwCy0eGk+ 3RZhrRuBF3VVxHfpi3BiLrShMm6tFB60fVhgE+yCicu+Dk7+aWCQ+8EDEbyI406ZCz0/ X4Iw== 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=MpAPQtrFXI0AEFuX6B2WuWYNkONsQVz4pAI8UUSh4ShVyxNeWeW7pQrcgEymC07Yi0 S5hl+SU2A9G9EHTqOz1q3yCBp3/cXalW74ZRtz4tXenO5u4epx5VqkMOvOd9nnxW4mDv WmkOH2ajMKqqbnTsIq0zxNtMFVbjjEbeQxDKQkSQspS2oc8bVwB7vO4Mb2ykRLPLuhM6 3s2v8qtjJH7D9j/ZpA9SwNiV2+66q5xPb6niMxye3ITzwDPGb+/znX/bEOFm2EkVoZg5 688hSXL6Bo5uGaSps/qcMudl52GOBF1nfrbZL7EPGoSdW+SnSUh395ceYCSrTmSe8cz2 TJYA== X-Gm-Message-State: ABUngvc/lhlMilR3544+R0F2f2nanrAtPqBwRMWkxoS4BsSsys7Cu90NYLMxpoMUo7E3Pg== X-Received: by 10.194.19.130 with SMTP id f2mr16777108wje.107.1477374724072; Mon, 24 Oct 2016 22:52:04 -0700 (PDT) Received: from localhost.localdomain ([79.112.79.134]) by smtp.gmail.com with ESMTPSA id gk6sm1358053wjc.21.2016.10.24.22.52.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 22:52:03 -0700 (PDT) From: Emil Condrea To: qemu-devel@nongnu.org Date: Tue, 25 Oct 2016 08:50:10 +0300 Message-Id: <1477374619-13149-5-git-send-email-emilcondrea@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477374619-13149-1-git-send-email-emilcondrea@gmail.com> References: <1477374619-13149-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:400c:c09::242 Subject: [Qemu-devel] [PATCH v3 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, pbonzini@redhat.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);