* for a bootloader as small and simple as possible. Instead of worring about
* unneccesary data copies, node scans, etc, I just optimized for the known
* common case, a kernel, which looks like:
- * (1) most pages are 4096 bytes
+ * (1) most pages are 4096 bytes
* (2) version numbers are somewhat sorted in acsending order
* (3) multiple compressed blocks making up one page is uncommon
*
#include <malloc.h>
#include <linux/stat.h>
#include <linux/time.h>
+#include <watchdog.h>
#if defined(CONFIG_CMD_JFFS2)
#include "jffs2_private.h"
-#define NODE_CHUNK 1024 /* size of memory allocation chunk in b_nodes */
-#define SPIN_BLKSIZE 18 /* spin after having scanned 1<<BLKSIZE bytes */
+#define NODE_CHUNK 1024 /* size of memory allocation chunk in b_nodes */
+#define SPIN_BLKSIZE 18 /* spin after having scanned 1<<BLKSIZE bytes */
/* Debugging switches */
#undef DEBUG_DIRENTS /* print directory entry list after scan */
#undef DEBUG_FRAGMENTS /* print fragment list after scan */
-#undef DEBUG /* enable debugging messages */
+#undef DEBUG /* enable debugging messages */
#ifdef DEBUG
/* this one defined in nand_legacy.c */
int read_jffs2_nand(size_t start, size_t len,
size_t * retlen, u_char * buf, int nanddev);
-#else
-/* info for NAND chips, defined in drivers/nand/nand.c */
-extern nand_info_t nand_info[];
#endif
#define NAND_PAGE_SIZE 512
{
struct mtdids *id = current_part->dev->id;
u32 bytes_read = 0;
-#if defined(CFG_NAND_LEGACY)
size_t retlen;
-#else
- ulong retlen;
-#endif
int cpy_bytes;
while (bytes_read < size) {
}
if (jDir->version == version && inode != 0) {
- /* I'm pretty sure this isn't legal */
+ /* I'm pretty sure this isn't legal */
putstr(" ** ERROR ** ");
putnstr(jDir->name, jDir->nsize);
putLabeledWord(" has dup version =", version);
for(b = pL->dir.listHead; b; b = b->next) {
jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
if (ino == jDir->ino) {
- if (jDir->version < version) {
+ if (jDir->version < version) {
put_fl_mem(jDir);
continue;
}
if (jDir->version == version && jDirFoundType) {
- /* I'm pretty sure this isn't legal */
+ /* I'm pretty sure this isn't legal */
putstr(" ** ERROR ** ");
putnstr(jDir->name, jDir->nsize);
putLabeledWord(" has dup version (resolve) = ",
putLabeledWord("\tbuild_list: type = ", jDir->type);
putLabeledWord("\tbuild_list: node_crc = ", jDir->node_crc);
putLabeledWord("\tbuild_list: name_crc = ", jDir->name_crc);
- putLabeledWord("\tbuild_list: offset = ", b->offset); /* FIXME: ? [RS] */
+ putLabeledWord("\tbuild_list: offset = ", b->offset); /* FIXME: ? [RS] */
b = b->next;
put_fl_mem(jDir);
}
/* start at the beginning of the partition */
while (offset < max) {
- if ((oldoffset >> SPIN_BLKSIZE) != (offset >> SPIN_BLKSIZE)) {
+ if ((oldoffset >> SPIN_BLKSIZE) != (offset >> SPIN_BLKSIZE)) {
printf("\b\b%c ", spinner[counter++ % sizeof(spinner)]);
oldoffset = offset;
}
+ WATCHDOG_RESET();
+
node = (struct jffs2_unknown_node *) get_node_mem((u32)part->offset + offset);
if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) {
/* if its a fragment add it */
} else if (node->nodetype == JFFS2_NODETYPE_CLEANMARKER) {
if (node->totlen != sizeof(struct jffs2_unknown_node))
printf("OOPS Cleanmarker has bad size "
- "%d != %d\n", node->totlen,
+ "%d != %zu\n",
+ node->totlen,
sizeof(struct jffs2_unknown_node));
} else if (node->nodetype == JFFS2_NODETYPE_PADDING) {
if (node->totlen < sizeof(struct jffs2_unknown_node))
printf("OOPS Padding has bad size "
- "%d < %d\n", node->totlen,
+ "%d < %zu\n",
+ node->totlen,
sizeof(struct jffs2_unknown_node));
} else {
- printf("Unknown node type: %x len %d "
- "offset 0x%x\n", node->nodetype,
+ printf("Unknown node type: %x len %d offset 0x%x\n",
+ node->nodetype,
node->totlen, offset);
}
offset += ((node->totlen + 3) & ~3);
return 1;
}
-#endif /* CFG_CMD_JFFS2 */
+#endif