@@ -4,5 +4,11 @@
* compatible drivers/servers. */
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
+#define MAX_TAG_LEN 8
+
+struct virtio_9p_config {
+ /* tag name for the mount point */
+ __u8 tag[MAX_TAG_LEN];
+} __attribute__((packed));
#endif /* _LINUX_VIRTIO_9P_H */
@@ -78,6 +78,9 @@ struct virtio_chan {
/* Scatterlist: can be too big for stack. */
struct scatterlist sg[VIRTQUEUE_NUM];
+ /* tag name to identify a mount */
+ __u8 tag[MAX_TAG_LEN];
+
struct list_head chan_list;
};
@@ -224,6 +227,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
static int p9_virtio_probe(struct virtio_device *vdev)
{
+ __u8 tag[MAX_TAG_LEN];
int err;
struct virtio_chan *chan;
@@ -248,6 +252,9 @@ static int p9_virtio_probe(struct virtio_device *vdev)
sg_init_table(chan->sg, VIRTQUEUE_NUM);
chan->inuse = false;
+ vdev->config->get(vdev, offsetof(struct virtio_9p_config, tag),
+ tag, sizeof(tag));
+ memcpy(chan->tag, tag, MAX_TAG_LEN);
mutex_lock(&virtio_9p_lock);
list_add_tail(&chan->chan_list, &virtio_chan_list);
mutex_unlock(&virtio_9p_lock);
@@ -284,7 +291,7 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
mutex_lock(&virtio_9p_lock);
list_for_each_entry(chan, &virtio_chan_list, chan_list) {
- if (!strcmp(devname, dev_name(&chan->vdev->dev))) {
+ if (!strncmp(devname, chan->tag, MAX_TAG_LEN)) {
if (!chan->inuse) {
chan->inuse = true;
found = 1;