diff mbox

[V9fs-developer,1/2] net/9p: Use the tag name in the config space for identifying mount point

Message ID 1266558347-11796-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Aneesh Kumar K.V Feb. 19, 2010, 5:45 a.m. UTC
None
diff mbox

Patch

diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 3322750..46ed18f 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -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 */
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 0aaed48..7ae27d2 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -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;