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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>
---
 libibumad/umad.h | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

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
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux