Lines Matching refs:ih

36 		struct index_header *ih;  in ntfs_index_entry_inconsistent()  local
40 ih = &icx->ir->index; in ntfs_index_entry_inconsistent()
42 ih = &icx->ib->index; in ntfs_index_entry_inconsistent()
44 if ((le32_to_cpu(ih->index_length) > le32_to_cpu(ih->allocated_size)) || in ntfs_index_entry_inconsistent()
45 (le32_to_cpu(ih->index_length) > icx->block_size)) { in ntfs_index_entry_inconsistent()
52 ie_start = (u8 *)ih + le32_to_cpu(ih->entries_offset); in ntfs_index_entry_inconsistent()
53 ie_end = (u8 *)ih + le32_to_cpu(ih->index_length); in ntfs_index_entry_inconsistent()
57 le16_to_cpu(ie->length) > le32_to_cpu(ih->allocated_size) || in ntfs_index_entry_inconsistent()
286 static struct index_entry *ntfs_ie_get_first(struct index_header *ih) in ntfs_ie_get_first() argument
288 return (struct index_entry *)((u8 *)ih + le32_to_cpu(ih->entries_offset)); in ntfs_ie_get_first()
296 static u8 *ntfs_ie_get_end(struct index_header *ih) in ntfs_ie_get_end() argument
298 return (u8 *)ih + le32_to_cpu(ih->index_length); in ntfs_ie_get_end()
319 static struct index_entry *ntfs_ie_get_by_pos(struct index_header *ih, int pos) in ntfs_ie_get_by_pos() argument
325 ie = ntfs_ie_get_first(ih); in ntfs_ie_get_by_pos()
333 static struct index_entry *ntfs_ie_prev(struct index_header *ih, struct index_entry *ie) in ntfs_ie_prev() argument
340 tmp = ntfs_ie_get_first(ih); in ntfs_ie_prev()
350 static int ntfs_ih_numof_entries(struct index_header *ih) in ntfs_ih_numof_entries() argument
358 end = ntfs_ie_get_end(ih); in ntfs_ih_numof_entries()
359 ie = ntfs_ie_get_first(ih); in ntfs_ih_numof_entries()
365 static int ntfs_ih_one_entry(struct index_header *ih) in ntfs_ih_one_entry() argument
367 return (ntfs_ih_numof_entries(ih) == 1); in ntfs_ih_one_entry()
370 static int ntfs_ih_zero_entry(struct index_header *ih) in ntfs_ih_zero_entry() argument
372 return (ntfs_ih_numof_entries(ih) == 0); in ntfs_ih_zero_entry()
375 static void ntfs_ie_delete(struct index_header *ih, struct index_entry *ie) in ntfs_ie_delete() argument
381 new_size = le32_to_cpu(ih->index_length) - le16_to_cpu(ie->length); in ntfs_ie_delete()
382 ih->index_length = cpu_to_le32(new_size); in ntfs_ie_delete()
384 new_size - ((u8 *)ie - (u8 *)ih)); in ntfs_ie_delete()
395 static void ntfs_ie_insert(struct index_header *ih, struct index_entry *ie, in ntfs_ie_insert() argument
402 ih->index_length = cpu_to_le32(le32_to_cpu(ih->index_length) + ie_size); in ntfs_ie_insert()
404 le32_to_cpu(ih->index_length) - ((u8 *)pos - (u8 *)ih) - ie_size); in ntfs_ie_insert()
554 struct ntfs_index_context *icx, struct index_header *ih, in ntfs_ie_lookup() argument
563 index_end = ntfs_ie_get_end(ih); in ntfs_ie_lookup()
569 for (ie = ntfs_ie_get_first(ih); ; ie = ntfs_ie_get_next(ie)) { in ntfs_ie_lookup()
878 static struct index_entry *ntfs_ie_get_median(struct index_header *ih) in ntfs_ie_get_median() argument
886 ie = ie_start = ntfs_ie_get_first(ih); in ntfs_ie_get_median()
887 ie_end = (u8 *)ntfs_ie_get_end(ih); in ntfs_ie_get_median()
1344 static int ntfs_ih_insert(struct index_header *ih, struct index_entry *orig_ie, s64 new_vcn, in ntfs_ih_insert() argument
1362 ie_node = ntfs_ie_get_by_pos(ih, pos); in ntfs_ih_insert()
1366 ntfs_ie_insert(ih, ie, ie_node); in ntfs_ih_insert()
1538 struct index_header *ih; in ntfs_ie_add() local
1556 ih = &icx->ir->index; in ntfs_ie_add()
1558 ih = &icx->ib->index; in ntfs_ie_add()
1560 allocated_size = le32_to_cpu(ih->allocated_size); in ntfs_ie_add()
1561 new_size = le32_to_cpu(ih->index_length) + le16_to_cpu(ie->length); in ntfs_ie_add()
1580 ntfs_ie_insert(ih, ie, icx->entry); in ntfs_ie_add()
1633 static int ntfs_ih_takeout(struct ntfs_index_context *icx, struct index_header *ih, in ntfs_ih_takeout() argument
1643 full = ih->index_length == ih->allocated_size; in ntfs_ih_takeout()
1648 ntfs_ie_delete(ih, ie); in ntfs_ih_takeout()
1655 freed_space = le32_to_cpu(ih->allocated_size) - in ntfs_ih_takeout()
1656 le32_to_cpu(ih->index_length); in ntfs_ih_takeout()
1658 ntfs_ir_truncate(icx, le32_to_cpu(ih->index_length)); in ntfs_ih_takeout()
1681 static void ntfs_ir_leafify(struct ntfs_index_context *icx, struct index_header *ih) in ntfs_ir_leafify() argument
1687 ie = ntfs_ie_get_first(ih); in ntfs_ir_leafify()
1691 ih->index_length = cpu_to_le32(le32_to_cpu(ih->index_length) - sizeof(s64)); in ntfs_ir_leafify()
1692 ih->flags &= ~LARGE_INDEX; in ntfs_ir_leafify()
1696 ntfs_ir_truncate(icx, le32_to_cpu(ih->index_length)); in ntfs_ir_leafify()
1703 static int ntfs_ih_reparent_end(struct ntfs_index_context *icx, struct index_header *ih, in ntfs_ih_reparent_end() argument
1710 ie = ntfs_ie_get_by_pos(ih, ntfs_icx_parent_pos(icx)); in ntfs_ih_reparent_end()
1711 ie_prev = ntfs_ie_prev(ih, ie); in ntfs_ih_reparent_end()
1716 return ntfs_ih_takeout(icx, ih, ie_prev, ib); in ntfs_ih_reparent_end()
1778 struct index_header *ih; in ntfs_index_rm_node() local
1834 ih = &icx->ir->index; in ntfs_index_rm_node()
1836 ih = &icx->ib->index; in ntfs_index_rm_node()
1839 new_size = le32_to_cpu(ih->index_length) + delta; in ntfs_index_rm_node()
1846 ih = &icx->ir->index; in ntfs_index_rm_node()
1847 entry = ntfs_ie_get_by_pos(ih, entry_pos); in ntfs_index_rm_node()
1849 } else if (new_size > le32_to_cpu(ih->allocated_size)) { in ntfs_index_rm_node()
1858 ntfs_ie_delete(ih, entry); in ntfs_index_rm_node()
1859 ntfs_ie_insert(ih, ie, entry); in ntfs_index_rm_node()
1892 struct index_header *ih; in ntfs_index_rm() local
1902 ih = &icx->ir->index; in ntfs_index_rm()
1904 ih = &icx->ib->index; in ntfs_index_rm()
1910 } else if (icx->is_in_root || !ntfs_ih_one_entry(ih)) { in ntfs_index_rm()
1911 ntfs_ie_delete(ih, icx->entry); in ntfs_index_rm()
1914 ret = ntfs_ir_truncate(icx, le32_to_cpu(ih->index_length)); in ntfs_index_rm()