Blame view
fs/jffs2/jffs2_private.h
2.02 KB
5a2543c93 Initial revision |
1 2 3 4 |
#ifndef jffs2_private_h #define jffs2_private_h #include <jffs2/jffs2.h> |
06d01dbe0 * Avoid flicker o... |
5 |
|
5a2543c93 Initial revision |
6 7 8 |
struct b_node { u32 offset; struct b_node *next; |
142a80ffc jffs2: cache data... |
9 |
enum { CRC_UNKNOWN = 0, CRC_OK, CRC_BAD } datacrc; |
5a2543c93 Initial revision |
10 |
}; |
06d01dbe0 * Avoid flicker o... |
11 12 13 |
struct b_list { struct b_node *listTail; struct b_node *listHead; |
6d0f6bcf3 rename CFG_ macro... |
14 |
#ifdef CONFIG_SYS_JFFS2_SORT_FRAGMENTS |
06d01dbe0 * Avoid flicker o... |
15 16 17 18 19 20 21 |
struct b_node *listLast; int (*listCompare)(struct b_node *new, struct b_node *node); u32 listLoops; #endif u32 listCount; struct mem_block *listMemBase; }; |
5a2543c93 Initial revision |
22 |
struct b_lists { |
06d01dbe0 * Avoid flicker o... |
23 24 |
struct b_list dir; struct b_list frag; |
70741004d jffs2: add buffer... |
25 |
void *readbuf; |
5a2543c93 Initial revision |
26 |
}; |
06d01dbe0 * Avoid flicker o... |
27 |
|
5a2543c93 Initial revision |
28 29 30 31 32 33 34 35 36 37 38 39 40 |
struct b_compr_info { u32 num_frags; u32 compr_sum; u32 decompr_sum; }; struct b_jffs2_info { struct b_compr_info compr_info[JFFS2_NUM_COMPR]; }; static inline int hdr_crc(struct jffs2_unknown_node *node) { |
06d01dbe0 * Avoid flicker o... |
41 |
#if 1 |
8bde7f776 * Code cleanup: |
42 |
u32 crc = crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); |
06d01dbe0 * Avoid flicker o... |
43 44 |
#else /* what's the semantics of this? why is this here? */ |
8bde7f776 * Code cleanup: |
45 |
u32 crc = crc32_no_comp(~0, (unsigned char *)node, sizeof(struct jffs2_unknown_node) - 4); |
5a2543c93 Initial revision |
46 |
|
8bde7f776 * Code cleanup: |
47 |
crc ^= ~0; |
06d01dbe0 * Avoid flicker o... |
48 |
#endif |
8bde7f776 * Code cleanup: |
49 50 51 52 53 |
if (node->hdr_crc != crc) { return 0; } else { return 1; } |
5a2543c93 Initial revision |
54 55 56 57 58 |
} static inline int dirent_crc(struct jffs2_raw_dirent *node) { |
8bde7f776 * Code cleanup: |
59 60 61 62 63 |
if (node->node_crc != crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_raw_dirent) - 8)) { return 0; } else { return 1; } |
5a2543c93 Initial revision |
64 65 66 67 68 |
} static inline int dirent_name_crc(struct jffs2_raw_dirent *node) { |
8bde7f776 * Code cleanup: |
69 70 71 72 73 |
if (node->name_crc != crc32_no_comp(0, (unsigned char *)&(node->name), node->nsize)) { return 0; } else { return 1; } |
5a2543c93 Initial revision |
74 75 76 77 78 |
} static inline int inode_crc(struct jffs2_raw_inode *node) { |
8bde7f776 * Code cleanup: |
79 80 81 82 83 |
if (node->node_crc != crc32_no_comp(0, (unsigned char *)node, sizeof(struct jffs2_raw_inode) - 8)) { return 0; } else { return 1; } |
5a2543c93 Initial revision |
84 |
} |
74f92e6a3 Add crc of data t... |
85 86 87 88 |
static inline int data_crc(struct jffs2_raw_inode *node) { if (node->data_crc != crc32_no_comp(0, (unsigned char *) |
09e4b0c5d Add support for L... |
89 90 |
((int) &node->node_crc + sizeof (node->node_crc)), node->csize)) { |
74f92e6a3 Add crc of data t... |
91 92 93 94 95 |
return 0; } else { return 1; } } |
10d3ac346 JFFS2: Use merge ... |
96 97 98 99 |
#if defined(CONFIG_SYS_JFFS2_SORT_FRAGMENTS) /* External merge sort. */ int sort_list(struct b_list *list); #endif |
5a2543c93 Initial revision |
100 |
#endif /* jffs2_private.h */ |