diff mbox

[V9fs-developer,1/5,net/9p] Add capability() to p9_trans_module

Message ID 1282066045-3945-2-git-send-email-jvrao@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

jvrao Aug. 17, 2010, 5:27 p.m. UTC
None
diff mbox

Patch

diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 6d5886e..495a118 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -25,6 +25,7 @@ 
 
 #ifndef NET_9P_TRANSPORT_H
 #define NET_9P_TRANSPORT_H
+#define P9_CAP_GET_MAX_SG_PAGES 0x01
 
 /**
  * struct p9_trans_module - transport module interface
@@ -53,6 +54,7 @@  struct p9_trans_module {
 	void (*close) (struct p9_client *);
 	int (*request) (struct p9_client *, struct p9_req_t *req);
 	int (*cancel) (struct p9_client *, struct p9_req_t *req);
+	int (*capability) (int req);
 };
 
 void v9fs_register_trans(struct p9_trans_module *m);
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index dcfbe99..762c19f 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -374,6 +374,18 @@  static void p9_virtio_remove(struct virtio_device *vdev)
 
 }
 
+/**
+ * p9_virtio_capability - Return the queried capability related information.
+ *
+ */
+static int p9_virtio_capability(int req)
+{
+	int ret = 0;
+	if (req == P9_CAP_GET_MAX_SG_PAGES)
+		ret = VIRTQUEUE_NUM - 8; /* Keep 8 for in/out headers */
+	return ret;
+}
+
 static struct virtio_device_id id_table[] = {
 	{ VIRTIO_ID_9P, VIRTIO_DEV_ANY_ID },
 	{ 0 },
@@ -400,6 +412,7 @@  static struct p9_trans_module p9_virtio_trans = {
 	.close = p9_virtio_close,
 	.request = p9_virtio_request,
 	.cancel = p9_virtio_cancel,
+	.capability = p9_virtio_capability,
 	.maxsize = PAGE_SIZE*16,
 	.def = 0,
 	.owner = THIS_MODULE,