[PATCH 2/2] libext2fs: use ext2fs byte swap functions for portability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The functions htole32(), le32toh(), be32toh(), htobe32() aren't
defined in all environments.  Use the ext2fs byte swap functions for
portability.

Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx>
---
 lib/ext2fs/crc32c_defs.h |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/ext2fs/crc32c_defs.h b/lib/ext2fs/crc32c_defs.h
index 1752970..ced4f67 100644
--- a/lib/ext2fs/crc32c_defs.h
+++ b/lib/ext2fs/crc32c_defs.h
@@ -42,18 +42,19 @@
 		(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
 
 
+#include "ext2fs.h"
 #ifdef WORDS_BIGENDIAN
 #define __constant_cpu_to_le32(x) ___constant_swab32((x))
 #define __constant_cpu_to_be32(x) (x)
 #define __be32_to_cpu(x) (x)
 #define __cpu_to_be32(x) (x)
-#define __cpu_to_le32(x) (htole32((x)))
-#define __le32_to_cpu(x) (le32toh((x)))
+#define __cpu_to_le32(x) (ext2fs_cpu_to_le32((x)))
+#define __le32_to_cpu(x) (ext2fs_le32_to_cpu((x)))
 #else
 #define __constant_cpu_to_le32(x) (x)
 #define __constant_cpu_to_be32(x) ___constant_swab32((x))
-#define __be32_to_cpu(x) (be32toh((x)))
-#define __cpu_to_be32(x) (htobe32((x)))
+#define __be32_to_cpu(x) (ext2fs_be32_to_cpu((x)))
+#define __cpu_to_be32(x) (ext2fs_cpu_to_be32((x)))
 #define __cpu_to_le32(x) (x)
 #define __le32_to_cpu(x) (x)
 #endif
-- 
1.7.4.1.22.gec8e1.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux