Lines Matching full:off

19 bool is_bnode_offset_valid(struct hfs_bnode *node, int off)  in is_bnode_offset_valid()  argument
21 bool is_valid = off < node->tree->node_size; in is_bnode_offset_valid()
28 node->tree->node_size, off); in is_bnode_offset_valid()
35 int check_and_correct_requested_length(struct hfs_bnode *node, int off, int len) in check_and_correct_requested_length() argument
39 if (!is_bnode_offset_valid(node, off)) in check_and_correct_requested_length()
44 if ((off + len) > node_size) { in check_and_correct_requested_length()
45 int new_len = (int)node_size - off; in check_and_correct_requested_length()
52 node->tree->node_size, off, len, new_len); in check_and_correct_requested_length()
60 void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len) in hfs_bnode_read() argument
67 if (!is_bnode_offset_valid(node, off)) in hfs_bnode_read()
75 node->tree->node_size, off, len); in hfs_bnode_read()
79 len = check_and_correct_requested_length(node, off, len); in hfs_bnode_read()
81 off += node->page_offset; in hfs_bnode_read()
82 pagenum = off >> PAGE_SHIFT; in hfs_bnode_read()
83 off &= ~PAGE_MASK; /* compute page offset for the first page */ in hfs_bnode_read()
89 bytes_to_read = min_t(int, len - bytes_read, PAGE_SIZE - off); in hfs_bnode_read()
91 memcpy_from_page(buf + bytes_read, page, off, bytes_to_read); in hfs_bnode_read()
94 off = 0; /* page offset only applies to the first page */ in hfs_bnode_read()
98 u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off) in hfs_bnode_read_u16() argument
102 hfs_bnode_read(node, &data, off, 2); in hfs_bnode_read_u16()
106 u8 hfs_bnode_read_u8(struct hfs_bnode *node, int off) in hfs_bnode_read_u8() argument
110 hfs_bnode_read(node, &data, off, 1); in hfs_bnode_read_u8()
114 void hfs_bnode_read_key(struct hfs_bnode *node, void *key, int off) in hfs_bnode_read_key() argument
122 key_len = hfs_bnode_read_u8(node, off) + 1; in hfs_bnode_read_key()
132 hfs_bnode_read(node, key, off, key_len); in hfs_bnode_read_key()
135 void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len) in hfs_bnode_write() argument
139 if (!is_bnode_offset_valid(node, off)) in hfs_bnode_write()
147 node->tree->node_size, off, len); in hfs_bnode_write()
151 len = check_and_correct_requested_length(node, off, len); in hfs_bnode_write()
153 off += node->page_offset; in hfs_bnode_write()
156 memcpy_to_page(page, off, buf, len); in hfs_bnode_write()
160 void hfs_bnode_write_u16(struct hfs_bnode *node, int off, u16 data) in hfs_bnode_write_u16() argument
164 hfs_bnode_write(node, &v, off, 2); in hfs_bnode_write_u16()
167 void hfs_bnode_write_u8(struct hfs_bnode *node, int off, u8 data) in hfs_bnode_write_u8() argument
170 hfs_bnode_write(node, &data, off, 1); in hfs_bnode_write_u8()
173 void hfs_bnode_clear(struct hfs_bnode *node, int off, int len) in hfs_bnode_clear() argument
177 if (!is_bnode_offset_valid(node, off)) in hfs_bnode_clear()
185 node->tree->node_size, off, len); in hfs_bnode_clear()
189 len = check_and_correct_requested_length(node, off, len); in hfs_bnode_clear()
191 off += node->page_offset; in hfs_bnode_clear()
194 memzero_page(page, off, len); in hfs_bnode_clear()
244 int i, off, key_off; in hfs_bnode_dump() local
252 off = node->tree->node_size - 2; in hfs_bnode_dump()
253 for (i = be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i--) { in hfs_bnode_dump()
254 key_off = hfs_bnode_read_u16(node, off); in hfs_bnode_dump()
348 loff_t off; in __hfs_bnode_create() local
384 off = (loff_t)cnid * tree->node_size; in __hfs_bnode_create()
385 block = off >> PAGE_SHIFT; in __hfs_bnode_create()
386 node->page_offset = off & ~PAGE_MASK; in __hfs_bnode_create()
419 int i, rec_off, off, next_off; in hfs_bnode_find() local
469 off = hfs_bnode_read_u16(node, rec_off); in hfs_bnode_find()
470 if (off != sizeof(struct hfs_bnode_desc)) in hfs_bnode_find()
472 for (i = 1; i <= node->num_recs; off = next_off, i++) { in hfs_bnode_find()
475 if (next_off <= off || in hfs_bnode_find()
479 entry_size = next_off - off; in hfs_bnode_find()
483 key_size = hfs_bnode_read_u8(node, off) + 1; in hfs_bnode_find()