From: Anna Schumaker Date: Mon, 13 Jul 2015 18:01:27 +0000 (-0400) Subject: SUNRPC: Add an rpc_cmp_addr_port() function X-Git-Tag: Ubuntu-5.0.0-8.9~8739^2~67 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=58cc8a55aa38655d472a4c381df465c9ab97b4d6;p=mirror_ubuntu-disco-kernel.git SUNRPC: Add an rpc_cmp_addr_port() function This function is to help determine if two sockaddrs are really the same socket. Signed-off-by: Anna Schumaker Signed-off-by: Trond Myklebust --- diff --git a/include/linux/sunrpc/addr.h b/include/linux/sunrpc/addr.h index 772faefc15aa..9bc3538d09a9 100644 --- a/include/linux/sunrpc/addr.h +++ b/include/linux/sunrpc/addr.h @@ -130,6 +130,19 @@ static inline bool rpc_cmp_addr(const struct sockaddr *sap1, return false; } +/** + * rpc_cmp_addr_port - compare the address and port number of two sockaddrs. + * @sap1: first sockaddr + * @sap2: second sockaddr + */ +static inline bool rpc_cmp_addr_port(const struct sockaddr *sap1, + const struct sockaddr *sap2) +{ + if (!rpc_cmp_addr(sap1, sap2)) + return false; + return rpc_get_port(sap1) == rpc_get_port(sap2); +} + /** * rpc_copy_addr - copy the address portion of one sockaddr to another * @dst: destination sockaddr