mtd/util mkfs.jffs2.c,1.26,1.27

David Woodhouse dwmw2 at infradead.org
Thu Sep 5 11:21:06 EDT 2002


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

Modified Files:
	mkfs.jffs2.c 
Log Message:
Update for jffs2 byteswap stuff

Index: mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- mkfs.jffs2.c	3 Jul 2002 22:20:13 -0000	1.26
+++ mkfs.jffs2.c	5 Sep 2002 15:21:03 -0000	1.27
@@ -142,9 +142,9 @@
 		(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) ))
 
 #define cpu_to_target16(x) \
-	((host_endian==target_endian)?(x):(swab16(x)))
+	((jint16_t){(host_endian==target_endian)?(x):(swab16(x))})
 #define cpu_to_target32(x) \
-	((host_endian==target_endian)?(x):(swab32(x)))
+	((jint32_t){(host_endian==target_endian)?(x):(swab32(x))})
 
 
 
@@ -568,8 +568,8 @@
 
 	ri.ino = cpu_to_target32(ino);
 	ri.mode = cpu_to_target32(statbuf->st_mode);
-	ri.uid = cpu_to_target32(statbuf->st_uid);
-	ri.gid = cpu_to_target32(statbuf->st_gid);
+	ri.uid = cpu_to_target16(statbuf->st_uid);
+	ri.gid = cpu_to_target16(statbuf->st_gid);
 	ri.atime = cpu_to_target32(statbuf->st_atime);
 	ri.ctime = cpu_to_target32(statbuf->st_ctime);
 	ri.mtime = cpu_to_target32(statbuf->st_mtime);
@@ -621,7 +621,7 @@
 			offset += dsize;
 		}
 	}
-	if (!ri.version) {
+	if (!je32_to_cpu(ri.version)) {
 		/* Was empty file */
 		version++;
 		ri.version = cpu_to_target32(version);
@@ -646,7 +646,7 @@
 
 	/* FIXME:  I am using illicit insider knowledge of kernel 
 	 * major/minor representation...  */
-	unsigned short kdev;
+	jint16_t kdev;
 
 	kdev = cpu_to_target16((major(statbuf->st_rdev) << 8) +
 		minor(statbuf->st_rdev));
@@ -661,8 +661,8 @@
 
 	ri.ino = cpu_to_target32(ino);
 	ri.mode = cpu_to_target32(statbuf->st_mode);
-	ri.uid = cpu_to_target32(statbuf->st_uid);
-	ri.gid = cpu_to_target32(statbuf->st_gid);
+	ri.uid = cpu_to_target16(statbuf->st_uid);
+	ri.gid = cpu_to_target16(statbuf->st_gid);
 	ri.atime = cpu_to_target32(statbuf->st_atime);
 	ri.ctime = cpu_to_target32(statbuf->st_ctime);
 	ri.mtime = cpu_to_target32(statbuf->st_mtime);
@@ -695,8 +695,8 @@
 
 	ri.ino = cpu_to_target32(ino);
 	ri.mode = cpu_to_target32(statbuf->st_mode);
-	ri.uid = cpu_to_target32(statbuf->st_uid);
-	ri.gid = cpu_to_target32(statbuf->st_gid);
+	ri.uid = cpu_to_target16(statbuf->st_uid);
+	ri.gid = cpu_to_target16(statbuf->st_gid);
 	ri.atime = cpu_to_target32(statbuf->st_atime);
 	ri.ctime = cpu_to_target32(statbuf->st_ctime);
 	ri.mtime = cpu_to_target32(statbuf->st_mtime);
@@ -729,8 +729,8 @@
 
 	ri.ino = cpu_to_target32(ino);
 	ri.mode = cpu_to_target32(statbuf->st_mode);
-	ri.uid = cpu_to_target32(statbuf->st_uid);
-	ri.gid = cpu_to_target32(statbuf->st_gid);
+	ri.uid = cpu_to_target16(statbuf->st_uid);
+	ri.gid = cpu_to_target16(statbuf->st_gid);
 	ri.atime = cpu_to_target32(statbuf->st_atime);
 	ri.ctime = cpu_to_target32(statbuf->st_ctime);
 	ri.mtime = cpu_to_target32(statbuf->st_mtime);





More information about the linux-mtd-cvs mailing list