Skip to contentSkip to conversation

migration/rdma: define htonll/ntohll only if not predefined

PATCH In review Nick Briggs 2 participants 3 messages Jan 11, 2024 – Jan 15, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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..

---
 migration/rdma.c | 4 ++++
 1 file changed, 4 insertions(+)
migration/rdma.c +4 -0
index 94c0f871f0..a355dcea89 100644
@@ -238,6 +238,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;
@@ -245,13 +246,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)
 {
Signature · 1 line
2.31.1
#1 lore raw
Quoted 4 lines · Nick Briggs

Solaris has #defines for htonll and ntohll which cause syntax errors when compiling code that attempts to (re)define these functions..

I left the other QGA patch for QGA maintainers, assuming this will enable solaries build for qemu itself alone.

Queued this one for migration-staging.

Thanks,

Signature · 1 line
Peter Xu
#2 lore raw

Thank you.

Yes, with those two patches applied I have compiled qemu on Solaris 11.4 running on a SPARC-T4-1 (sun4v) system to emulate a single target: an HP PA-RISC.

Quoted 18 lines · Peter Xu
Quoted 4 lines · Nick Briggs

Solaris has #defines for htonll and ntohll which cause syntax errors when compiling code that attempts to (re)define these functions..

I left the other QGA patch for QGA maintainers, assuming this will enable solaries build for qemu itself alone.

Queued this one for migration-staging.

Thanks,

Signature · 1 line
Peter Xu