From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilya Yanok Date: Thu, 20 Nov 2008 17:31:51 +0300 Subject: [U-Boot] [PATCH 3/6] jffs2: rewrite jffs2 scanning code based on Linux one In-Reply-To: <20081113180605.GD25695@game.jcrosoft.org> References: <1226594976-6087-1-git-send-email-yanok@emcraft.com> <1226594976-6087-4-git-send-email-yanok@emcraft.com> <20081113180605.GD25695@game.jcrosoft.org> Message-ID: <492574D7.8060502@emcraft.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Jean-Christophe, Jean-Christophe PLAGNIOL-VILLARD wrote: >> >> /* start at the beginning of the partition */ >> - while (offset < max) { >> - if ((oldoffset >> SPIN_BLKSIZE) != (offset >> SPIN_BLKSIZE)) { >> - printf("\b\b%c ", spinner[counter++ % sizeof(spinner)]); >> - oldoffset = offset; >> - } >> + for (i = 0; i < nr_sectors; i++) { >> + uint32_t sector_ofs = i * part->sector_size; >> + uint32_t buf_ofs = sector_ofs; >> + uint32_t buf_len = EMPTY_SCAN_SIZE(part->sector_size); >> + uint32_t ofs, prevofs; >> >> WATCHDOG_RESET(); >> + get_fl_mem((u32)part->offset + buf_ofs, buf_len, buf); >> >> - node = (struct jffs2_unknown_node *) get_node_mem((u32)part->offset + offset); >> - if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) { >> + /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ >> + ofs = 0; >> + >> + /* Scan only 4KiB of 0xFF before declaring it's empty */ >> + while (ofs < EMPTY_SCAN_SIZE(part->sector_size) && >> + *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF) >> > please use readx/writex > Why? it's memory buffer actually. Regards, Ilya.