From patchwork Wed Mar 22 19:03:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9639881 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 304EA6020B for ; Wed, 22 Mar 2017 19:06:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1295828456 for ; Wed, 22 Mar 2017 19:06:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 075B328473; Wed, 22 Mar 2017 19:06:14 +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 0831B28456 for ; Wed, 22 Mar 2017 19:06:13 +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 1cqlYA-0007EI-Gz; Wed, 22 Mar 2017 19:04:02 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqlY9-0007E4-QP for xen-devel@lists.xenproject.org; Wed, 22 Mar 2017 19:04:01 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id E6/A2-00609-1AAC2D85; Wed, 22 Mar 2017 19:04:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42I5NlG2Q3fBqUs RBo37xSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oznq5ewFjxSqjj7aj9LA+ND2S5GTg4hgamM Ei3nOLsYuYDs3UwS386tZAJJsAkYSvx9sokNxBYRUJK4t2oyE0gRs8BCJok5166xgCSEBVwlf vUtZwaxWQRUJfYdOM8IYvMCxeffug42SEJATuLkscmsIDangJvElLv7GSE2tzFKzP0gDlGTIT GvZw4rhO0lsejGJShbTeLquU3MExj5FjAyrGJUL04tKkst0jXXSyrKTM8oyU3MzNE1NDDWy00 tLk5MT81JTCrWS87P3cQIDBMGINjB2Pjd6RCjJAeTkihv3dRLEUJ8SfkplRmJxRnxRaU5qcWH GGU4OJQkeG8fBcoJFqWmp1akZeYAAxYmLcHBoyTC63cMKM1bXJCYW5yZDpE6xajLMWf27jdMQ ix5+XmpUuK8AiBFAiBFGaV5cCNg0XOJUVZKmJcR6CghnoLUotzMElT5V4ziHIxKwryXjgBN4c nMK4Hb9AroCCagI8r2XAA5oiQRISXVwCj+ViGF1+tnn4bHxjJWiwtT+IpsnW+qz1t5Q8t+FpO J7dlpkxPeLtoWe8JwNV/J4SnbEwQdm7amys+uT6u0mJsoPdlBa6HakYMLdz/6/H7qrKAN0Qdt F5kHqE6rMpx3rod5wrYptwqdpO9wtmcsKo9VNduUfplVSiX2uYK0l/zhLx4Kud9aVyuxFGckG moxFxUnAgBk7NtumQIAAA== X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1490209438!90888776!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.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18262 invoked from network); 22 Mar 2017 19:04:00 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-10.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Mar 2017 19:04:00 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 436DA203E9; Wed, 22 Mar 2017 19:03:57 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.attlocal.net (104-6-25-238.lightspeed.sntcca.sbcglobal.net [104.6.25.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3C34203DC; Wed, 22 Mar 2017 19:03:54 +0000 (UTC) From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Wed, 22 Mar 2017 12:03:45 -0700 Message-Id: <1490209429-5542-3-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490209429-5542-1-git-send-email-sstabellini@kernel.org> References: <1490209429-5542-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: jgross@suse.com, Latchesar Ionkov , sstabellini@kernel.org, Eric Van Hensbergen , linux-kernel@vger.kernel.org, groug@kaod.org, Stefano Stabellini , v9fs-developer@lists.sourceforge.net, Ron Minnich Subject: [Xen-devel] [PATCH v6 3/7] xen/9pfs: introduce Xen 9pfs transport driver 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 Introduce the Xen 9pfs transport driver: add struct xenbus_driver to register as a xenbus driver and add struct p9_trans_module to register as v9fs driver. All functions are empty stubs for now. Signed-off-by: Stefano Stabellini Reviewed-by: Boris Ostrovsky Reviewed-by: Juergen Gross CC: groug@kaod.org CC: jgross@suse.com CC: Eric Van Hensbergen CC: Ron Minnich CC: Latchesar Ionkov CC: v9fs-developer@lists.sourceforge.net --- net/9p/trans_xen.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 net/9p/trans_xen.c diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c new file mode 100644 index 0000000..3d07260 --- /dev/null +++ b/net/9p/trans_xen.c @@ -0,0 +1,125 @@ +/* + * linux/fs/9p/trans_xen + * + * Xen transport layer. + * + * Copyright (C) 2017 by Stefano Stabellini + * + * 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. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static int p9_xen_cancel(struct p9_client *client, struct p9_req_t *req) +{ + return 0; +} + +static int p9_xen_create(struct p9_client *client, const char *addr, char *args) +{ + return 0; +} + +static void p9_xen_close(struct p9_client *client) +{ +} + +static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) +{ + return 0; +} + +static struct p9_trans_module p9_xen_trans = { + .name = "xen", + .maxsize = 1 << (XEN_9PFS_RING_ORDER + XEN_PAGE_SHIFT), + .def = 1, + .create = p9_xen_create, + .close = p9_xen_close, + .request = p9_xen_request, + .cancel = p9_xen_cancel, + .owner = THIS_MODULE, +}; + +static const struct xenbus_device_id xen_9pfs_front_ids[] = { + { "9pfs" }, + { "" } +}; + +static int xen_9pfs_front_remove(struct xenbus_device *dev) +{ + return 0; +} + +static int xen_9pfs_front_probe(struct xenbus_device *dev, + const struct xenbus_device_id *id) +{ + return 0; +} + +static int xen_9pfs_front_resume(struct xenbus_device *dev) +{ + return 0; +} + +static void xen_9pfs_front_changed(struct xenbus_device *dev, + enum xenbus_state backend_state) +{ +} + +static struct xenbus_driver xen_9pfs_front_driver = { + .ids = xen_9pfs_front_ids, + .probe = xen_9pfs_front_probe, + .remove = xen_9pfs_front_remove, + .resume = xen_9pfs_front_resume, + .otherend_changed = xen_9pfs_front_changed, +}; + +int p9_trans_xen_init(void) +{ + if (!xen_domain()) + return -ENODEV; + + pr_info("Initialising Xen transport for 9pfs\n"); + + v9fs_register_trans(&p9_xen_trans); + return xenbus_register_frontend(&xen_9pfs_front_driver); +} +module_init(p9_trans_xen_init); + +void p9_trans_xen_exit(void) +{ + v9fs_unregister_trans(&p9_xen_trans); + return xenbus_unregister_driver(&xen_9pfs_front_driver); +} +module_exit(p9_trans_xen_exit);