X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=fs%2Fjffs2%2Fjffs2_private.h;h=658b32521904c98eb0460f9760495402fd4a345d;hb=bc4147ab2d69;hp=ca0af1f9a4be64c1d90ebce05f836ce5ae360dc5;hpb=5a2543c93bcd9446e97d60a8d3cde14c757f633c;p=oweals%2Fu-boot.git diff --git a/fs/jffs2/jffs2_private.h b/fs/jffs2/jffs2_private.h index ca0af1f9a4..658b325219 100644 --- a/fs/jffs2/jffs2_private.h +++ b/fs/jffs2/jffs2_private.h @@ -3,23 +3,31 @@ #include + struct b_node { u32 offset; struct b_node *next; + enum { CRC_UNKNOWN = 0, CRC_OK, CRC_BAD } datacrc; }; -struct b_lists { - char *partOffset; - struct b_node *dirListTail; - struct b_node *dirListHead; - u32 dirListCount; - u32 dirListMemBase; - struct b_node *fragListTail; - struct b_node *fragListHead; - u32 fragListCount; - u32 fragListMemBase; +struct b_list { + struct b_node *listTail; + struct b_node *listHead; +#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS + struct b_node *listLast; + int (*listCompare)(struct b_node *new, struct b_node *node); + u32 listLoops; +#endif + u32 listCount; + struct mem_block *listMemBase; +}; +struct b_lists { + struct b_list dir; + struct b_list frag; + void *readbuf; }; + struct b_compr_info { u32 num_frags; u32 compr_sum; @@ -33,46 +41,61 @@ struct b_jffs2_info { static inline int hdr_crc(struct jffs2_unknown_node *node) { - u32 crc = crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); - u32 crc_blah = crc32_no_comp(~0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); +#if 1 + u32 crc = crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); +#else + /* what's the semantics of this? why is this here? */ + u32 crc = crc32_no_comp(~0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); - crc_blah ^= ~0; - - if (node->hdr_crc != crc) { - return 0; - } else { - return 1; - } + crc ^= ~0; +#endif + if (node->hdr_crc != crc) { + return 0; + } else { + return 1; + } } static inline int dirent_crc(struct jffs2_raw_dirent *node) { - if (node->node_crc != crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_raw_dirent) - 8)) { - return 0; - } else { - return 1; - } + if (node->node_crc != crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_raw_dirent) - 8)) { + return 0; + } else { + return 1; + } } static inline int dirent_name_crc(struct jffs2_raw_dirent *node) { - if (node->name_crc != crc32_no_comp(0, (unsigned char *)&(node->name), node->nsize)) { - return 0; - } else { - return 1; - } + if (node->name_crc != crc32_no_comp(0, (unsigned char *)&(node->name), node->nsize)) { + return 0; + } else { + return 1; + } } static inline int inode_crc(struct jffs2_raw_inode *node) { - if (node->node_crc != crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_raw_inode) - 8)) { - return 0; - } else { - return 1; - } + if (node->node_crc != crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_raw_inode) - 8)) { + return 0; + } else { + return 1; + } +} + +static inline int +data_crc(struct jffs2_raw_inode *node) +{ + if (node->data_crc != crc32_no_comp(0, (unsigned char *) + ((int) &node->node_crc + sizeof (node->node_crc)), + node->csize)) { + return 0; + } else { + return 1; + } } #endif /* jffs2_private.h */