mtd/fs/jffs2 nodelist.c,1.66,1.67

Joakim Tjernlund jocke at infradead.org
Thu Jan 9 12:16:52 EST 2003


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

Modified Files:
	nodelist.c 
Log Message:
Kill a warning and use point() in jffs2_get_inode_nodes() when
checking crc32.


Index: nodelist.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- nodelist.c	9 Jan 2003 13:59:14 -0000	1.66
+++ nodelist.c	9 Jan 2003 17:16:49 -0000	1.67
@@ -113,7 +113,7 @@
 
 	D1(printk(KERN_DEBUG "jffs2_get_inode_nodes(): ino #%lu\n", ino));
 	if (!f->inocache->nodes) {
-		printk(KERN_WARNING "Eep. no nodes for ino #%lu\n", ino);
+		printk(KERN_WARNING "Eep. no nodes for ino #%lu\n", (unsigned long)ino);
 	}
 
 	spin_lock_bh(&c->erase_completion_lock);
@@ -250,22 +250,42 @@
 				}
 
 				if (node.i.compr != JFFS2_COMPR_ZERO && je32_to_cpu(node.i.csize)) {
-					/* FIXME: point() */
-					char *buf = kmalloc(je32_to_cpu(node.i.csize), GFP_KERNEL);
-					if (!buf)
-						return -ENOMEM;
-
-					err = jffs2_flash_read(c, ref_offset(ref) + sizeof(node.i), je32_to_cpu(node.i.csize),
-							       &retlen, buf);
-					if (!err && retlen != je32_to_cpu(node.i.csize))
-						err = -EIO;
-					if (err) {
-						kfree(buf);
-						return err;
+					u_char *buf=NULL;
+					u32 pointed = 0;
+#ifndef __ECOS
+					if (c->mtd->point) {
+						err = c->mtd->point (c->mtd, ref_offset(ref) + sizeof(node.i), je32_to_cpu(node.i.csize),
+								     &retlen, &buf);
+						if (!err && retlen < je32_to_cpu(node.i.csize)) {
+							D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%x\n", retlen));
+							c->mtd->unpoint(c->mtd, buf, ref_offset(ref) + sizeof(node.i), je32_to_cpu(node.i.csize));
+						} else if (err){
+							D1(printk(KERN_DEBUG "MTD point failed %d\n", err));
+						} else
+							pointed = 1; /* succefully pointed to device */
+					}
+#endif					
+					if(!pointed){
+						buf = kmalloc(je32_to_cpu(node.i.csize), GFP_KERNEL);
+						if (!buf)
+							return -ENOMEM;
+						
+						err = jffs2_flash_read(c, ref_offset(ref) + sizeof(node.i), je32_to_cpu(node.i.csize),
+								       &retlen, buf);
+						if (!err && retlen != je32_to_cpu(node.i.csize))
+							err = -EIO;
+						if (err) {
+							kfree(buf);
+							return err;
+						}
 					}
-					
 					crc = crc32(0, buf, je32_to_cpu(node.i.csize));
-					kfree(buf);
+					if(!pointed)
+						kfree(buf);
+#ifndef __ECOS
+					else
+						c->mtd->unpoint(c->mtd, buf, ref_offset(ref) + sizeof(node.i), je32_to_cpu(node.i.csize));
+#endif
 
 					if (crc != je32_to_cpu(node.i.data_crc)) {
 						printk(KERN_NOTICE "jffs2_get_inode_nodes(): Data CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",





More information about the linux-mtd-cvs mailing list