]>
git.ipfire.org Git - people/ms/u-boot.git/blob - fs/jffs2/jffs2_nand_private.h
1 #ifndef jffs2_private_h
2 #define jffs2_private_h
4 #include <jffs2/jffs2.h>
12 u32 offset
; /* physical offset to beginning of real inode */
20 struct b_dirent
*next
;
21 u32 offset
; /* physical offset to beginning of real dirent */
31 struct b_node
*listTail
;
32 struct b_node
*listHead
;
33 unsigned int listCount
;
34 struct mem_block
*listMemBase
;
50 struct b_compr_info compr_info
[JFFS2_NUM_COMPR
];
54 hdr_crc(struct jffs2_unknown_node
*node
)
57 u32 crc
= crc32_no_comp(0, (unsigned char *)node
, sizeof(struct jffs2_unknown_node
) - 4);
59 /* what's the semantics of this? why is this here? */
60 u32 crc
= crc32_no_comp(~0, (unsigned char *)node
, sizeof(struct jffs2_unknown_node
) - 4);
64 if (node
->hdr_crc
!= crc
) {
72 dirent_crc(struct jffs2_raw_dirent
*node
)
74 if (node
->node_crc
!= crc32_no_comp(0, (unsigned char *)node
, sizeof(struct jffs2_raw_dirent
) - 8)) {
82 dirent_name_crc(struct jffs2_raw_dirent
*node
)
84 if (node
->name_crc
!= crc32_no_comp(0, (unsigned char *)&(node
->name
), node
->nsize
)) {
92 inode_crc(struct jffs2_raw_inode
*node
)
94 if (node
->node_crc
!= crc32_no_comp(0, (unsigned char *)node
, sizeof(struct jffs2_raw_inode
) - 8)) {
101 /* Borrowed from include/linux/dcache.h */
103 /* Name hashing routines. Initial hash value */
104 /* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
105 #define init_name_hash() 0
107 /* partial hash update function. Assume roughly 4 bits per character */
108 static inline unsigned long
109 partial_name_hash(unsigned long c
, unsigned long prevhash
)
111 return (prevhash
+ (c
<< 4) + (c
>> 4)) * 11;
115 * Finally: cut down the number of bits to a int value (and try to avoid
118 static inline unsigned long end_name_hash(unsigned long hash
)
120 return (unsigned int) hash
;
123 /* Compute the hash for a name string. */
124 static inline unsigned int
125 full_name_hash(const unsigned char *name
, unsigned int len
)
127 unsigned long hash
= init_name_hash();
129 hash
= partial_name_hash(*name
++, hash
);
130 return end_name_hash(hash
);
133 #endif /* jffs2_private.h */