mtd/fs/jffs2 wbuf.c,1.26,1.27

gleixner at infradead.org gleixner at infradead.org
Tue Feb 18 15:53:57 EST 2003


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv23371/mtd/fs/jffs2

Modified Files:
	wbuf.c 
Log Message:
tglx declares himself healed from temporary brain damage and comes back to the original plan of passing
oob-layout structures. This implies minor changes to filesystem layers, but removes file system dependend
code in nand.c/.h. For userspace apps ioctl (MEMSETOOBSEL) can pass a structure with the layout, which 
has to be used for functions  like read/write, which have no knowledge about oob-layout. see util/nandwrite.c
 



Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- wbuf.c	18 Feb 2003 10:09:55 -0000	1.26
+++ wbuf.c	18 Feb 2003 20:53:54 -0000	1.27
@@ -24,7 +24,17 @@
 /* two seconds timeout for timed wbuf-flushing */
 #define WBUF_FLUSH_TIMEOUT	2 * HZ
 
-static int oobsel = NAND_JFFS2_OOB;
+#define JFFS2_OOB_ECCPOS0		0
+#define JFFS2_OOB_ECCPOS1		1
+#define JFFS2_OOB_ECCPOS2		2
+#define JFFS2_OOB_ECCPOS3		3
+#define JFFS2_OOB_ECCPOS4		6
+#define JFFS2_OOB_ECCPOS5		7
+
+struct nand_oobinfo jffs2_oobinfo = {
+	useecc: 0,
+	eccpos: {JFFS2_OOB_ECCPOS0, JFFS2_OOB_ECCPOS1, JFFS2_OOB_ECCPOS2, JFFS2_OOB_ECCPOS3, JFFS2_OOB_ECCPOS4, JFFS2_OOB_ECCPOS5}
+};
 
 static inline void jffs2_refile_wbuf_blocks(struct jffs2_sb_info *c)
 {
@@ -164,7 +174,7 @@
 	/* else jffs2_flash_writev has actually filled in the rest of the
 	   buffer for us, and will deal with the node refs etc. later. */
 	
-	ret = c->mtd->write_ecc(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf, NULL, &oobsel);
+	ret = c->mtd->write_ecc(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf, NULL, &jffs2_oobinfo);
 	
 	if (ret || retlen != c->wbuf_pagesize) {
 		if (ret)
@@ -381,7 +391,7 @@
 		outvecs[splitvec].iov_len = split_ofs;
 
 		/* We did cross a page boundary, so we write some now */
-		ret = c->mtd->writev_ecc(c->mtd, outvecs, splitvec+1, outvec_to, &wbuf_retlen, NULL, &oobsel); 
+		ret = c->mtd->writev_ecc(c->mtd, outvecs, splitvec+1, outvec_to, &wbuf_retlen, NULL, &jffs2_oobinfo); 
 		if (ret < 0 || wbuf_retlen != PAGE_DIV(totlen)) {
 			/* At this point we have no problem,
 			   c->wbuf is empty. 
@@ -454,7 +464,7 @@
 
 	/* Read flash */
 	if (!jffs2_can_mark_obsolete(c)) {
-		ret = c->mtd->read_ecc(c->mtd, ofs, len, retlen, buf, NULL, &oobsel);
+		ret = c->mtd->read_ecc(c->mtd, ofs, len, retlen, buf, NULL, &jffs2_oobinfo);
 
 		if ( (ret == -EIO) && (*retlen == len) ) {
 			printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n",
@@ -783,3 +793,4 @@
 	return 0;
 }
 
+EXPORT_SYMBOL (jffs2_oobinfo);





More information about the linux-mtd-cvs mailing list