diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2006-08-22 20:06:18 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-09-22 23:24:48 -0400 |
commit | f425eba437f0051bde979ea2eef8bc875a77cd00 (patch) | |
tree | c64aae65d42c1bd67604ec0ffe957c03dc3233fe | |
parent | edb267a688fcee5335d596752f117a30c7152e44 (diff) |
SUNRPC: Create API for displaying remote peer address
Provide an API for formatting the remote peer address for printing without
exposing its internal structure. The address could be dynamic, so we
support a function call to get the address rather than reading it straight
out of a structure.
Test-plan:
Destructive testing (unplugging the network temporarily). Probably need
to rig a server where certain services aren't running, or that returns an
error for some typical operation.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | include/linux/sunrpc/clnt.h | 1 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 65196b03f0ab..b7d47f018353 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -124,6 +124,7 @@ size_t rpc_max_payload(struct rpc_clnt *); | |||
124 | void rpc_force_rebind(struct rpc_clnt *); | 124 | void rpc_force_rebind(struct rpc_clnt *); |
125 | int rpc_ping(struct rpc_clnt *clnt, int flags); | 125 | int rpc_ping(struct rpc_clnt *clnt, int flags); |
126 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); | 126 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); |
127 | char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); | ||
127 | 128 | ||
128 | /* | 129 | /* |
129 | * Helper function for NFSroot support | 130 | * Helper function for NFSroot support |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 94768cf5fd5b..e5b19e348d88 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -554,6 +554,19 @@ size_t rpc_peeraddr(struct rpc_clnt *clnt, struct sockaddr *buf, size_t bufsize) | |||
554 | } | 554 | } |
555 | EXPORT_SYMBOL(rpc_peeraddr); | 555 | EXPORT_SYMBOL(rpc_peeraddr); |
556 | 556 | ||
557 | /** | ||
558 | * rpc_peeraddr2str - return remote peer address in printable format | ||
559 | * @clnt: RPC client structure | ||
560 | * @format: address format | ||
561 | * | ||
562 | */ | ||
563 | char *rpc_peeraddr2str(struct rpc_clnt *clnt, enum rpc_display_format_t format) | ||
564 | { | ||
565 | struct rpc_xprt *xprt = clnt->cl_xprt; | ||
566 | return xprt->ops->print_addr(xprt, format); | ||
567 | } | ||
568 | EXPORT_SYMBOL(rpc_peeraddr2str); | ||
569 | |||
557 | void | 570 | void |
558 | rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize) | 571 | rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize) |
559 | { | 572 | { |