Skip to contentSkip to conversation

mkfs.jffs2

PATCH New Henrik Nordstrom 1 participant 1 message Aug 29, 2002 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs.jffs2

Noticed mkfs.jffs2 does not build in CVS due to the change in jffs2 byte orderered types.

Attached is a patch to allow mkfs.jffs2 to build again. It is merely an search-replace of the existing code to match the new types. Have not tried if it does what it should as I do not (yet) have a system where I can use JFFS2.

Regards
Henrik

Index: util/mkfs.jffs2.c
===================================================================
RCS file: /home/cvs/mtd/util/mkfs.jffs2.c,v
retrieving revision 1.26

mkfs.jffs2.c +12 -12
diff -u -r1.26 mkfs.jffs2.c
@@ -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);