aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
diff options
context:
space:
mode:
Diffstat (limited to 'net/9p')
-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