summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2020-11-10 09:41:21 -0500
committerTrond Myklebust <trond.myklebust@hammerspace.com>2020-12-02 14:05:52 -0500
commit1fc5f13186440973e1aa1d85aa263326756af431 (patch)
treebeb742caba6957bf90e414a551ff19387b1e95d6 /net/sunrpc
parent9bccd264611b5345d85138dc7fd55bdeb9e6942e (diff)
downloadlinux-1fc5f13186440973e1aa1d85aa263326756af431.tar.bz2
SUNRPC: Add a helper to return the transport identifier given a netid
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprt.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index bf490d0c98c6..23452f57d369 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -219,22 +219,39 @@ xprt_class_find_by_netid(const char *netid)
}
/**
- * xprt_load_transport - load a transport implementation
+ * xprt_find_transport_ident - convert a netid into a transport identifier
* @netid: transport to load
*
* Returns:
- * 0: transport successfully loaded
+ * > 0: transport identifier
* -ENOENT: transport module not available
*/
-int xprt_load_transport(const char *netid)
+int xprt_find_transport_ident(const char *netid)
{
const struct xprt_class *t;
+ int ret;
t = xprt_class_find_by_netid(netid);
if (!t)
return -ENOENT;
+ ret = t->ident;
xprt_class_release(t);
- return 0;
+ return ret;
+}
+EXPORT_SYMBOL_GPL(xprt_find_transport_ident);
+
+/**
+ * xprt_load_transport - load a transport implementation
+ * @netid: transport to load
+ *
+ * Returns:
+ * 0: transport successfully loaded
+ * -ENOENT: transport module not available
+ */
+int xprt_load_transport(const char *netid)
+{
+ int ret = xprt_find_transport_ident(netid);
+ return ret < 0 ? ret : 0;
}
EXPORT_SYMBOL_GPL(xprt_load_transport);