mtd/fs/jffs3 debug.c,1.2,1.3

Artem Bityuckiy dedekind at infradead.org
Fri Dec 17 09:46:25 EST 2004


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

Modified Files:
	debug.c 
Log Message:
Fix messaging


Index: debug.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- debug.c	13 Dec 2004 17:15:46 -0000	1.2
+++ debug.c	17 Dec 2004 14:46:21 -0000	1.3
@@ -41,8 +41,8 @@
 }
 
 #define JFFS3_BUFDUMP_BYTES_PER_LINE	8
-static inline void
-buf_dump(char *buf, int len, uint32_t offs)
+void
+jffs3_dbg_dump_buffer(char *buf, int len, uint32_t offs)
 {
 	int i = 0;
 	int skip = offs & ~(JFFS3_BUFDUMP_BYTES_PER_LINE - 1);
@@ -78,7 +78,7 @@
 	while (ref2) {
 		if (unlikely(ref2->flash_offset < jeb->offset
 				|| ref2->flash_offset > jeb->offset + c->sector_size)) {
-			printk(KERN_ERR "node_ref %#08x shouldn't be in block at %#08x!\n",
+			ERROR_MSG("node_ref %#08x shouldn't be in block at %#08x!\n",
 				ref_offset(ref2), jeb->offset);
 			node_refs_dump(jeb);
 			BUG();
@@ -90,7 +90,7 @@
 			my_used_size += ref_totlen(c, jeb, ref2);
 		
 		if (unlikely((!ref2->next_phys) != (ref2 == jeb->last_node))) {
-				printk(KERN_ERR "node_ref for node at %#08x (mem %p) has next_phys at %#08x (mem %p), "
+			ERROR_MSG("node_ref for node at %#08x (mem %p) has next_phys at %#08x (mem %p), "
 					"last_node is at %#08x (mem %p)\n",
 					ref_offset(ref2), ref2, ref_offset(ref2->next_phys), ref2->next_phys,
 					ref_offset(jeb->last_node), jeb->last_node);
@@ -101,12 +101,12 @@
 	}
 
 	if (my_used_size != jeb->used_size) {
-		printk(KERN_ERR "Calculated used size %#08x != stored used size %#08x\n",
+		ERROR_MSG("Calculated used size %#08x != stored used size %#08x\n",
 				my_used_size, jeb->used_size);
 		BUG();
 	}
 	if (my_unchecked_size != jeb->unchecked_size) {
-		printk(KERN_ERR "Calculated unchecked size %#08x != stored unchecked size %#08x\n",
+		ERROR_MSG("Calculated unchecked size %#08x != stored unchecked size %#08x\n",
 				my_unchecked_size, jeb->unchecked_size);
 		BUG();
 	}
@@ -126,7 +126,7 @@
 		len1 = len > JFFS3_DBG_BUF_SIZE ? JFFS3_DBG_BUF_SIZE : len;
 		ret = jffs3_flash_read(c, ofs, len1, &retlen, &dbg_buf[0]);
 		if (ret || (retlen != len1)) {
-			printk(KERN_WARNING "read %d bytes failed or short in %s(). ret %d, retlen %zd\n",
+			WARNING_MSG("read %d bytes failed or short in %s(). ret %d, retlen %zd\n",
 					len1, __FUNCTION__, ret, retlen);
 			return;
 		}
@@ -139,9 +139,9 @@
 		}
 		
 		if (ret) {
-			printk(KERN_ERR "ARGH. About to write node to %#08x on flash, but there are data "
+			ERROR_MSG("ARGH. About to write node to %#08x on flash, but there are data "
 					"already there. The first corrupted byte is at %#08x.\n", ofs, ofs + i);
-			buf_dump(dbg_buf, len1, ofs);
+			jffs3_dbg_dump_buffer(dbg_buf, len1, ofs);
 			BUG();
 		}
 
@@ -165,7 +165,7 @@
 
 		if (ref_flags(fn->raw) == REF_PRISTINE) {
 			if (fn->frags > 1) {
-				printk(KERN_ERR "REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2\n",
+				ERROR_MSG("REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2\n",
 						ref_offset(fn->raw), fn->frags);
 				bitched = 1;
 			}
@@ -177,14 +177,14 @@
 			   to tell a hole node. */
 			if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag)
 					&& frag_prev(frag)->size < PAGE_CACHE_SIZE && frag_prev(frag)->node) {
-				printk(KERN_ERR "REF_PRISTINE node at 0x%08x had a previous non-hole frag "
+				ERROR_MSG("REF_PRISTINE node at 0x%08x had a previous non-hole frag "
 						"in the same page. Tell dwmw2\n", ref_offset(fn->raw));
 				bitched = 1;
 			}
 
 			if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag)
 					&& frag_next(frag)->size < PAGE_CACHE_SIZE && frag_next(frag)->node) {
-				printk(KERN_ERR "REF_PRISTINE node at 0x%08x (%08x-%08x) had a following "
+				ERROR_MSG("REF_PRISTINE node at 0x%08x (%08x-%08x) had a following "
 						"non-hole frag in the same page. Tell dwmw2\n",
 					       ref_offset(fn->raw), frag->ofs, frag->ofs+frag->size);
 				bitched = 1;
@@ -237,7 +237,7 @@
 void
 jffs3_dbg_dump_block_lists(struct jffs3_sb_info *c)
 {
-	printk(KERN_DEBUG "%s:\n", __FUNCTION__);
+	DBG("%s:\n", __FUNCTION__);
 	printk(KERN_DEBUG "flash_size: %#08x\n",	c->flash_size);
 	printk(KERN_DEBUG "used_size: %#08x\n",		c->used_size);
 	printk(KERN_DEBUG "dirty_size: %#08x\n",	c->dirty_size);
@@ -445,6 +445,7 @@
 	uint32_t lastofs = 0;
 	int buggy = 0;
 
+	DBG("%s:\n", __FUNCTION__);
 	while(this) {
 		if (this->node)
 			printk(KERN_DEBUG "frag %#04x-%#04x: %#08x(%d) on flash (*%p), left (%p), "





More information about the linux-mtd-cvs mailing list