SUNRPC: Create a helper to tell whether a transport is bound
Hide the contents and format of xprt->addr by eliminating direct uses of the xprt->addr.sin_port field. This change is required to support alternate RPC host address formats (eg IPv6). Test-plan: Destructive testing (unplugging the network temporarily). Repeated runs of Connectathon locking suite with UDP and TCP. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:

committed by
Trond Myklebust

parent
9c5bf38d85
commit
ec739ef03d
@@ -269,6 +269,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
|
||||
#define XPRT_CONNECTED (1)
|
||||
#define XPRT_CONNECTING (2)
|
||||
#define XPRT_CLOSE_WAIT (3)
|
||||
#define XPRT_BOUND (4)
|
||||
|
||||
static inline void xprt_set_connected(struct rpc_xprt *xprt)
|
||||
{
|
||||
@@ -312,6 +313,21 @@ static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt)
|
||||
return test_and_set_bit(XPRT_CONNECTING, &xprt->state);
|
||||
}
|
||||
|
||||
static inline void xprt_set_bound(struct rpc_xprt *xprt)
|
||||
{
|
||||
test_and_set_bit(XPRT_BOUND, &xprt->state);
|
||||
}
|
||||
|
||||
static inline int xprt_bound(struct rpc_xprt *xprt)
|
||||
{
|
||||
return test_bit(XPRT_BOUND, &xprt->state);
|
||||
}
|
||||
|
||||
static inline void xprt_clear_bound(struct rpc_xprt *xprt)
|
||||
{
|
||||
clear_bit(XPRT_BOUND, &xprt->state);
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__*/
|
||||
|
||||
#endif /* _LINUX_SUNRPC_XPRT_H */
|
||||
|
Reference in New Issue
Block a user