SUNRPC: Clean up functions that free address_strings array

Clean up: document the rule (kfree) and the exceptions
(RPC_DISPLAY_PROTO and RPC_DISPLAY_NETID) when freeing the objects in
a transport's address_strings array.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Chuck Lever 2008-01-14 12:32:20 -05:00 committed by Trond Myklebust
parent c0e07cb68d
commit 33e01dc7f5
2 changed files with 20 additions and 12 deletions

View file

@ -212,12 +212,16 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
static void static void
xprt_rdma_free_addresses(struct rpc_xprt *xprt) xprt_rdma_free_addresses(struct rpc_xprt *xprt)
{ {
kfree(xprt->address_strings[RPC_DISPLAY_ADDR]); unsigned int i;
kfree(xprt->address_strings[RPC_DISPLAY_PORT]);
kfree(xprt->address_strings[RPC_DISPLAY_ALL]); for (i = 0; i < RPC_DISPLAY_MAX; i++)
kfree(xprt->address_strings[RPC_DISPLAY_HEX_ADDR]); switch (i) {
kfree(xprt->address_strings[RPC_DISPLAY_HEX_PORT]); case RPC_DISPLAY_PROTO:
kfree(xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR]); case RPC_DISPLAY_NETID:
continue;
default:
kfree(xprt->address_strings[i]);
}
} }
static void static void

View file

@ -398,12 +398,16 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
static void xs_free_peer_addresses(struct rpc_xprt *xprt) static void xs_free_peer_addresses(struct rpc_xprt *xprt)
{ {
kfree(xprt->address_strings[RPC_DISPLAY_ADDR]); unsigned int i;
kfree(xprt->address_strings[RPC_DISPLAY_PORT]);
kfree(xprt->address_strings[RPC_DISPLAY_ALL]); for (i = 0; i < RPC_DISPLAY_MAX; i++)
kfree(xprt->address_strings[RPC_DISPLAY_HEX_ADDR]); switch (i) {
kfree(xprt->address_strings[RPC_DISPLAY_HEX_PORT]); case RPC_DISPLAY_PROTO:
kfree(xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR]); case RPC_DISPLAY_NETID:
continue;
default:
kfree(xprt->address_strings[i]);
}
} }
#define XS_SENDMSG_FLAGS (MSG_DONTWAIT | MSG_NOSIGNAL) #define XS_SENDMSG_FLAGS (MSG_DONTWAIT | MSG_NOSIGNAL)