1b530cc79SEric Van Hensbergen /* 2fea511a6SEric Van Hensbergen * The Virtio 9p transport driver 3b530cc79SEric Van Hensbergen * 4e2735b77SEric Van Hensbergen * This is a block based transport driver based on the lguest block driver 5e2735b77SEric Van Hensbergen * code. 6b530cc79SEric Van Hensbergen * 7fea511a6SEric Van Hensbergen * Copyright (C) 2007, 2008 Eric Van Hensbergen, IBM Corporation 8b530cc79SEric Van Hensbergen * 9b530cc79SEric Van Hensbergen * Based on virtio console driver 10b530cc79SEric Van Hensbergen * Copyright (C) 2006, 2007 Rusty Russell, IBM Corporation 11b530cc79SEric Van Hensbergen * 12b530cc79SEric Van Hensbergen * This program is free software; you can redistribute it and/or modify 13b530cc79SEric Van Hensbergen * it under the terms of the GNU General Public License version 2 14b530cc79SEric Van Hensbergen * as published by the Free Software Foundation. 15b530cc79SEric Van Hensbergen * 16b530cc79SEric Van Hensbergen * This program is distributed in the hope that it will be useful, 17b530cc79SEric Van Hensbergen * but WITHOUT ANY WARRANTY; without even the implied warranty of 18b530cc79SEric Van Hensbergen * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19b530cc79SEric Van Hensbergen * GNU General Public License for more details. 20b530cc79SEric Van Hensbergen * 21b530cc79SEric Van Hensbergen * You should have received a copy of the GNU General Public License 22b530cc79SEric Van Hensbergen * along with this program; if not, write to: 23b530cc79SEric Van Hensbergen * Free Software Foundation 24b530cc79SEric Van Hensbergen * 51 Franklin Street, Fifth Floor 25b530cc79SEric Van Hensbergen * Boston, MA 02111-1301 USA 26b530cc79SEric Van Hensbergen * 27b530cc79SEric Van Hensbergen */ 28b530cc79SEric Van Hensbergen 29b530cc79SEric Van Hensbergen #include <linux/in.h> 30b530cc79SEric Van Hensbergen #include <linux/module.h> 31b530cc79SEric Van Hensbergen #include <linux/net.h> 32b530cc79SEric Van Hensbergen #include <linux/ipv6.h> 33b530cc79SEric Van Hensbergen #include <linux/errno.h> 34b530cc79SEric Van Hensbergen #include <linux/kernel.h> 35b530cc79SEric Van Hensbergen #include <linux/un.h> 36b530cc79SEric Van Hensbergen #include <linux/uaccess.h> 37b530cc79SEric Van Hensbergen #include <linux/inet.h> 38b530cc79SEric Van Hensbergen #include <linux/idr.h> 39b530cc79SEric Van Hensbergen #include <linux/file.h> 40b530cc79SEric Van Hensbergen #include <net/9p/9p.h> 41b530cc79SEric Van Hensbergen #include <linux/parser.h> 428b81ef58SEric Van Hensbergen #include <net/9p/client.h> 43b530cc79SEric Van Hensbergen #include <net/9p/transport.h> 44b530cc79SEric Van Hensbergen #include <linux/scatterlist.h> 45b530cc79SEric Van Hensbergen #include <linux/virtio.h> 46b530cc79SEric Van Hensbergen #include <linux/virtio_9p.h> 47b530cc79SEric Van Hensbergen 48e2735b77SEric Van Hensbergen #define VIRTQUEUE_NUM 128 49e2735b77SEric Van Hensbergen 50b530cc79SEric Van Hensbergen /* a single mutex to manage channel initialization and attachment */ 51c1549497SJosef 'Jeff' Sipek static DEFINE_MUTEX(virtio_9p_lock); 52b530cc79SEric Van Hensbergen 53ee443996SEric Van Hensbergen /** 54ee443996SEric Van Hensbergen * struct virtio_chan - per-instance transport information 55ee443996SEric Van Hensbergen * @initialized: whether the channel is initialized 56ee443996SEric Van Hensbergen * @inuse: whether the channel is in use 57ee443996SEric Van Hensbergen * @lock: protects multiple elements within this structure 580e15597eSAbhishek Kulkarni * @client: client instance 59ee443996SEric Van Hensbergen * @vdev: virtio dev associated with this channel 60ee443996SEric Van Hensbergen * @vq: virtio queue associated with this channel 61ee443996SEric Van Hensbergen * @sg: scatter gather list which is used to pack a request (protected?) 62ee443996SEric Van Hensbergen * 63ee443996SEric Van Hensbergen * We keep all per-channel information in a structure. 64b530cc79SEric Van Hensbergen * This structure is allocated within the devices dev->mem space. 65b530cc79SEric Van Hensbergen * A pointer to the structure will get put in the transport private. 66ee443996SEric Van Hensbergen * 67b530cc79SEric Van Hensbergen */ 68ee443996SEric Van Hensbergen 6937c1209dSAneesh Kumar K.V struct virtio_chan { 70ee443996SEric Van Hensbergen bool inuse; 71b530cc79SEric Van Hensbergen 72e2735b77SEric Van Hensbergen spinlock_t lock; 73e2735b77SEric Van Hensbergen 74fea511a6SEric Van Hensbergen struct p9_client *client; 75b530cc79SEric Van Hensbergen struct virtio_device *vdev; 76e2735b77SEric Van Hensbergen struct virtqueue *vq; 77b530cc79SEric Van Hensbergen 78e2735b77SEric Van Hensbergen /* Scatterlist: can be too big for stack. */ 79e2735b77SEric Van Hensbergen struct scatterlist sg[VIRTQUEUE_NUM]; 8037c1209dSAneesh Kumar K.V 8137c1209dSAneesh Kumar K.V struct list_head chan_list; 8237c1209dSAneesh Kumar K.V }; 8337c1209dSAneesh Kumar K.V 8437c1209dSAneesh Kumar K.V static struct list_head virtio_chan_list; 85b530cc79SEric Van Hensbergen 86b530cc79SEric Van Hensbergen /* How many bytes left in this page. */ 87b530cc79SEric Van Hensbergen static unsigned int rest_of_page(void *data) 88b530cc79SEric Van Hensbergen { 89b530cc79SEric Van Hensbergen return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE); 90b530cc79SEric Van Hensbergen } 91b530cc79SEric Van Hensbergen 92ee443996SEric Van Hensbergen /** 93ee443996SEric Van Hensbergen * p9_virtio_close - reclaim resources of a channel 940e15597eSAbhishek Kulkarni * @client: client instance 95ee443996SEric Van Hensbergen * 96ee443996SEric Van Hensbergen * This reclaims a channel by freeing its resources and 97ee443996SEric Van Hensbergen * reseting its inuse flag. 98ee443996SEric Van Hensbergen * 99ee443996SEric Van Hensbergen */ 100ee443996SEric Van Hensbergen 1018b81ef58SEric Van Hensbergen static void p9_virtio_close(struct p9_client *client) 102b530cc79SEric Van Hensbergen { 1038b81ef58SEric Van Hensbergen struct virtio_chan *chan = client->trans; 104b530cc79SEric Van Hensbergen 105c1549497SJosef 'Jeff' Sipek mutex_lock(&virtio_9p_lock); 106fb786100SAneesh Kumar K.V if (chan) 107b530cc79SEric Van Hensbergen chan->inuse = false; 108c1549497SJosef 'Jeff' Sipek mutex_unlock(&virtio_9p_lock); 109b530cc79SEric Van Hensbergen } 110b530cc79SEric Van Hensbergen 111ee443996SEric Van Hensbergen /** 112ee443996SEric Van Hensbergen * req_done - callback which signals activity from the server 113ee443996SEric Van Hensbergen * @vq: virtio queue activity was received on 114ee443996SEric Van Hensbergen * 115ee443996SEric Van Hensbergen * This notifies us that the server has triggered some activity 116ee443996SEric Van Hensbergen * on the virtio channel - most likely a response to request we 117ee443996SEric Van Hensbergen * sent. Figure out which requests now have responses and wake up 118ee443996SEric Van Hensbergen * those threads. 119ee443996SEric Van Hensbergen * 120ee443996SEric Van Hensbergen * Bugs: could do with some additional sanity checking, but appears to work. 121ee443996SEric Van Hensbergen * 122ee443996SEric Van Hensbergen */ 123ee443996SEric Van Hensbergen 124e2735b77SEric Van Hensbergen static void req_done(struct virtqueue *vq) 125b530cc79SEric Van Hensbergen { 126e2735b77SEric Van Hensbergen struct virtio_chan *chan = vq->vdev->priv; 127e2735b77SEric Van Hensbergen struct p9_fcall *rc; 128e2735b77SEric Van Hensbergen unsigned int len; 129e2735b77SEric Van Hensbergen struct p9_req_t *req; 130b530cc79SEric Van Hensbergen 13191b8534fSEric Van Hensbergen P9_DPRINTK(P9_DEBUG_TRANS, ": request done\n"); 13291b8534fSEric Van Hensbergen 133e2735b77SEric Van Hensbergen while ((rc = chan->vq->vq_ops->get_buf(chan->vq, &len)) != NULL) { 13491b8534fSEric Van Hensbergen P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc); 13591b8534fSEric Van Hensbergen P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag); 136fea511a6SEric Van Hensbergen req = p9_tag_lookup(chan->client, rc->tag); 1371bab88b2SLatchesar Ionkov req->status = REQ_STATUS_RCVD; 13891b8534fSEric Van Hensbergen p9_client_cb(chan->client, req); 139e2735b77SEric Van Hensbergen } 140b530cc79SEric Van Hensbergen } 141b530cc79SEric Van Hensbergen 142ee443996SEric Van Hensbergen /** 143ee443996SEric Van Hensbergen * pack_sg_list - pack a scatter gather list from a linear buffer 144ee443996SEric Van Hensbergen * @sg: scatter/gather list to pack into 145ee443996SEric Van Hensbergen * @start: which segment of the sg_list to start at 146ee443996SEric Van Hensbergen * @limit: maximum segment to pack data to 147ee443996SEric Van Hensbergen * @data: data to pack into scatter/gather list 148ee443996SEric Van Hensbergen * @count: amount of data to pack into the scatter/gather list 149ee443996SEric Van Hensbergen * 150ee443996SEric Van Hensbergen * sg_lists have multiple segments of various sizes. This will pack 151ee443996SEric Van Hensbergen * arbitrary data into an existing scatter gather list, segmenting the 152ee443996SEric Van Hensbergen * data as necessary within constraints. 153ee443996SEric Van Hensbergen * 154ee443996SEric Van Hensbergen */ 155ee443996SEric Van Hensbergen 156e2735b77SEric Van Hensbergen static int 157e2735b77SEric Van Hensbergen pack_sg_list(struct scatterlist *sg, int start, int limit, char *data, 158e2735b77SEric Van Hensbergen int count) 159e2735b77SEric Van Hensbergen { 160e2735b77SEric Van Hensbergen int s; 161e2735b77SEric Van Hensbergen int index = start; 162e2735b77SEric Van Hensbergen 163e2735b77SEric Van Hensbergen while (count) { 164e2735b77SEric Van Hensbergen s = rest_of_page(data); 165e2735b77SEric Van Hensbergen if (s > count) 166e2735b77SEric Van Hensbergen s = count; 167e2735b77SEric Van Hensbergen sg_set_buf(&sg[index++], data, s); 168e2735b77SEric Van Hensbergen count -= s; 169e2735b77SEric Van Hensbergen data += s; 170d6584f3aSJulia Lawall BUG_ON(index > limit); 171e2735b77SEric Van Hensbergen } 172e2735b77SEric Van Hensbergen 173e2735b77SEric Van Hensbergen return index-start; 174e2735b77SEric Van Hensbergen } 175e2735b77SEric Van Hensbergen 17691b8534fSEric Van Hensbergen /* We don't currently allow canceling of virtio requests */ 17791b8534fSEric Van Hensbergen static int p9_virtio_cancel(struct p9_client *client, struct p9_req_t *req) 17891b8534fSEric Van Hensbergen { 17991b8534fSEric Van Hensbergen return 1; 18091b8534fSEric Van Hensbergen } 18191b8534fSEric Van Hensbergen 182ee443996SEric Van Hensbergen /** 18391b8534fSEric Van Hensbergen * p9_virtio_request - issue a request 1840e15597eSAbhishek Kulkarni * @client: client instance issuing the request 1850e15597eSAbhishek Kulkarni * @req: request to be issued 186ee443996SEric Van Hensbergen * 187ee443996SEric Van Hensbergen */ 188ee443996SEric Van Hensbergen 189e2735b77SEric Van Hensbergen static int 19091b8534fSEric Van Hensbergen p9_virtio_request(struct p9_client *client, struct p9_req_t *req) 191e2735b77SEric Van Hensbergen { 192e2735b77SEric Van Hensbergen int in, out; 19391b8534fSEric Van Hensbergen struct virtio_chan *chan = client->trans; 19491b8534fSEric Van Hensbergen char *rdata = (char *)req->rc+sizeof(struct p9_fcall); 195e2735b77SEric Van Hensbergen 19691b8534fSEric Van Hensbergen P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n"); 197e2735b77SEric Van Hensbergen 19891b8534fSEric Van Hensbergen out = pack_sg_list(chan->sg, 0, VIRTQUEUE_NUM, req->tc->sdata, 19991b8534fSEric Van Hensbergen req->tc->size); 20091b8534fSEric Van Hensbergen in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM-out, rdata, 20191b8534fSEric Van Hensbergen client->msize); 202e2735b77SEric Van Hensbergen 203e2735b77SEric Van Hensbergen req->status = REQ_STATUS_SENT; 204e2735b77SEric Van Hensbergen 2053c1b27d5SRusty Russell if (chan->vq->vq_ops->add_buf(chan->vq, chan->sg, out, in, req->tc) < 0) { 206e2735b77SEric Van Hensbergen P9_DPRINTK(P9_DEBUG_TRANS, 207e2735b77SEric Van Hensbergen "9p debug: virtio rpc add_buf returned failure"); 208e2735b77SEric Van Hensbergen return -EIO; 209e2735b77SEric Van Hensbergen } 210e2735b77SEric Van Hensbergen 211e2735b77SEric Van Hensbergen chan->vq->vq_ops->kick(chan->vq); 212e2735b77SEric Van Hensbergen 21391b8534fSEric Van Hensbergen P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n"); 214e2735b77SEric Van Hensbergen return 0; 215e2735b77SEric Van Hensbergen } 216e2735b77SEric Van Hensbergen 217ee443996SEric Van Hensbergen /** 218ee443996SEric Van Hensbergen * p9_virtio_probe - probe for existence of 9P virtio channels 219ee443996SEric Van Hensbergen * @vdev: virtio device to probe 220ee443996SEric Van Hensbergen * 22137c1209dSAneesh Kumar K.V * This probes for existing virtio channels. 222ee443996SEric Van Hensbergen * 223ee443996SEric Van Hensbergen */ 224ee443996SEric Van Hensbergen 225e2735b77SEric Van Hensbergen static int p9_virtio_probe(struct virtio_device *vdev) 226b530cc79SEric Van Hensbergen { 227b530cc79SEric Van Hensbergen int err; 228b530cc79SEric Van Hensbergen struct virtio_chan *chan; 229b530cc79SEric Van Hensbergen 23037c1209dSAneesh Kumar K.V chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL); 23137c1209dSAneesh Kumar K.V if (!chan) { 23237c1209dSAneesh Kumar K.V printk(KERN_ERR "9p: Failed to allocate virtio 9P channel\n"); 233b530cc79SEric Van Hensbergen err = -ENOMEM; 234b530cc79SEric Van Hensbergen goto fail; 235b530cc79SEric Van Hensbergen } 236b530cc79SEric Van Hensbergen 237e2735b77SEric Van Hensbergen chan->vdev = vdev; 238e2735b77SEric Van Hensbergen 239e2735b77SEric Van Hensbergen /* We expect one virtqueue, for requests. */ 240d2a7dddaSMichael S. Tsirkin chan->vq = virtio_find_single_vq(vdev, req_done, "requests"); 241e2735b77SEric Van Hensbergen if (IS_ERR(chan->vq)) { 242e2735b77SEric Van Hensbergen err = PTR_ERR(chan->vq); 243e2735b77SEric Van Hensbergen goto out_free_vq; 244b530cc79SEric Van Hensbergen } 245e2735b77SEric Van Hensbergen chan->vq->vdev->priv = chan; 246e2735b77SEric Van Hensbergen spin_lock_init(&chan->lock); 247b530cc79SEric Van Hensbergen 248e2735b77SEric Van Hensbergen sg_init_table(chan->sg, VIRTQUEUE_NUM); 249b530cc79SEric Van Hensbergen 250b530cc79SEric Van Hensbergen chan->inuse = false; 25137c1209dSAneesh Kumar K.V mutex_lock(&virtio_9p_lock); 25237c1209dSAneesh Kumar K.V list_add_tail(&chan->chan_list, &virtio_chan_list); 25337c1209dSAneesh Kumar K.V mutex_unlock(&virtio_9p_lock); 254b530cc79SEric Van Hensbergen return 0; 255b530cc79SEric Van Hensbergen 256e2735b77SEric Van Hensbergen out_free_vq: 257d2a7dddaSMichael S. Tsirkin vdev->config->del_vqs(vdev); 25837c1209dSAneesh Kumar K.V kfree(chan); 259b530cc79SEric Van Hensbergen fail: 260b530cc79SEric Van Hensbergen return err; 261b530cc79SEric Van Hensbergen } 262b530cc79SEric Van Hensbergen 263ee443996SEric Van Hensbergen 264ee443996SEric Van Hensbergen /** 265ee443996SEric Van Hensbergen * p9_virtio_create - allocate a new virtio channel 2668b81ef58SEric Van Hensbergen * @client: client instance invoking this transport 267ee443996SEric Van Hensbergen * @devname: string identifying the channel to connect to (unused) 268ee443996SEric Van Hensbergen * @args: args passed from sys_mount() for per-transport options (unused) 269ee443996SEric Van Hensbergen * 270ee443996SEric Van Hensbergen * This sets up a transport channel for 9p communication. Right now 271b530cc79SEric Van Hensbergen * we only match the first available channel, but eventually we couldlook up 272b530cc79SEric Van Hensbergen * alternate channels by matching devname versus a virtio_config entry. 273b530cc79SEric Van Hensbergen * We use a simple reference count mechanism to ensure that only a single 274ee443996SEric Van Hensbergen * mount has a channel open at a time. 275ee443996SEric Van Hensbergen * 276ee443996SEric Van Hensbergen */ 277ee443996SEric Van Hensbergen 2788b81ef58SEric Van Hensbergen static int 2798b81ef58SEric Van Hensbergen p9_virtio_create(struct p9_client *client, const char *devname, char *args) 280b530cc79SEric Van Hensbergen { 28137c1209dSAneesh Kumar K.V struct virtio_chan *chan; 282*c1a7c226SAneesh Kumar K.V int ret = -ENOENT; 28337c1209dSAneesh Kumar K.V int found = 0; 284b530cc79SEric Van Hensbergen 285c1549497SJosef 'Jeff' Sipek mutex_lock(&virtio_9p_lock); 28637c1209dSAneesh Kumar K.V list_for_each_entry(chan, &virtio_chan_list, chan_list) { 28737c1209dSAneesh Kumar K.V if (!strcmp(devname, dev_name(&chan->vdev->dev))) { 288f75580c4SAneesh Kumar K.V if (!chan->inuse) { 289b530cc79SEric Van Hensbergen chan->inuse = true; 29037c1209dSAneesh Kumar K.V found = 1; 291b530cc79SEric Van Hensbergen break; 292f75580c4SAneesh Kumar K.V } 293*c1a7c226SAneesh Kumar K.V ret = -EBUSY; 294f75580c4SAneesh Kumar K.V } 295b530cc79SEric Van Hensbergen } 296c1549497SJosef 'Jeff' Sipek mutex_unlock(&virtio_9p_lock); 297b530cc79SEric Van Hensbergen 29837c1209dSAneesh Kumar K.V if (!found) { 299e2735b77SEric Van Hensbergen printk(KERN_ERR "9p: no channels available\n"); 300*c1a7c226SAneesh Kumar K.V return ret; 301b530cc79SEric Van Hensbergen } 302b530cc79SEric Van Hensbergen 3038b81ef58SEric Van Hensbergen client->trans = (void *)chan; 304562ada61SEric Van Hensbergen client->status = Connected; 305fea511a6SEric Van Hensbergen chan->client = client; 306b530cc79SEric Van Hensbergen 3078b81ef58SEric Van Hensbergen return 0; 308b530cc79SEric Van Hensbergen } 309b530cc79SEric Van Hensbergen 310ee443996SEric Van Hensbergen /** 311ee443996SEric Van Hensbergen * p9_virtio_remove - clean up resources associated with a virtio device 312ee443996SEric Van Hensbergen * @vdev: virtio device to remove 313ee443996SEric Van Hensbergen * 314ee443996SEric Van Hensbergen */ 315ee443996SEric Van Hensbergen 316f3933545SEric Van Hensbergen static void p9_virtio_remove(struct virtio_device *vdev) 317f3933545SEric Van Hensbergen { 318f3933545SEric Van Hensbergen struct virtio_chan *chan = vdev->priv; 319f3933545SEric Van Hensbergen 320f3933545SEric Van Hensbergen BUG_ON(chan->inuse); 321d2a7dddaSMichael S. Tsirkin vdev->config->del_vqs(vdev); 32237c1209dSAneesh Kumar K.V 32337c1209dSAneesh Kumar K.V mutex_lock(&virtio_9p_lock); 32437c1209dSAneesh Kumar K.V list_del(&chan->chan_list); 32537c1209dSAneesh Kumar K.V mutex_unlock(&virtio_9p_lock); 32637c1209dSAneesh Kumar K.V kfree(chan); 32737c1209dSAneesh Kumar K.V 328f3933545SEric Van Hensbergen } 329f3933545SEric Van Hensbergen 330b530cc79SEric Van Hensbergen static struct virtio_device_id id_table[] = { 331b530cc79SEric Van Hensbergen { VIRTIO_ID_9P, VIRTIO_DEV_ANY_ID }, 332b530cc79SEric Van Hensbergen { 0 }, 333b530cc79SEric Van Hensbergen }; 334b530cc79SEric Van Hensbergen 335b530cc79SEric Van Hensbergen /* The standard "struct lguest_driver": */ 336b530cc79SEric Van Hensbergen static struct virtio_driver p9_virtio_drv = { 337b530cc79SEric Van Hensbergen .driver.name = KBUILD_MODNAME, 338b530cc79SEric Van Hensbergen .driver.owner = THIS_MODULE, 339b530cc79SEric Van Hensbergen .id_table = id_table, 340b530cc79SEric Van Hensbergen .probe = p9_virtio_probe, 341f3933545SEric Van Hensbergen .remove = p9_virtio_remove, 342b530cc79SEric Van Hensbergen }; 343b530cc79SEric Van Hensbergen 344b530cc79SEric Van Hensbergen static struct p9_trans_module p9_virtio_trans = { 345b530cc79SEric Van Hensbergen .name = "virtio", 346b530cc79SEric Van Hensbergen .create = p9_virtio_create, 3478b81ef58SEric Van Hensbergen .close = p9_virtio_close, 34891b8534fSEric Van Hensbergen .request = p9_virtio_request, 34991b8534fSEric Van Hensbergen .cancel = p9_virtio_cancel, 350e2735b77SEric Van Hensbergen .maxsize = PAGE_SIZE*16, 351b530cc79SEric Van Hensbergen .def = 0, 35272029fe8STejun Heo .owner = THIS_MODULE, 353b530cc79SEric Van Hensbergen }; 354b530cc79SEric Van Hensbergen 355b530cc79SEric Van Hensbergen /* The standard init function */ 356b530cc79SEric Van Hensbergen static int __init p9_virtio_init(void) 357b530cc79SEric Van Hensbergen { 35837c1209dSAneesh Kumar K.V INIT_LIST_HEAD(&virtio_chan_list); 359b530cc79SEric Van Hensbergen 360b530cc79SEric Van Hensbergen v9fs_register_trans(&p9_virtio_trans); 361b530cc79SEric Van Hensbergen return register_virtio_driver(&p9_virtio_drv); 362b530cc79SEric Van Hensbergen } 363b530cc79SEric Van Hensbergen 364f3933545SEric Van Hensbergen static void __exit p9_virtio_cleanup(void) 365f3933545SEric Van Hensbergen { 366f3933545SEric Van Hensbergen unregister_virtio_driver(&p9_virtio_drv); 36772029fe8STejun Heo v9fs_unregister_trans(&p9_virtio_trans); 368f3933545SEric Van Hensbergen } 369f3933545SEric Van Hensbergen 370b530cc79SEric Van Hensbergen module_init(p9_virtio_init); 371f3933545SEric Van Hensbergen module_exit(p9_virtio_cleanup); 372b530cc79SEric Van Hensbergen 373b530cc79SEric Van Hensbergen MODULE_DEVICE_TABLE(virtio, id_table); 374b530cc79SEric Van Hensbergen MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>"); 375b530cc79SEric Van Hensbergen MODULE_DESCRIPTION("Virtio 9p Transport"); 376b530cc79SEric Van Hensbergen MODULE_LICENSE("GPL"); 377