]> err.no Git - linux-2.6/blobdiff - fs/jffs2/debug.c
[S390] xpram off by one error.
[linux-2.6] / fs / jffs2 / debug.c
index 28983501bcef96aeae25af78c2892b14a7fec0a4..72b4fc13a106053bfa64773f3d9e9609ce5ebd7d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: debug.c,v 1.10 2005/09/14 16:57:32 dedekind Exp $
+ * $Id: debug.c,v 1.12 2005/11/07 11:14:39 gleixner Exp $
  *
  */
 #include <linux/kernel.h>
@@ -15,6 +15,7 @@
 #include <linux/pagemap.h>
 #include <linux/crc32.h>
 #include <linux/jffs2.h>
+#include <linux/mtd/mtd.h>
 #include "nodelist.h"
 #include "debug.h"
 
@@ -66,7 +67,7 @@ __jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f)
        __jffs2_dbg_fragtree_paranoia_check_nolock(f);
        up(&f->sem);
 }
-       
+
 void
 __jffs2_dbg_fragtree_paranoia_check_nolock(struct jffs2_inode_info *f)
 {
@@ -164,7 +165,7 @@ __jffs2_dbg_acct_paranoia_check(struct jffs2_sb_info *c,
        __jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
        spin_unlock(&c->erase_completion_lock);
 }
-       
+
 void
 __jffs2_dbg_acct_paranoia_check_nolock(struct jffs2_sb_info *c,
                                       struct jffs2_eraseblock *jeb)
@@ -191,13 +192,13 @@ __jffs2_dbg_acct_paranoia_check_nolock(struct jffs2_sb_info *c,
                else
                        my_dirty_size += totlen;
 
-               if ((!ref2->next_phys) != (ref2 == jeb->last_node)) {
-                       JFFS2_ERROR("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);
+               if ((!ref_next(ref2)) != (ref2 == jeb->last_node)) {
+                       JFFS2_ERROR("node_ref for node at %#08x (mem %p) has next at %#08x (mem %p), last_node is at %#08x (mem %p).\n",
+                                   ref_offset(ref2), ref2, ref_offset(ref_next(ref2)), ref_next(ref2),
+                                   ref_offset(jeb->last_node), jeb->last_node);
                        goto error;
                }
-               ref2 = ref2->next_phys;
+               ref2 = ref_next(ref2);
        }
 
        if (my_used_size != jeb->used_size) {
@@ -236,7 +237,7 @@ error:
        __jffs2_dbg_dump_jeb_nolock(jeb);
        __jffs2_dbg_dump_block_lists_nolock(c);
        BUG();
-       
+
 }
 #endif /* JFFS2_DBG_PARANOIA_CHECKS */
 
@@ -267,9 +268,9 @@ __jffs2_dbg_dump_node_refs_nolock(struct jffs2_sb_info *c,
        }
 
        printk(JFFS2_DBG);
-       for (ref = jeb->first_node; ; ref = ref->next_phys) {
+       for (ref = jeb->first_node; ; ref = ref_next(ref)) {
                printk("%#08x(%#x)", ref_offset(ref), ref->__totlen);
-               if (ref->next_phys)
+               if (ref_next(ref))
                        printk("->");
                else
                        break;
@@ -320,7 +321,7 @@ void
 __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
 {
        printk(JFFS2_DBG_MSG_PREFIX " dump JFFS2 blocks lists:\n");
-       
+
        printk(JFFS2_DBG "flash_size: %#08x\n",         c->flash_size);
        printk(JFFS2_DBG "used_size: %#08x\n",          c->used_size);
        printk(JFFS2_DBG "dirty_size: %#08x\n",         c->dirty_size);
@@ -576,15 +577,15 @@ __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
 {
        int skip;
        int i;
-       
+
        printk(JFFS2_DBG_MSG_PREFIX " dump from offset %#08x to offset %#08x (%x bytes).\n",
                offs, offs + len, len);
        i = skip = offs % JFFS2_BUFDUMP_BYTES_PER_LINE;
        offs = offs & ~(JFFS2_BUFDUMP_BYTES_PER_LINE - 1);
-       
+
        if (skip != 0)
                printk(JFFS2_DBG "%#08x: ", offs);
-       
+
        while (skip--)
                printk("   ");
 
@@ -597,7 +598,7 @@ __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
                }
 
                printk("%02x ", buf[i]);
-               
+
                i += 1;
        }
 
@@ -615,7 +616,7 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
        size_t retlen;
        uint32_t crc;
        int ret;
-       
+
        printk(JFFS2_DBG_MSG_PREFIX " dump node at offset %#08x.\n", ofs);
 
        ret = jffs2_flash_read(c, ofs, len, &retlen, (unsigned char *)&node);
@@ -629,13 +630,13 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
        printk(JFFS2_DBG "nodetype:\t%#04x\n", je16_to_cpu(node.u.nodetype));
        printk(JFFS2_DBG "totlen:\t%#08x\n", je32_to_cpu(node.u.totlen));
        printk(JFFS2_DBG "hdr_crc:\t%#08x\n", je32_to_cpu(node.u.hdr_crc));
-       
+
        crc = crc32(0, &node.u, sizeof(node.u) - 4);
        if (crc != je32_to_cpu(node.u.hdr_crc)) {
                JFFS2_ERROR("wrong common header CRC.\n");
                return;
        }
-       
+
        if (je16_to_cpu(node.u.magic) != JFFS2_MAGIC_BITMASK &&
                je16_to_cpu(node.u.magic) != JFFS2_OLD_MAGIC_BITMASK)
        {
@@ -667,7 +668,7 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
                printk(JFFS2_DBG "data_crc:\t%#08x\n", je32_to_cpu(node.i.data_crc));
                printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.i.node_crc));
 
-               crc = crc32(0, &node.i, sizeof(node.i) - 8); 
+               crc = crc32(0, &node.i, sizeof(node.i) - 8);
                if (crc != je32_to_cpu(node.i.node_crc)) {
                        JFFS2_ERROR("wrong node header CRC.\n");
                        return;
@@ -685,11 +686,11 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
                printk(JFFS2_DBG "type:\t%#02x\n", node.d.type);
                printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.d.node_crc));
                printk(JFFS2_DBG "name_crc:\t%#08x\n", je32_to_cpu(node.d.name_crc));
-               
+
                node.d.name[node.d.nsize] = '\0';
                printk(JFFS2_DBG "name:\t\"%s\"\n", node.d.name);
 
-               crc = crc32(0, &node.d, sizeof(node.d) - 8); 
+               crc = crc32(0, &node.d, sizeof(node.d) - 8);
                if (crc != je32_to_cpu(node.d.node_crc)) {
                        JFFS2_ERROR("wrong node header CRC.\n");
                        return;