Whamcloud - gitweb
libext2fs: move #include "ext2fs.h" from crc32c_defs.h to crc32c.c
authorTheodore Ts'o <tytso@mit.edu>
Tue, 4 Oct 2011 02:49:45 +0000 (22:49 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 4 Oct 2011 02:49:45 +0000 (22:49 -0400)
The byte swap functions which are defined in ext2fs.h are only needed
by crc32.c, and not by gen_crc32ctable.c.  The gen_crc32ctable program
needs to be compiled on the host OS, where ext2fs.h may not be
present.  So move the use of the header function to crc32c.c, to avoid
compilation problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/crc32c.c
lib/ext2fs/crc32c_defs.h

index 65bca5c..6be4336 100644 (file)
 #define PTR_ALIGN(p, a)                ((typeof(p))ALIGN((unsigned long)(p), (a)))
 #include "crc32c_defs.h"
 
+#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) (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) (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
+
 #if CRC_LE_BITS > 8
 # define tole(x) (__force uint32_t) __constant_cpu_to_le32(x)
 #else
index ced4f67..023f2c0 100644 (file)
                (((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) (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) (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
-
 #if (__GNUC__ >= 3)
 #define likely(x)      __builtin_expect(!!(x), 1)
 #define unlikely(x)    __builtin_expect(!!(x), 0)