summaryrefslogtreecommitdiff
path: root/net/sunrpc/svc_xprt.c
diff options
context:
space:
mode:
authorTom Tucker <tom@opengridcomputing.com>2007-12-31 06:08:31 +0300
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-02-02 00:42:13 +0300
commitdc9a16e49dbba3dd042e6aec5d9a7929e099a89b (patch)
tree5aee4ec75869697350d3cebdfaaf8e10435ebbc2 /net/sunrpc/svc_xprt.c
parent260c1d1298f6703d38fdccd3dd5a310766327340 (diff)
downloadlinux-dc9a16e49dbba3dd042e6aec5d9a7929e099a89b.tar.xz
svc: Add /proc/sys/sunrpc/transport files
Add a file that when read lists the set of registered svc transports. Signed-off-by: Tom Tucker <tom@opengridcomputing.com> Acked-by: Neil Brown <neilb@suse.de> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Greg Banks <gnb@sgi.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r--net/sunrpc/svc_xprt.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 000c7dc3b82c..2e5b92ae24ed 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -112,6 +112,34 @@ void svc_unreg_xprt_class(struct svc_xprt_class *xcl)
}
EXPORT_SYMBOL_GPL(svc_unreg_xprt_class);
+/*
+ * Format the transport list for printing
+ */
+int svc_print_xprts(char *buf, int maxlen)
+{
+ struct list_head *le;
+ char tmpstr[80];
+ int len = 0;
+ buf[0] = '\0';
+
+ spin_lock(&svc_xprt_class_lock);
+ list_for_each(le, &svc_xprt_class_list) {
+ int slen;
+ struct svc_xprt_class *xcl =
+ list_entry(le, struct svc_xprt_class, xcl_list);
+
+ sprintf(tmpstr, "%s %d\n", xcl->xcl_name, xcl->xcl_max_payload);
+ slen = strlen(tmpstr);
+ if (len + slen > maxlen)
+ break;
+ len += slen;
+ strcat(buf, tmpstr);
+ }
+ spin_unlock(&svc_xprt_class_lock);
+
+ return len;
+}
+
static void svc_xprt_free(struct kref *kref)
{
struct svc_xprt *xprt =