From patchwork Mon Jan 16 14:15:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 9518919 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 74D94601C3 for ; Mon, 16 Jan 2017 14:17:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54ACE28068 for ; Mon, 16 Jan 2017 14:17:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 478B42848E; Mon, 16 Jan 2017 14:17:53 +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 4DFDF28068 for ; Mon, 16 Jan 2017 14:17:52 +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 1cT84a-0001L2-2E; Mon, 16 Jan 2017 14:15:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cT84Y-0001Ju-RB for xen-devel@lists.xenproject.org; Mon, 16 Jan 2017 14:15:47 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id 8D/7A-11476-295DC785; Mon, 16 Jan 2017 14:15:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRWlGSWpSXmKPExsVyuP0Ov27/1Zo Ig4ZLnBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a0A6tZCt4lVry/sJm5gXFGSBcjJ4eEgJHE 24n/mLoYuTiEBBYySix98YkdJMEmoCqx4fopVhBbRMBRYnXbUjCbWcBBYtaso8xdjBwcwgK2E uunx4GEWYDKr556zQhi8woYS3Qc+MUGMV9eYuH5I0wgNqeAicTXMzPAxgsB1dzZsYhxAiP3Ak aGVYzqxalFZalFumZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBvmUAgh2M807 4H2KU5GBSEuU9plMdIcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCN+FKTYSQYFFqempFWmYOMMhg 0hIcPEoivLwgad7igsTc4sx0iNQpRl2OUzdOv2QSYsnLz0uVEue9dxmoSACkKKM0D24ELOAvM cpKCfMyAh0lxFOQWpSbWYIq/4pRnINRSZj3Lcgqnsy8ErhNr4COYAI64jrI/bzFJYkIKakGRu lXodJG9WZ5zxN+tYjmhFlP3awaU3Ht7nYZ9oZDNUuyf3Rf2RshsPs0p52GjPLLx34eYWLFbJt DeedNvigvMOnM9QcbjnTxexUqz+T5JvJ+43f5p7MrHC6L7e9fFNMt9rVJS3eSmPm/uhLFuEMq bgt5U216O5e3T98Z9l6kM16V4XIYj0+LEktxRqKhFnNRcSIAulBNPHMCAAA= X-Env-Sender: jgross@suse.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1484576141!46274329!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13702 invoked from network); 16 Jan 2017 14:15:42 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-10.tower-21.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 16 Jan 2017 14:15:42 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 93042AC5B; Mon, 16 Jan 2017 14:15:40 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Mon, 16 Jan 2017 15:15:31 +0100 Message-Id: <20170116141533.8946-2-jgross@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170116141533.8946-1-jgross@suse.com> References: <20170116141533.8946-1-jgross@suse.com> Cc: Juergen Gross , boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v2 1/3] xen: clean up xenbus internal headers 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 The xenbus driver has an awful mixture of internally and globally visible headers: some of the internally used only stuff is defined in the global header include/xen/xenbus.h while some stuff defined in internal headers is used by other drivers, too. Clean this up by moving the externally used symbols to include/xen/xenbus.h and the symbols used internally only to a new header drivers/xen/xenbus/xenbus.h replacing xenbus_comms.h and xenbus_probe.h Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky --- v2: update commit message, re-add lost copyright --- drivers/xen/xenbus/{xenbus_probe.h => xenbus.h} | 63 ++++++++++++++----------- drivers/xen/xenbus/xenbus_client.c | 2 +- drivers/xen/xenbus/xenbus_comms.c | 2 +- drivers/xen/xenbus/xenbus_comms.h | 51 -------------------- drivers/xen/xenbus/xenbus_dev_backend.c | 2 +- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 +- drivers/xen/xenbus/xenbus_probe.c | 3 +- drivers/xen/xenbus/xenbus_probe_backend.c | 3 +- drivers/xen/xenbus/xenbus_probe_frontend.c | 3 +- drivers/xen/xenbus/xenbus_xs.c | 3 +- drivers/xen/xenfs/super.c | 2 +- drivers/xen/xenfs/xenstored.c | 2 +- include/xen/xenbus.h | 12 ++--- 13 files changed, 52 insertions(+), 100 deletions(-) rename drivers/xen/xenbus/{xenbus_probe.h => xenbus.h} (59%) delete mode 100644 drivers/xen/xenbus/xenbus_comms.h diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus.h similarity index 59% rename from drivers/xen/xenbus/xenbus_probe.h rename to drivers/xen/xenbus/xenbus.h index c9ec7ca..a6b007d 100644 --- a/drivers/xen/xenbus/xenbus_probe.h +++ b/drivers/xen/xenbus/xenbus.h @@ -1,7 +1,5 @@ -/****************************************************************************** - * xenbus_probe.h - * - * Talks to Xen Store to figure out what devices we have. +/* + * Private include for xenbus communications. * * Copyright (C) 2005 Rusty Russell, IBM Corporation * Copyright (C) 2005 XenSource Ltd. @@ -31,8 +29,8 @@ * IN THE SOFTWARE. */ -#ifndef _XENBUS_PROBE_H -#define _XENBUS_PROBE_H +#ifndef _XENBUS_XENBUS_H +#define _XENBUS_XENBUS_H #define XEN_BUS_ID_SIZE 20 @@ -54,35 +52,46 @@ enum xenstore_init { XS_LOCAL, }; +extern enum xenstore_init xen_store_domain_type; extern const struct attribute_group *xenbus_dev_groups[]; -extern int xenbus_match(struct device *_dev, struct device_driver *_drv); -extern int xenbus_dev_probe(struct device *_dev); -extern int xenbus_dev_remove(struct device *_dev); -extern int xenbus_register_driver_common(struct xenbus_driver *drv, - struct xen_bus_type *bus, - struct module *owner, - const char *mod_name); -extern int xenbus_probe_node(struct xen_bus_type *bus, - const char *type, - const char *nodename); -extern int xenbus_probe_devices(struct xen_bus_type *bus); +int xs_init(void); +int xb_init_comms(void); +void xb_deinit_comms(void); +int xb_write(const void *data, unsigned int len); +int xb_read(void *data, unsigned int len); +int xb_data_to_read(void); +int xb_wait_for_data_to_read(void); -extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); +int xenbus_match(struct device *_dev, struct device_driver *_drv); +int xenbus_dev_probe(struct device *_dev); +int xenbus_dev_remove(struct device *_dev); +int xenbus_register_driver_common(struct xenbus_driver *drv, + struct xen_bus_type *bus, + struct module *owner, + const char *mod_name); +int xenbus_probe_node(struct xen_bus_type *bus, + const char *type, + const char *nodename); +int xenbus_probe_devices(struct xen_bus_type *bus); -extern void xenbus_dev_shutdown(struct device *_dev); +void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); -extern int xenbus_dev_suspend(struct device *dev); -extern int xenbus_dev_resume(struct device *dev); -extern int xenbus_dev_cancel(struct device *dev); +void xenbus_dev_shutdown(struct device *_dev); -extern void xenbus_otherend_changed(struct xenbus_watch *watch, - const char **vec, unsigned int len, - int ignore_on_shutdown); +int xenbus_dev_suspend(struct device *dev); +int xenbus_dev_resume(struct device *dev); +int xenbus_dev_cancel(struct device *dev); -extern int xenbus_read_otherend_details(struct xenbus_device *xendev, - char *id_node, char *path_node); +void xenbus_otherend_changed(struct xenbus_watch *watch, + const char **vec, unsigned int len, + int ignore_on_shutdown); + +int xenbus_read_otherend_details(struct xenbus_device *xendev, + char *id_node, char *path_node); void xenbus_ring_ops_init(void); +void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg); + #endif diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index 056da6e..23edf53 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -47,7 +47,7 @@ #include #include -#include "xenbus_probe.h" +#include "xenbus.h" #define XENBUS_PAGES(_grants) (DIV_ROUND_UP(_grants, XEN_PFN_PER_PAGE)) diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c index ecdecce..c21ec02 100644 --- a/drivers/xen/xenbus/xenbus_comms.c +++ b/drivers/xen/xenbus/xenbus_comms.c @@ -40,7 +40,7 @@ #include #include #include -#include "xenbus_comms.h" +#include "xenbus.h" static int xenbus_irq; diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h deleted file mode 100644 index 867a2e4..0000000 --- a/drivers/xen/xenbus/xenbus_comms.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Private include for xenbus communications. - * - * Copyright (C) 2005 Rusty Russell, IBM Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation; or, when distributed - * separately from the Linux kernel or incorporated into other - * software packages, subject to the following license: - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this source file (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef _XENBUS_COMMS_H -#define _XENBUS_COMMS_H - -#include - -int xs_init(void); -int xb_init_comms(void); -void xb_deinit_comms(void); - -/* Low level routines. */ -int xb_write(const void *data, unsigned len); -int xb_read(void *data, unsigned len); -int xb_data_to_read(void); -int xb_wait_for_data_to_read(void); -extern struct xenstore_domain_interface *xen_store_interface; -extern int xen_store_evtchn; -extern enum xenstore_init xen_store_domain_type; - -extern const struct file_operations xen_xenbus_fops; - -#endif /* _XENBUS_COMMS_H */ diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c index 4a41ac9..1126701 100644 --- a/drivers/xen/xenbus/xenbus_dev_backend.c +++ b/drivers/xen/xenbus/xenbus_dev_backend.c @@ -16,7 +16,7 @@ #include #include -#include "xenbus_comms.h" +#include "xenbus.h" static int xenbus_backend_open(struct inode *inode, struct file *filp) { diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 79130b3..e2bc9b3 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -57,12 +57,12 @@ #include #include -#include "xenbus_comms.h" - #include #include #include +#include "xenbus.h" + /* * An element of a list of outstanding transactions, for which we're * still waiting a reply. diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 4bdf654..6baffbb 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -62,8 +62,7 @@ #include -#include "xenbus_comms.h" -#include "xenbus_probe.h" +#include "xenbus.h" int xen_store_evtchn; diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c index 37929df..f46b4dc 100644 --- a/drivers/xen/xenbus/xenbus_probe_backend.c +++ b/drivers/xen/xenbus/xenbus_probe_backend.c @@ -53,8 +53,7 @@ #include #include -#include "xenbus_comms.h" -#include "xenbus_probe.h" +#include "xenbus.h" /* backend/// => -- */ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 6d40a97..d7b77a6 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -27,8 +27,7 @@ #include -#include "xenbus_comms.h" -#include "xenbus_probe.h" +#include "xenbus.h" diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 6afb993..4c49d87 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -48,8 +48,7 @@ #include #include #include -#include "xenbus_comms.h" -#include "xenbus_probe.h" +#include "xenbus.h" struct xs_stored_msg { struct list_head list; diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index 8559a71..328c398 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c @@ -16,10 +16,10 @@ #include #include +#include #include "xenfs.h" #include "../privcmd.h" -#include "../xenbus/xenbus_comms.h" #include diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c index fef20db..82fd2a3 100644 --- a/drivers/xen/xenfs/xenstored.c +++ b/drivers/xen/xenfs/xenstored.c @@ -4,9 +4,9 @@ #include #include +#include #include "xenfs.h" -#include "../xenbus/xenbus_comms.h" static ssize_t xsd_read(struct file *file, char __user *buf, size_t size, loff_t *off) diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 271ba62..98f73a2 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -175,16 +176,9 @@ void xs_suspend(void); void xs_resume(void); void xs_suspend_cancel(void); -/* Used by xenbus_dev to borrow kernel's store connection. */ -void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg); - struct work_struct; -/* Prepare for domain suspend: then resume or cancel the suspend. */ -void xenbus_suspend(void); -void xenbus_resume(void); void xenbus_probe(struct work_struct *); -void xenbus_suspend_cancel(void); #define XENBUS_IS_ERR_READ(str) ({ \ if (!IS_ERR(str) && strlen(str) == 0) { \ @@ -235,4 +229,8 @@ const char *xenbus_strstate(enum xenbus_state state); int xenbus_dev_is_online(struct xenbus_device *dev); int xenbus_frontend_closed(struct xenbus_device *dev); +extern const struct file_operations xen_xenbus_fops; +extern struct xenstore_domain_interface *xen_store_interface; +extern int xen_store_evtchn; + #endif /* _XEN_XENBUS_H */