summaryrefslogtreecommitdiffstats
path: root/src/types.h
diff options
context:
space:
mode:
authorSimon Rettberg2019-09-09 17:43:20 +0200
committerSimon Rettberg2019-09-09 17:43:20 +0200
commitc2209762259426a8e5a25a6789711f76b4dca569 (patch)
treecd1d899a28f4a1c2938cde71ecd61d99efebad76 /src/types.h
parentcmake: Add some flags that enable exploit mitigation techniques (diff)
downloaddnbd3-c2209762259426a8e5a25a6789711f76b4dca569.tar.gz
dnbd3-c2209762259426a8e5a25a6789711f76b4dca569.tar.xz
dnbd3-c2209762259426a8e5a25a6789711f76b4dca569.zip
Fix compilation on older gcc
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/types.h b/src/types.h
index ec37d9b..695d81d 100644
--- a/src/types.h
+++ b/src/types.h
@@ -77,7 +77,7 @@
#define IOCTL_REM_SRV _IO(0xab, 5)
#if defined(__BIG_ENDIAN__) || (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN) || (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
-static const uint16_t dnbd3_packet_magic = (0x73 << 8) | (0x72);
+#define dnbd3_packet_magic ((uint16_t)( (0x73 << 8) | (0x72) ))
// Flip bytes around on big endian when putting stuff on the net
#define net_order_64(a) ((uint64_t)((((a) & 0xFFull) << 56) | (((a) & 0xFF00ull) << 40) | (((a) & 0xFF0000ull) << 24) | (((a) & 0xFF000000ull) << 8) | (((a) & 0xFF00000000ull) >> 8) | (((a) & 0xFF0000000000ull) >> 24) | (((a) & 0xFF000000000000ull) >> 40) | (((a) & 0xFF00000000000000ull) >> 56)))
#define net_order_32(a) ((uint32_t)((((a) & (uint32_t)0xFF) << 24) | (((a) & (uint32_t)0xFF00) << 8) | (((a) & (uint32_t)0xFF0000) >> 8) | (((a) & (uint32_t)0xFF000000) >> 24)))
@@ -96,7 +96,7 @@ static const uint16_t dnbd3_packet_magic = (0x73 << 8) | (0x72);
#define BIG_ENDIAN
#endif
#elif defined(__LITTLE_ENDIAN__) || (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN) || (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined(__i386__) || defined(__i386) || defined(__x86_64)
-static const uint16_t dnbd3_packet_magic = (0x73) | (0x72 << 8);
+#define dnbd3_packet_magic ((uint16_t)( (0x73) | (0x72 << 8) ))
// Make little endian our network byte order as probably 99.999% of machines this will be used on are LE
#define net_order_64(a) (a)
#define net_order_32(a) (a)