mtd/util mkfs.jffs2.c,1.34,1.35

David Woodhouse dwmw2 at infradead.org
Fri Feb 14 19:08:12 EST 2003


Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv8250

Modified Files:
	mkfs.jffs2.c 
Log Message:
fix byteswap

Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- mkfs.jffs2.c	4 Feb 2003 00:38:34 -0000	1.34
+++ mkfs.jffs2.c	15 Feb 2003 00:08:10 -0000	1.35
@@ -62,17 +62,12 @@
 #include <ctype.h>
 #include <time.h>
 #include <getopt.h>
+#include <byteswap.h>
 #define crc32 __complete_crap
 #include <zlib.h>
 #undef crc32
 #include "crc32.h"
 
-#ifdef __linux__
-#define os_to_jffs2_mode(x) (x)
-#else
-#error You need to define your mode_t mapping
-#endif
-
 /* Do not use the wierd XPG version of basename */
 #undef basename
 
@@ -649,6 +644,23 @@
 
 /* Here is where we do the actual creation of the file system */
 #include "linux/jffs2.h"
+
+#undef cpu_to_je16
+#undef cpu_to_je32
+#undef cpu_to_jemode
+#undef je16_to_cpu
+#undef je32_to_cpu
+#undef jemode_to_cpu
+#define t16(x) ( (target_endian==__BYTE_ORDER)?x:bswap_16(x) )
+#define t32(x) ( (target_endian==__BYTE_ORDER)?x:bswap_32(x) )
+
+#define cpu_to_je16(x) ((jint16_t){t16(x)})
+#define cpu_to_je32(x) ((jint32_t){t32(x)})
+#define cpu_to_jemode(x) ((jmode_t){t32(x)})
+
+#define je16_to_cpu(x) (t16((x).v16))
+#define je32_to_cpu(x) (t32((x).v32))
+#define jemode_to_cpu(x) (t32((x).m))
 
 #define JFFS2_MAX_FILE_SIZE 0xFFFFFFFF
 #ifndef JFFS2_MAX_SYMLINK_LEN





More information about the linux-mtd-cvs mailing list