diff options
author | Stefano Stabellini <sstabellini@kernel.org> | 2017-04-05 15:03:57 -0400 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2017-05-02 05:11:17 -0400 |
commit | 868eb122739a588f2cd873308b9ff1f00849b8fd (patch) | |
tree | 3dd6f4bfca3f001bdf38f5daf62af8fe7d94eaec | |
parent | 04c40dfc8d7965e722b6e99352e2bfc2f5637359 (diff) |
xen/9pfs: introduce Xen 9pfs transport driver
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.
CC: groug@kaod.org
CC: jgross@suse.com
CC: Eric Van Hensbergen <ericvh@gmail.com>
CC: Ron Minnich <rminnich@sandia.gov>
CC: Latchesar Ionkov <lucho@ionkov.net>
CC: v9fs-developer@lists.sourceforge.net
Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
-rw-r--r-- | net/9p/trans_xen.c | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c new file mode 100644 index 000000000000..3d072605e6a1 --- /dev/null +++ b/net/9p/trans_xen.c | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * linux/fs/9p/trans_xen | ||
3 | * | ||
4 | * Xen transport layer. | ||
5 | * | ||
6 | * Copyright (C) 2017 by Stefano Stabellini <stefano@aporeto.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation; or, when distributed | ||
11 | * separately from the Linux kernel or incorporated into other | ||
12 | * software packages, subject to the following license: | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
15 | * of this source file (the "Software"), to deal in the Software without | ||
16 | * restriction, including without limitation the rights to use, copy, modify, | ||
17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
18 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
19 | * the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | #include <xen/events.h> | ||
34 | #include <xen/grant_table.h> | ||
35 | #include <xen/xen.h> | ||
36 | #include <xen/xenbus.h> | ||
37 | #include <xen/interface/io/9pfs.h> | ||
38 | |||
39 | #include <linux/module.h> | ||
40 | #include <net/9p/9p.h> | ||
41 | #include <net/9p/client.h> | ||
42 | #include <net/9p/transport.h> | ||
43 | |||
44 | static int p9_xen_cancel(struct p9_client *client, struct p9_req_t *req) | ||
45 | { | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static int p9_xen_create(struct p9_client *client, const char *addr, char *args) | ||
50 | { | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static void p9_xen_close(struct p9_client *client) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) | ||
59 | { | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static struct p9_trans_module p9_xen_trans = { | ||
64 | .name = "xen", | ||
65 | .maxsize = 1 << (XEN_9PFS_RING_ORDER + XEN_PAGE_SHIFT), | ||
66 | .def = 1, | ||
67 | .create = p9_xen_create, | ||
68 | .close = p9_xen_close, | ||
69 | .request = p9_xen_request, | ||
70 | .cancel = p9_xen_cancel, | ||
71 | .owner = THIS_MODULE, | ||
72 | }; | ||
73 | |||
74 | static const struct xenbus_device_id xen_9pfs_front_ids[] = { | ||
75 | { "9pfs" }, | ||
76 | { "" } | ||
77 | }; | ||
78 | |||
79 | static int xen_9pfs_front_remove(struct xenbus_device *dev) | ||
80 | { | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | static int xen_9pfs_front_probe(struct xenbus_device *dev, | ||
85 | const struct xenbus_device_id *id) | ||
86 | { | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static int xen_9pfs_front_resume(struct xenbus_device *dev) | ||
91 | { | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static void xen_9pfs_front_changed(struct xenbus_device *dev, | ||
96 | enum xenbus_state backend_state) | ||
97 | { | ||
98 | } | ||
99 | |||
100 | static struct xenbus_driver xen_9pfs_front_driver = { | ||
101 | .ids = xen_9pfs_front_ids, | ||
102 | .probe = xen_9pfs_front_probe, | ||
103 | .remove = xen_9pfs_front_remove, | ||
104 | .resume = xen_9pfs_front_resume, | ||
105 | .otherend_changed = xen_9pfs_front_changed, | ||
106 | }; | ||
107 | |||
108 | int p9_trans_xen_init(void) | ||
109 | { | ||
110 | if (!xen_domain()) | ||
111 | return -ENODEV; | ||
112 | |||
113 | pr_info("Initialising Xen transport for 9pfs\n"); | ||
114 | |||
115 | v9fs_register_trans(&p9_xen_trans); | ||
116 | return xenbus_register_frontend(&xen_9pfs_front_driver); | ||
117 | } | ||
118 | module_init(p9_trans_xen_init); | ||
119 | |||
120 | void p9_trans_xen_exit(void) | ||
121 | { | ||
122 | v9fs_unregister_trans(&p9_xen_trans); | ||
123 | return xenbus_unregister_driver(&xen_9pfs_front_driver); | ||
124 | } | ||
125 | module_exit(p9_trans_xen_exit); | ||