summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-06-02 05:37:47 +0000
committerNeil Brown <neilb@suse.de>2006-06-02 05:37:47 +0000
commit0ae03b8ad8257e310a06bf3c496b8ce1fa6afb48 (patch)
treec396c0273c783a046b2d060474441c02421f980c
parent058574b1da29e875104043fe6ea5ff5cfb81ebd0 (diff)
downloadmdadm-0ae03b8ad8257e310a06bf3c496b8ce1fa6afb48.tar.gz
mdadm-0ae03b8ad8257e310a06bf3c496b8ce1fa6afb48.tar.xz
mdadm-0ae03b8ad8257e310a06bf3c496b8ce1fa6afb48.zip
Yet another include file that someone doesn't like....
It seems byteswap.h isn't universally accepted, so we do it by hand... Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--mdadm.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/mdadm.h b/mdadm.h
index 445af32..9113560 100644
--- 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)