aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-05-23 21:56:11 +0200
committerJakub Jirutka <jakub@jirutka.cz>2018-05-23 22:18:39 +0200
commit4f24ccb86c8a9d8b73bbcb2d2d4ba4bfceb5c96b (patch)
tree710d95ee14b9815b21685d08b1d60ef864d148fe /testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch
parentada13b6998155f1425ec53c9a6ceeac17a5cb7cd (diff)
testing/ocfs2-tools: rewrite aport and upgrade to 1.8.5
Note: We use the same ("unofficial"?) upstream as Fedora.
Diffstat (limited to 'testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch')
-rw-r--r--testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch b/testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch
new file mode 100644
index 00000000000..e813db47437
--- /dev/null
+++ b/testing/ocfs2-tools/musl-libocfs2-__bswap_constant_32.patch
@@ -0,0 +1,29 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Wed, 23 May 2018 19:56:00 +0200
+Subject: [PATCH] Ensure compatibility with other libcs
+
+The musl libc does not provide __bswap_constant_32.
+
+--- a/libocfs2/crc32table.h
++++ b/libocfs2/crc32table.h
+@@ -6,11 +6,18 @@
+ */
+ #include <inttypes.h>
+ #include <byteswap.h>
++
++#ifndef __bswap_constant_32
++#define __bswap_constant_32(x) \
++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \
++ | (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
++#endif
++
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ # define tole(x) ((uint32_t)(x))
+-# define tobe(x) ((uint32_t)__bswap_constant_32(x))
++# define tobe(x) ((uint32_t)__builtin_bswap32(x))
+ #elif __BYTE_ORDER == __BIG_ENDIAN
+-# define tole(x) ((uint32_t)__bswap_constant_32(x))
++# define tole(x) ((uint32_t)__builtin_bswap32(x))
+ # define tobe(x) ((uint32_t)(x))
+ #else
+ # error Invalid byte order __BYTE_ORDER