diff mbox

[rdma-core,08/10] umad: Replace htonll macros with proper inlines and mark deprecated

Message ID 1486677212-3188-9-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe Feb. 9, 2017, 9:53 p.m. UTC
This allowed code using these public definitions to continue to compile
but will get warnings from gcc. Users should move to glibc's endian.h

We want to avoid new users of these macros in our tree.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 libibumad/umad.h | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/libibumad/umad.h b/libibumad/umad.h
index d574d5d32e0d20..ee8605d3418fcd 100644
--- a/libibumad/umad.h
+++ b/libibumad/umad.h
@@ -229,14 +229,13 @@  static inline void umad_free(void *umad)
 }
 
 #ifndef ntohll
-  #if __BYTE_ORDER == __LITTLE_ENDIAN
-    #define ntohll(x) bswap_64(x)
-  #elif __BYTE_ORDER == __BIG_ENDIAN
-    #define ntohll(x) x
-  #endif
-#endif
-#ifndef htonll
-  #define htonll ntohll
+#undef htonll
+#undef ntohll
+/* Users should use the glibc functions directly, not these wrappers */
+static inline __attribute__((deprecated)) uint64_t htonll(uint64_t x) { return htobe64(x); }
+static inline __attribute__((deprecated)) uint64_t ntohll(uint64_t x) { return be64toh(x); }
+#define htonll htonll
+#define ntohll ntohll
 #endif
 
 END_C_DECLS