11 #include <linux/string.h>
12 #include <linux/slab.h>
34 while ((len -= l) != 0) {
87 while ((len -= l) != 0) {
117 while ((len -= l) != 0) {
129 struct page **src_page, **dst_page;
135 tree = src_node->
tree;
150 while ((len -= l) != 0) {
158 void *src_ptr, *dst_ptr;
161 src_ptr =
kmap(*src_page) +
src;
162 dst_ptr =
kmap(*dst_page) +
dst;
173 memcpy(dst_ptr, src_ptr, l);
181 }
while ((len -= l));
187 struct page **src_page, **dst_page;
216 kmap(*src_page) + src, len);
221 void *src_ptr, *dst_ptr;
224 src_ptr =
kmap(*src_page) +
src;
225 dst_ptr =
kmap(*dst_page) +
dst;
236 memmove(dst_ptr - l, src_ptr - l, l);
244 }
while ((len -= l));
255 kmap(*src_page) + src, l);
260 while ((len -= l) != 0) {
263 kmap(*++src_page), l);
269 void *src_ptr, *dst_ptr;
272 src_ptr =
kmap(*src_page) +
src;
273 dst_ptr =
kmap(*dst_page) +
dst;
293 }
while ((len -= l));
310 off = node->
tree->node_size - 2;
320 tmp = node->
tree->max_key_len + 2;
375 static inline int hfs_bnode_hash(
u32 num)
377 num = (num >> 16) + num;
393 for (node = tree->
node_hash[hfs_bnode_hash(cnid)];
395 if (node->
this == cnid)
416 sb = tree->
inode->i_sb;
417 size =
sizeof(
struct hfs_bnode) + tree->pages_per_bnode *
418 sizeof(
struct page *);
432 hash = hfs_bnode_hash(cnid);
445 mapping = tree->
inode->i_mapping;
450 page = read_mapping_page(mapping, block,
NULL);
453 if (PageError(page)) {
473 for (p = &node->
tree->node_hash[hfs_bnode_hash(node->
this)];
478 node->
tree->node_hash_cnt--;
486 int i, rec_off, off, next_off;
501 node = __hfs_bnode_create(tree, num);
518 switch (node->
type) {
540 for (i = 1; i <= node->
num_recs; off = next_off, i++) {
543 if (next_off <= off ||
547 entry_size = next_off - off;
552 if (key_size >= entry_size || key_size & 1)
564 return ERR_PTR(-
EIO);
572 for (i = 0; i < node->
tree->pages_per_bnode; i++)
593 node = __hfs_bnode_create(tree, num);
598 return ERR_PTR(-
EIO);