RDMA/core: Return bool instead of int
Return bool for following internal and inline functions as their underlying APIs return bool too. 1. cma_zero_addr() 2. cma_loopback_addr() 3. cma_any_addr() 4. ib_addr_any() 5. ib_addr_loopback() While we are touching cma_loopback_addr(), remove extra white spaces in it. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
05e0b86c41
commit
ca3a8ace2b
|
@ -1046,35 +1046,38 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
|
|||
}
|
||||
EXPORT_SYMBOL(rdma_init_qp_attr);
|
||||
|
||||
static inline int cma_zero_addr(const struct sockaddr *addr)
|
||||
static inline bool cma_zero_addr(const struct sockaddr *addr)
|
||||
{
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
return ipv4_is_zeronet(((struct sockaddr_in *)addr)->sin_addr.s_addr);
|
||||
case AF_INET6:
|
||||
return ipv6_addr_any(&((struct sockaddr_in6 *) addr)->sin6_addr);
|
||||
return ipv6_addr_any(&((struct sockaddr_in6 *)addr)->sin6_addr);
|
||||
case AF_IB:
|
||||
return ib_addr_any(&((struct sockaddr_ib *) addr)->sib_addr);
|
||||
return ib_addr_any(&((struct sockaddr_ib *)addr)->sib_addr);
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int cma_loopback_addr(const struct sockaddr *addr)
|
||||
static inline bool cma_loopback_addr(const struct sockaddr *addr)
|
||||
{
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
return ipv4_is_loopback(((struct sockaddr_in *) addr)->sin_addr.s_addr);
|
||||
return ipv4_is_loopback(
|
||||
((struct sockaddr_in *)addr)->sin_addr.s_addr);
|
||||
case AF_INET6:
|
||||
return ipv6_addr_loopback(&((struct sockaddr_in6 *) addr)->sin6_addr);
|
||||
return ipv6_addr_loopback(
|
||||
&((struct sockaddr_in6 *)addr)->sin6_addr);
|
||||
case AF_IB:
|
||||
return ib_addr_loopback(&((struct sockaddr_ib *) addr)->sib_addr);
|
||||
return ib_addr_loopback(
|
||||
&((struct sockaddr_ib *)addr)->sib_addr);
|
||||
default:
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int cma_any_addr(const struct sockaddr *addr)
|
||||
static inline bool cma_any_addr(const struct sockaddr *addr)
|
||||
{
|
||||
return cma_zero_addr(addr) || cma_loopback_addr(addr);
|
||||
}
|
||||
|
|
|
@ -53,12 +53,12 @@ struct ib_addr {
|
|||
#define sib_interface_id ib_u.uib_addr64[1]
|
||||
};
|
||||
|
||||
static inline int ib_addr_any(const struct ib_addr *a)
|
||||
static inline bool ib_addr_any(const struct ib_addr *a)
|
||||
{
|
||||
return ((a->sib_addr64[0] | a->sib_addr64[1]) == 0);
|
||||
}
|
||||
|
||||
static inline int ib_addr_loopback(const struct ib_addr *a)
|
||||
static inline bool ib_addr_loopback(const struct ib_addr *a)
|
||||
{
|
||||
return ((a->sib_addr32[0] | a->sib_addr32[1] |
|
||||
a->sib_addr32[2] | (a->sib_addr32[3] ^ htonl(1))) == 0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user