Re: How do I find endian-conversion function on Redhar/Fedora
From: Neil Brown <hidden>
Date: 2006-02-06 00:18:25
On Sunday February 5, gil@fooplanet.com wrote:
Neil Brown wrote:quoted
So my plea for help: Could someone with a Redhat installation please see if there is any way to get functions that convert between little endian and host endian, or if there is some name I can #define to disable the 'private kernel header' warning..I have an FC4 machine that I tried this out on. I have no idea if this is the right way to use these headers in /usr/include/linux, but it made the compile problem go away at least.
Ok,.... that's interesting. I would in one sense just be moving the problem and maybe Redhat would try to declare linux/byteorder/* off limits, but I guess I could simply include them in the mdadm distrib if they did that. Thanks. If nothing better surfaces I'll probably include this in mdadm 2.4. NeilBrown
quoted hunk
--Gil diff -r -u mdadm-2.3/bitmap.c mdadm-2.3-patched/bitmap.c--- mdadm-2.3/bitmap.c 2005-12-15 17:41:31.000000000 -0800 +++ mdadm-2.3-patched/bitmap.c 2006-02-05 15:09:32.000000000 -0800@@ -21,7 +21,16 @@ #include <sys/types.h> #include <sys/stat.h> #include "mdadm.h" -#include <asm/byteorder.h> +#include <endian.h> +#if __BYTE_ORDER == __LITTLE_ENDIAN +# include <linux/byteorder/little_endian.h> +#elif __BYTE_ORDER == __BIG_ENDIAN +# include <linux/byteorder/big_endian.h> +#elif __BYTE_ORDER == __PDP_ENDIAN +# include <linux/byteorder/pdp_endian.h> +#else +# error "unknown endianness." +#endif