8037dd06718cba44a353eb3d8026e860edd6abc0
[openwrt.git] / target / linux / generic-2.6 / patches / 204-jffs2_eofdetect.patch
1 diff -urN linux-2.6.19.old/fs/jffs2/build.c linux-2.6.19.dev/fs/jffs2/build.c
2 --- linux-2.6.19.old/fs/jffs2/build.c 2006-11-29 22:57:37.000000000 +0100
3 +++ linux-2.6.19.dev/fs/jffs2/build.c 2006-12-14 03:13:57.000000000 +0100
4 @@ -107,6 +107,17 @@
5 dbg_fsbuild("scanned flash completely\n");
6 jffs2_dbg_dump_block_lists_nolock(c);
7
8 + if (c->flags & (1 << 7)) {
9 + printk("%s(): unlocking the mtd device... ", __func__);
10 + if (c->mtd->unlock)
11 + c->mtd->unlock(c->mtd, 0, c->mtd->size);
12 + printk("done.\n");
13 +
14 + printk("%s(): erasing all blocks after the end marker... ", __func__);
15 + jffs2_erase_pending_blocks(c, -1);
16 + printk("done.\n");
17 + }
18 +
19 dbg_fsbuild("pass 1 starting\n");
20 c->flags |= JFFS2_SB_FLAG_BUILDING;
21 /* Now scan the directory tree, increasing nlink according to every dirent found. */
22 diff -urN linux-2.6.19.old/fs/jffs2/scan.c linux-2.6.19.dev/fs/jffs2/scan.c
23 --- linux-2.6.19.old/fs/jffs2/scan.c 2006-11-29 22:57:37.000000000 +0100
24 +++ linux-2.6.19.dev/fs/jffs2/scan.c 2006-12-14 03:13:57.000000000 +0100
25 @@ -141,9 +141,12 @@
26
27 /* reset summary info for next eraseblock scan */
28 jffs2_sum_reset_collected(s);
29 -
30 - ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
31 - buf_size, s);
32 +
33 + if (c->flags & (1 << 7))
34 + ret = BLK_STATE_ALLFF;
35 + else
36 + ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
37 + buf_size, s);
38
39 if (ret < 0)
40 goto out;
41 @@ -540,6 +543,17 @@
42 return err;
43 }
44
45 + if ((buf[0] == 0xde) &&
46 + (buf[1] == 0xad) &&
47 + (buf[2] == 0xc0) &&
48 + (buf[3] == 0xde)) {
49 + /* end of filesystem. erase everything after this point */
50 + printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
51 + c->flags |= (1 << 7);
52 +
53 + return BLK_STATE_ALLFF;
54 + }
55 +
56 /* We temporarily use 'ofs' as a pointer into the buffer/jeb */
57 ofs = 0;
58
This page took 0.038289 seconds and 3 git commands to generate.