migration/rdma: define htonll/ntohll only if not predefined
Solaris has #defines for htonll and ntohll which cause syntax errors when compiling code that attempts to (re)define these functions.. Signed-off-by: Nick Briggs <nicholas.h.briggs@gmail.com> Link: https://lore.kernel.org/r/65a04a7d.497ab3.3e7bef1f@gateway.sonic.net Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
eb9f6daae4
commit
44ce1b5d2f
@ -238,6 +238,7 @@ static const char *control_desc(unsigned int rdma_control)
|
|||||||
return strs[rdma_control];
|
return strs[rdma_control];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(htonll)
|
||||||
static uint64_t htonll(uint64_t v)
|
static uint64_t htonll(uint64_t v)
|
||||||
{
|
{
|
||||||
union { uint32_t lv[2]; uint64_t llv; } u;
|
union { uint32_t lv[2]; uint64_t llv; } u;
|
||||||
@ -245,13 +246,16 @@ static uint64_t htonll(uint64_t v)
|
|||||||
u.lv[1] = htonl(v & 0xFFFFFFFFULL);
|
u.lv[1] = htonl(v & 0xFFFFFFFFULL);
|
||||||
return u.llv;
|
return u.llv;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ntohll)
|
||||||
static uint64_t ntohll(uint64_t v)
|
static uint64_t ntohll(uint64_t v)
|
||||||
{
|
{
|
||||||
union { uint32_t lv[2]; uint64_t llv; } u;
|
union { uint32_t lv[2]; uint64_t llv; } u;
|
||||||
u.llv = v;
|
u.llv = v;
|
||||||
return ((uint64_t)ntohl(u.lv[0]) << 32) | (uint64_t) ntohl(u.lv[1]);
|
return ((uint64_t)ntohl(u.lv[0]) << 32) | (uint64_t) ntohl(u.lv[1]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void dest_block_to_network(RDMADestBlock *db)
|
static void dest_block_to_network(RDMADestBlock *db)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user