mtd/util eraseall.c,1.9,1.10

gleixner at infradead.org gleixner at infradead.org
Wed Apr 2 12:00:54 EST 2003


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

Modified Files:
	eraseall.c 
Log Message:
fix it really. tglx blames himself

Index: eraseall.c
===================================================================
RCS file: /home/cvs/mtd/util/eraseall.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- eraseall.c	2 Apr 2003 16:58:06 -0000	1.9
+++ eraseall.c	2 Apr 2003 17:00:51 -0000	1.10
@@ -78,16 +78,19 @@
 		exit(1);
 	}
 
+	erase.length = meminfo.erasesize;
+	isNAND = meminfo.type == MTD_NANDFLASH ? 1 : 0;
+
 	if (jffs2) {
 		cleanmarker.magic = cpu_to_je16 (JFFS2_MAGIC_BITMASK);
 		cleanmarker.nodetype = cpu_to_je16 (JFFS2_NODETYPE_CLEANMARKER);
-		cleanmarker.totlen = cpu_to_je32 (sizeof (struct jffs2_unknown_node));
+		if (!isNAND)
+			cleanmarker.totlen = cpu_to_je32 (sizeof (struct jffs2_unknown_node));
+		else
+			cleanmarker.totlen = cpu_to_je32(8); /* NAND code expects this to be 8 ! */
 		cleanmarker.hdr_crc =  cpu_to_je32 (crc32 (0, &cleanmarker,  sizeof (struct jffs2_unknown_node) - 4));
 	}
 
-	erase.length = meminfo.erasesize;
-	isNAND = meminfo.type == MTD_NANDFLASH ? 1 : 0;
-
 	for (erase.start = 0; erase.start < meminfo.size; erase.start += meminfo.erasesize) {
 
 		if (!quiet) {
@@ -114,7 +117,6 @@
 			oob.start = erase.start;
 			oob.start += meminfo.oobsize == 16 ? 8 : 6;
 			oob.length = meminfo.oobsize == 16 ? 8 : 2;
-			cleanmarker.totlen = 8; /* NAND code expects this to be 8 ! */
 			if (ioctl (fd, MEMWRITEOOB, &oob) != 0) {
 				fprintf(stderr, "\n%s: %s: MTD writeoob failure: %s\n", exe_name, mtd_device, strerror(errno));
 				continue;




More information about the linux-mtd-cvs mailing list