]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Yet another include file that someone doesn't like....
authorNeil Brown <neilb@suse.de>
Fri, 2 Jun 2006 05:37:47 +0000 (05:37 +0000)
committerNeil Brown <neilb@suse.de>
Fri, 2 Jun 2006 05:37:47 +0000 (05:37 +0000)
It seems byteswap.h isn't universally accepted, so
we do it by hand...

Signed-off-by: Neil Brown <neilb@suse.de>
mdadm.h

diff --git a/mdadm.h b/mdadm.h
index 445af3233749abab80ca4a720d084cc8cfdbd6f2..9113560a76ba6cfc8624a26362cabaf7a68ab35f 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -73,10 +73,26 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #include       "bitmap.h"
 
 #include <endian.h>
-#include <byteswap.h>
 /* Redhat don't like to #include <asm/byteorder.h>, and
  * some time include <linux/byteorder/xxx_endian.h> isn't enough,
  * and there is no standard conversion function so... */
+/* And dietlibc doesn't think byteswap is ok, so.. */
+/*  #include <byteswap.h> */
+#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
+                    ((x) & 0xff00U) >> 8)
+#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
+                    ((x) & 0xff000000U) >> 24 | \
+                    ((x) & 0x0000ff00U) << 8  | \
+                    ((x) & 0x00ff0000U) >> 8)
+#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
+                    ((x) & 0xff00000000000000ULL) >> 56 | \
+                    ((x) & 0x000000000000ff00ULL) << 40 | \
+                    ((x) & 0x00ff000000000000ULL) >> 40 | \
+                    ((x) & 0x0000000000ff0000ULL) << 24 | \
+                    ((x) & 0x0000ff0000000000ULL) >> 24 | \
+                    ((x) & 0x00000000ff000000ULL) << 8 | \
+                    ((x) & 0x000000ff00000000ULL) >> 8)
+
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define        __cpu_to_le16(_x) (_x)
 #define __cpu_to_le32(_x) (_x)