mtd/fs/jffs2 wbuf.c,1.32,1.33
David Woodhouse
dwmw2 at infradead.org
Tue Jul 1 18:35:13 EDT 2003
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv11974
Modified Files:
wbuf.c
Log Message:
Fix jffs2_oob_scan_empty() to handle different fsdata setups
Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- wbuf.c 30 Jun 2003 14:36:47 -0000 1.32
+++ wbuf.c 1 Jul 2003 22:35:10 -0000 1.33
@@ -508,7 +508,7 @@
{
unsigned char *buf;
int ret = 0;
- int i,len,cnt,page;
+ int i,len,page;
size_t retlen;
int oob_size;
@@ -548,12 +548,15 @@
ret = (!page) ? 2 : 3;
goto out;
}
- cnt = oob_size;
- if (mode)
- cnt -= c->fsdata_pos;
- for(i = 0; i < cnt ; i+=sizeof(unsigned short)) {
- unsigned short dat = *(unsigned short *)(&buf[page+i]);
- if(dat != 0xffff) {
+ for(i = 0; i < oob_size ; i++) {
+ /* Yeah, we know about the cleanmarker. */
+ if (mode && i >= c->fsdata_pos &&
+ i < c->fsdata_pos+c->fsdata_len)
+ continue;
+
+ if (buf[page+i] != 0xFF) {
+ D2(printk(KERN_DEBUG "Found %02x at %x in OOB for %08x\n",
+ buf[page+i], page+i, jeb->offset));
ret = 1;
goto out;
}
@@ -634,10 +637,17 @@
for (i = 0; i < c->fsdata_len; i++) {
if (buf[c->fsdata_pos + i] != p[i]) {
- D2 (printk (KERN_WARNING "jffs2_check_nand_cleanmarker(): Cleanmarker node not detected in block at %08x\n", jeb->offset));
retval = 1;
}
}
+ D1(if (retval == 1) {
+ printk(KERN_WARNING "jffs2_check_nand_cleanmarker(): Cleanmarker node not detected in block at %08x\n", jeb->offset);
+ printk(KERN_WARNING "OOB at %08x was ", offset);
+ for (i=0; i < oob_size; i++) {
+ printk("%02x ", buf[i]);
+ }
+ printk("\n");
+ })
}
offset += c->mtd->erasesize;
}
More information about the linux-mtd-cvs
mailing list