aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p/trans_virtio.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-03-05 23:44:15 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2010-03-13 09:57:29 -0500
commit86c8437383acd85c05ec7c9a004f59fe7ac9821a (patch)
tree05c2b805162f0aaf8f7d52e0b7fab4e12f8dcb75 /net/9p/trans_virtio.c
parent97ee9b0257402f4731b55dfea42f24d26d793ddf (diff)
net/9p: Add sysfs mount_tag file for virtio 9P device
This adds a new file for virtio 9P device. The file contain details of the mount device name that should be used to mount the 9P file system. Ex: /sys/devices/virtio-pci/virtio1/mount_tag file now contian the tag name to be used to mount the 9P file system. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/trans_virtio.c')
-rw-r--r--net/9p/trans_virtio.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 026775ad391a..afde1a89fbb3 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -220,6 +220,20 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
220 return 0; 220 return 0;
221} 221}
222 222
223static ssize_t p9_mount_tag_show(struct device *dev,
224 struct device_attribute *attr, char *buf)
225{
226 struct virtio_chan *chan;
227 struct virtio_device *vdev;
228
229 vdev = dev_to_virtio(dev);
230 chan = vdev->priv;
231
232 return snprintf(buf, chan->tag_len + 1, "%s", chan->tag);
233}
234
235static DEVICE_ATTR(mount_tag, 0444, p9_mount_tag_show, NULL);
236
223/** 237/**
224 * p9_virtio_probe - probe for existence of 9P virtio channels 238 * p9_virtio_probe - probe for existence of 9P virtio channels
225 * @vdev: virtio device to probe 239 * @vdev: virtio device to probe
@@ -273,6 +287,11 @@ static int p9_virtio_probe(struct virtio_device *vdev)
273 tag, tag_len); 287 tag, tag_len);
274 chan->tag = tag; 288 chan->tag = tag;
275 chan->tag_len = tag_len; 289 chan->tag_len = tag_len;
290 err = sysfs_create_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
291 if (err) {
292 kfree(tag);
293 goto out_free_vq;
294 }
276 mutex_lock(&virtio_9p_lock); 295 mutex_lock(&virtio_9p_lock);
277 list_add_tail(&chan->chan_list, &virtio_chan_list); 296 list_add_tail(&chan->chan_list, &virtio_chan_list);
278 mutex_unlock(&virtio_9p_lock); 297 mutex_unlock(&virtio_9p_lock);
@@ -348,6 +367,7 @@ static void p9_virtio_remove(struct virtio_device *vdev)
348 mutex_lock(&virtio_9p_lock); 367 mutex_lock(&virtio_9p_lock);
349 list_del(&chan->chan_list); 368 list_del(&chan->chan_list);
350 mutex_unlock(&virtio_9p_lock); 369 mutex_unlock(&virtio_9p_lock);
370 sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
351 kfree(chan->tag); 371 kfree(chan->tag);
352 kfree(chan); 372 kfree(chan);
353 373