Lines Matching refs:ih
207 static INDEX_ENTRY *ntfs_ie_get_first(INDEX_HEADER *ih)
209 return (INDEX_ENTRY *)((u8 *)ih + le32_to_cpu(ih->entries_offset));
217 static u8 *ntfs_ie_get_end(INDEX_HEADER *ih)
220 return (u8 *)ih + le32_to_cpu(ih->index_length);
241 static INDEX_ENTRY *ntfs_ie_get_by_pos(INDEX_HEADER *ih, int pos)
247 ie = ntfs_ie_get_first(ih);
255 static INDEX_ENTRY *ntfs_ie_prev(INDEX_HEADER *ih, INDEX_ENTRY *ie)
262 tmp = ntfs_ie_get_first(ih);
289 void ntfs_ih_filename_dump(INDEX_HEADER *ih)
295 ie = ntfs_ie_get_first(ih);
302 static int ntfs_ih_numof_entries(INDEX_HEADER *ih)
310 end = ntfs_ie_get_end(ih);
311 ie = ntfs_ie_get_first(ih);
317 static int ntfs_ih_one_entry(INDEX_HEADER *ih)
319 return (ntfs_ih_numof_entries(ih) == 1);
322 static int ntfs_ih_zero_entry(INDEX_HEADER *ih)
324 return (ntfs_ih_numof_entries(ih) == 0);
327 static void ntfs_ie_delete(INDEX_HEADER *ih, INDEX_ENTRY *ie)
333 new_size = le32_to_cpu(ih->index_length) - le16_to_cpu(ie->length);
334 ih->index_length = cpu_to_le32(new_size);
336 new_size - ((u8 *)ie - (u8 *)ih));
345 * Insert @ie index entry at @pos entry. Used @ih values should be ok already.
347 static void ntfs_ie_insert(INDEX_HEADER *ih, INDEX_ENTRY *ie, INDEX_ENTRY *pos)
353 ih->index_length = cpu_to_le32(le32_to_cpu(ih->index_length) + ie_size);
355 le32_to_cpu(ih->index_length) - ((u8 *)pos - (u8 *)ih) - ie_size);
576 ntfs_index_context *icx, INDEX_HEADER *ih,
585 index_end = ntfs_ie_get_end(ih);
591 for (ie = ntfs_ie_get_first(ih); ; ie = ntfs_ie_get_next(ie)) {
938 static INDEX_ENTRY *ntfs_ie_get_median(INDEX_HEADER *ih)
946 ie = ie_start = ntfs_ie_get_first(ih);
947 ie_end = (u8 *)ntfs_ie_get_end(ih);
1394 static int ntfs_ih_insert(INDEX_HEADER *ih, INDEX_ENTRY *orig_ie, VCN new_vcn,
1411 ie_node = ntfs_ie_get_by_pos(ih, pos);
1415 ntfs_ie_insert(ih, ie, ie_node);
1555 INDEX_HEADER *ih;
1581 ih = &icx->ir->index;
1583 ih = &icx->ib->index;
1585 allocated_size = le32_to_cpu(ih->allocated_size);
1586 new_size = le32_to_cpu(ih->index_length) + le16_to_cpu(ie->length);
1606 ntfs_ie_insert(ih, ie, icx->entry);
1663 static int ntfs_ih_takeout(ntfs_index_context *icx, INDEX_HEADER *ih,
1673 full = ih->index_length == ih->allocated_size;
1678 ntfs_ie_delete(ih, ie);
1685 freed_space = le32_to_cpu(ih->allocated_size)
1686 - le32_to_cpu(ih->index_length);
1688 ntfs_ir_truncate(icx, le32_to_cpu(ih->index_length));
1708 static void ntfs_ir_leafify(ntfs_index_context *icx, INDEX_HEADER *ih)
1714 ie = ntfs_ie_get_first(ih);
1718 ih->index_length = cpu_to_le32(le32_to_cpu(ih->index_length) - sizeof(VCN));
1719 ih->ih_flags &= ~LARGE_INDEX;
1722 ntfs_ir_truncate(icx, le32_to_cpu(ih->index_length));
1729 static int ntfs_ih_reparent_end(ntfs_index_context *icx, INDEX_HEADER *ih,
1736 ie = ntfs_ie_get_by_pos(ih, ntfs_icx_parent_pos(icx));
1737 ie_prev = ntfs_ie_prev(ih, ie);
1741 return ntfs_ih_takeout(icx, ih, ie_prev, ib);
1804 INDEX_HEADER *ih;
1855 ih = &icx->ir->index;
1857 ih = &icx->ib->index;
1860 new_size = le32_to_cpu(ih->index_length) + delta;
1867 ih = &icx->ir->index;
1868 entry = ntfs_ie_get_by_pos(ih, entry_pos);
1870 } else if (new_size > le32_to_cpu(ih->allocated_size)) {
1879 ntfs_ie_delete(ih, entry);
1880 ntfs_ie_insert(ih, ie, entry);
1919 INDEX_HEADER *ih;
1930 ih = &icx->ir->index;
1932 ih = &icx->ib->index;
1938 } else if (icx->is_in_root || !ntfs_ih_one_entry(ih)) {
1940 ntfs_ie_delete(ih, icx->entry);
1943 err = ntfs_ir_truncate(icx, le32_to_cpu(ih->index_length));