move uClibc/files/config.* to uClibc/config/* and allow board-specific config overrides
[openwrt-10.03/.git] / target / linux / rb532-2.6 / patches / 140-jffs2_eofdetect.patch
1 diff -ur linux.old/fs/jffs2/scan.c linux.dev/fs/jffs2/scan.c
2 --- linux.old/fs/jffs2/scan.c   2006-05-31 02:31:44.000000000 +0200
3 +++ linux.dev/fs/jffs2/scan.c   2006-06-15 02:20:32.000000000 +0200
4 @@ -120,8 +120,11 @@
5                 /* reset summary info for next eraseblock scan */
6                 jffs2_sum_reset_collected(s);
7  
8 -               ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
9 -                                               buf_size, s);
10 +               if (c->flags & (1 << 7))
11 +                       ret = BLK_STATE_ALLFF;
12 +               else
13 +                       ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
14 +                                                       buf_size, s);
15  
16                 if (ret < 0)
17                         goto out;
18 @@ -222,6 +225,12 @@
19                 }
20         }
21  
22 +       if (c->flags & (1 << 7)) {
23 +               printk("jffs2_scan_medium(): erasing all blocks after the end marker...\n");
24 +               jffs2_erase_pending_blocks(c, -1);
25 +               printk("jffs2_scan_medium(): done.\n");
26 +       }
27 +
28         if (jffs2_sum_active() && s)
29                 kfree(s);
30  
31 @@ -389,6 +398,17 @@
32                         return err;
33         }
34  
35 +       if ((buf[0] == 0xde) &&
36 +               (buf[1] == 0xad) &&
37 +               (buf[2] == 0xc0) &&
38 +               (buf[3] == 0xde)) {
39 +               /* end of filesystem. erase everything after this point */
40 +               printk("jffs2_scan_eraseblock(): End of filesystem marker found at 0x%x\n", jeb->offset);
41 +               c->flags |= (1 << 7);
42 +
43 +               return BLK_STATE_ALLFF;
44 +       }
45 +       
46         /* We temporarily use 'ofs' as a pointer into the buffer/jeb */
47         ofs = 0;
48