Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188019
b: refs/heads/master
c: 86c8437
h: refs/heads/master
i:
  188017: 041de01
  188015: 0381387
v: v3
  • Loading branch information
Aneesh Kumar K.V authored and Eric Van Hensbergen committed Mar 13, 2010
1 parent 87fa756 commit dffc7f5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 97ee9b0257402f4731b55dfea42f24d26d793ddf
refs/heads/master: 86c8437383acd85c05ec7c9a004f59fe7ac9821a
1 change: 1 addition & 0 deletions trunk/include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct virtio_device {
void *priv;
};

#define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev)
int register_virtio_device(struct virtio_device *dev);
void unregister_virtio_device(struct virtio_device *dev);

Expand Down
20 changes: 20 additions & 0 deletions trunk/net/9p/trans_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,20 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
return 0;
}

static ssize_t p9_mount_tag_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct virtio_chan *chan;
struct virtio_device *vdev;

vdev = dev_to_virtio(dev);
chan = vdev->priv;

return snprintf(buf, chan->tag_len + 1, "%s", chan->tag);
}

static DEVICE_ATTR(mount_tag, 0444, p9_mount_tag_show, NULL);

/**
* p9_virtio_probe - probe for existence of 9P virtio channels
* @vdev: virtio device to probe
Expand Down Expand Up @@ -273,6 +287,11 @@ static int p9_virtio_probe(struct virtio_device *vdev)
tag, tag_len);
chan->tag = tag;
chan->tag_len = tag_len;
err = sysfs_create_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
if (err) {
kfree(tag);
goto out_free_vq;
}
mutex_lock(&virtio_9p_lock);
list_add_tail(&chan->chan_list, &virtio_chan_list);
mutex_unlock(&virtio_9p_lock);
Expand Down Expand Up @@ -348,6 +367,7 @@ static void p9_virtio_remove(struct virtio_device *vdev)
mutex_lock(&virtio_9p_lock);
list_del(&chan->chan_list);
mutex_unlock(&virtio_9p_lock);
sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
kfree(chan->tag);
kfree(chan);

Expand Down

0 comments on commit dffc7f5

Please sign in to comment.