Commit 78851e1a authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NLM: Shrink the IPv4-only version of nlm_cmp_addr()

Clean up/micro-optimatization:  Make the AF_INET-only version of
nlm_cmp_addr() smaller.  This matches the style of
nlm_privileged_requester(), and makes the AF_INET-only version of
nlm_cmp_addr() nearly the same size as it was before IPv6 support.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent ae46141f
...@@ -346,6 +346,7 @@ static inline int __nlm_cmp_addr4(const struct sockaddr *sap1, ...@@ -346,6 +346,7 @@ static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
} }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
const struct sockaddr *sap2) const struct sockaddr *sap2)
{ {
...@@ -353,6 +354,13 @@ static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, ...@@ -353,6 +354,13 @@ static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
} }
#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
const struct sockaddr *sap2)
{
return 0;
}
#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
/* /*
* Compare two host addresses * Compare two host addresses
......
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