Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754724AbdCFUND (ORCPT ); Mon, 6 Mar 2017 15:13:03 -0500 Received: from mail.kernel.org ([198.145.29.136]:51930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754358AbdCFULU (ORCPT ); Mon, 6 Mar 2017 15:11:20 -0500 From: Stefano Stabellini To: xen-devel@lists.xenproject.org Cc: linux-kernel@vger.kernel.org, sstabellini@kernel.org, Stefano Stabellini , boris.ostrovsky@oracle.com, jgross@suse.com, Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , v9fs-developer@lists.sourceforge.net Subject: [PATCH 3/7] xen/9pfs: introduce Xen 9pfs transport driver Date: Mon, 6 Mar 2017 12:01:24 -0800 Message-Id: <1488830488-18506-3-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488830488-18506-1-git-send-email-sstabellini@kernel.org> References: <1488830488-18506-1-git-send-email-sstabellini@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2962 Lines: 127 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 CC: boris.ostrovsky@oracle.com 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 | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 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..877dfd0 --- /dev/null +++ b/net/9p/trans_xen.c @@ -0,0 +1,101 @@ +/* + * linux/fs/9p/trans_xen + * + * Xen transport layer. + * + * Copyright (C) 2017 by Stefano Stabellini + */ + +#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); -- 1.9.1