Commit 1fc5f131 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Add a helper to return the transport identifier given a netid

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 9bccd264
...@@ -386,6 +386,7 @@ xprt_disable_swap(struct rpc_xprt *xprt) ...@@ -386,6 +386,7 @@ xprt_disable_swap(struct rpc_xprt *xprt)
int xprt_register_transport(struct xprt_class *type); int xprt_register_transport(struct xprt_class *type);
int xprt_unregister_transport(struct xprt_class *type); int xprt_unregister_transport(struct xprt_class *type);
int xprt_load_transport(const char *); int xprt_load_transport(const char *);
int xprt_find_transport_ident(const char *);
void xprt_wait_for_reply_request_def(struct rpc_task *task); void xprt_wait_for_reply_request_def(struct rpc_task *task);
void xprt_wait_for_reply_request_rtt(struct rpc_task *task); void xprt_wait_for_reply_request_rtt(struct rpc_task *task);
void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
......
...@@ -219,22 +219,39 @@ xprt_class_find_by_netid(const char *netid) ...@@ -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 * @netid: transport to load
* *
* Returns: * Returns:
* 0: transport successfully loaded * > 0: transport identifier
* -ENOENT: transport module not available * -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; const struct xprt_class *t;
int ret;
t = xprt_class_find_by_netid(netid); t = xprt_class_find_by_netid(netid);
if (!t) if (!t)
return -ENOENT; return -ENOENT;
ret = t->ident;
xprt_class_release(t); 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); EXPORT_SYMBOL_GPL(xprt_load_transport);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment