mtd/util docfdisk.c,1.5,1.6

dbrown at infradead.org dbrown at infradead.org
Wed Jul 28 09:57:31 EDT 2004


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

Modified Files:
	docfdisk.c 
Log Message:
Write data+oob one page at a time for proper ECC computation.


Index: docfdisk.c
===================================================================
RCS file: /home/cvs/mtd/util/docfdisk.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- docfdisk.c	28 Jul 2004 13:37:58 -0000	1.5
+++ docfdisk.c	28 Jul 2004 13:57:28 -0000	1.6
@@ -306,17 +306,6 @@
 		return 1;
 	}
 
-	if ((ret = pwrite(fd, buf, meminfo.erasesize, mhoffs)) < 0) {
-		perror("Write eraseblock");
-		printf("Your MediaHeader may be hosed.  UHOH!\n");
-		return 1;
-	}
-	if (ret != meminfo.erasesize) {
-		printf("Short write!\n");
-		printf("Your MediaHeader may be hosed.  UHOH!\n");
-		return 1;
-	}
-
 	oob.ptr = oobbuf;
 	oob.start = mhoffs;
 	for (i = 0; i < meminfo.erasesize; i += meminfo.oobblock) {
@@ -325,8 +314,20 @@
 			printf("Your MediaHeader may be hosed.  UHOH!\n");
 			return 1;
 		}
+		if ((ret = pwrite(fd, buf, meminfo.oobblock, oob.start)) < 0) {
+			perror("Write page");
+			printf("Your MediaHeader may be hosed.  UHOH!\n");
+			return 1;
+		}
+		if (ret != meminfo.oobblock) {
+			printf("Short write!\n");
+			printf("Your MediaHeader may be hosed.  UHOH!\n");
+			return 1;
+		}
+
 		oob.start += meminfo.oobblock;
 		oob.ptr += meminfo.oobsize;
+		buf += meminfo.oobblock;
 	}
 
 	printf("Success.  REBOOT or unload the diskonchip module to update partitions!\n");





More information about the linux-mtd-cvs mailing list