diff options
author | Nick Briggs <nicholas.h.briggs@gmail.com> | 2024-01-11 13:20:17 -0500 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-01-20 17:57:17 +0300 |
commit | 2472f8467d5ca0d7459a4c2ff3a0cbe2240c41ca (patch) | |
tree | 2741be24b3f4e0d074465641393f2bf3214e2bc2 | |
parent | fcc79f2e09550b0461792491965fe202ed2219ae (diff) |
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>
(cherry picked from commit 44ce1b5d2fc77343f6a318cb3de613336a240048)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | migration/rdma.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/migration/rdma.c b/migration/rdma.c index ca430d319d..8212fa6a5a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -268,6 +268,7 @@ static const char *control_desc(unsigned int rdma_control) return strs[rdma_control]; } +#if !defined(htonll) static uint64_t htonll(uint64_t v) { union { uint32_t lv[2]; uint64_t llv; } u; @@ -275,13 +276,16 @@ static uint64_t htonll(uint64_t v) u.lv[1] = htonl(v & 0xFFFFFFFFULL); return u.llv; } +#endif +#if !defined(ntohll) static uint64_t ntohll(uint64_t v) { union { uint32_t lv[2]; uint64_t llv; } u; u.llv = v; return ((uint64_t)ntohl(u.lv[0]) << 32) | (uint64_t) ntohl(u.lv[1]); } +#endif static void dest_block_to_network(RDMADestBlock *db) { |