Lines Matching refs:key

51 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
322 ubifs_assert(is_hash_key(c, &zbr->key)); in lnc_add()
397 ubifs_assert(is_hash_key(c, &zbr->key)); in tnc_read_node_nm()
407 err = fallible_read_node(c, &zbr->key, zbr, node); in tnc_read_node_nm()
499 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, in fallible_read_node() argument
504 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
506 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, in fallible_read_node()
513 key_read(c, &dent->key, &node_key); in fallible_read_node()
514 if (keys_cmp(c, key, &node_key) != 0) in fallible_read_node()
518 dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ", in fallible_read_node()
703 static int resolve_collision(struct ubifs_info *c, const union ubifs_key *key, in resolve_collision() argument
726 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in resolve_collision()
790 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision()
834 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
892 const union ubifs_key *key, in fallible_resolve_collision() argument
927 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in fallible_resolve_collision()
972 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in fallible_resolve_collision()
994 dbg_mntk(key, "dangling match LEB %d:%d len %d key ", in fallible_resolve_collision()
1036 const union ubifs_key *key, in resolve_collision_directly() argument
1055 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1073 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1171 int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, in ubifs_lookup_level0() argument
1178 dbg_tnck(key, "search key "); in ubifs_lookup_level0()
1179 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in ubifs_lookup_level0()
1193 exact = ubifs_search_zbranch(c, znode, key, n); in ubifs_lookup_level0()
1215 if (exact || !is_hash_key(c, key) || *n != -1) { in ubifs_lookup_level0()
1271 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in ubifs_lookup_level0()
1307 static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, in lookup_level0_dirty() argument
1314 dbg_tnck(key, "search and dirty key "); in lookup_level0_dirty()
1332 exact = ubifs_search_zbranch(c, znode, key, n); in lookup_level0_dirty()
1359 if (exact || !is_hash_key(c, key) || *n != -1) { in lookup_level0_dirty()
1376 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in lookup_level0_dirty()
1446 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_locate() argument
1455 found = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_locate()
1468 if (is_hash_key(c, key)) { in ubifs_tnc_locate()
1491 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1524 unsigned int block = key_block(c, &bu->key); in ubifs_tnc_get_bu_keys()
1533 err = ubifs_lookup_level0(c, &bu->key, &znode, &n); in ubifs_tnc_get_bu_keys()
1552 union ubifs_key *key; in ubifs_tnc_get_bu_keys() local
1560 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1562 if (key_inum(c, key) != key_inum(c, &bu->key) || in ubifs_tnc_get_bu_keys()
1563 key_type(c, key) != UBIFS_DATA_KEY) { in ubifs_tnc_get_bu_keys()
1590 next_block = key_block(c, key); in ubifs_tnc_get_bu_keys()
1632 block = key_block(c, &bu->key) + bu->blk_cnt; in ubifs_tnc_get_bu_keys()
1635 if (key_block(c, &bu->zbranch[bu->cnt - 1].key) < block) in ubifs_tnc_get_bu_keys()
1722 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1725 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1779 dbg_tnck(&bu->key, "key "); in ubifs_tnc_bulk_read()
1808 static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_nm() argument
1814 dbg_tnck(key, "name '%.*s' key ", nm->len, nm->name); in do_lookup_nm()
1816 found = ubifs_lookup_level0(c, key, &znode, &n); in do_lookup_nm()
1827 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1856 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_nm() argument
1866 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1878 return do_lookup_nm(c, key, node, nm); in ubifs_tnc_lookup_nm()
1893 union ubifs_key *key, *key1; in correct_parent_keys() local
1898 key = &znode->zbranch[0].key; in correct_parent_keys()
1899 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1901 while (keys_cmp(c, key, key1) < 0) { in correct_parent_keys()
1902 key_copy(c, key, key1); in correct_parent_keys()
1907 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1979 union ubifs_key *key = &zbr->key, *key1; in tnc_insert() local
1988 dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level); in tnc_insert()
2003 dbg_tnck(key, "splitting level %d, key ", znode->level); in tnc_insert()
2019 if (znode->level == 0 && key_type(c, key) == UBIFS_DATA_KEY) { in tnc_insert()
2022 key1 = &znode->zbranch[n - 1].key; in tnc_insert()
2023 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2033 key1 = &znode->zbranch[0].key; in tnc_insert()
2034 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2036 key1 = &znode->zbranch[n].key; in tnc_insert()
2037 if (key_inum(c, key1) != key_inum(c, key) || in tnc_insert()
2097 dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level); in tnc_insert()
2110 zbr->key = zn->zbranch[0].key; in tnc_insert()
2133 zi->zbranch[0].key = znode->zbranch[0].key; in tnc_insert()
2138 zi->zbranch[1].key = zn->zbranch[0].key; in tnc_insert()
2166 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, in ubifs_tnc_add() argument
2173 dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len); in ubifs_tnc_add()
2174 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add()
2182 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2215 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_replace() argument
2222 dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum, in ubifs_tnc_replace()
2224 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_replace()
2243 } else if (is_hash_key(c, key)) { in ubifs_tnc_replace()
2244 found = resolve_collision_directly(c, key, &znode, &n, in ubifs_tnc_replace()
2298 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_add_nm() argument
2305 dbg_tnck(key, "LEB %d:%d, name '%.*s', key ", in ubifs_tnc_add_nm()
2307 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add_nm()
2315 found = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_add_nm()
2318 found = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_add_nm()
2353 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2370 return ubifs_tnc_remove_nm(c, key, &noname); in ubifs_tnc_add_nm()
2399 dbg_tnck(&znode->zbranch[n].key, "deleting key "); in tnc_delete()
2503 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) in ubifs_tnc_remove() argument
2509 dbg_tnck(key, "key "); in ubifs_tnc_remove()
2510 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove()
2533 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_nm() argument
2540 dbg_tnck(key, "%.*s, key ", nm->len, nm->name); in ubifs_tnc_remove_nm()
2541 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2547 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2550 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2583 static int key_in_range(struct ubifs_info *c, union ubifs_key *key, in key_in_range() argument
2586 if (keys_cmp(c, key, from_key) < 0) in key_in_range()
2588 if (keys_cmp(c, key, to_key) > 0) in key_in_range()
2608 union ubifs_key *key; in ubifs_tnc_remove_range() local
2618 key = from_key; in ubifs_tnc_remove_range()
2627 key = &znode->zbranch[n].key; in ubifs_tnc_remove_range()
2628 if (!key_in_range(c, key, from_key, to_key)) { in ubifs_tnc_remove_range()
2645 key = &znode->zbranch[i].key; in ubifs_tnc_remove_range()
2646 if (!key_in_range(c, key, from_key, to_key)) in ubifs_tnc_remove_range()
2655 dbg_tnck(key, "removing key "); in ubifs_tnc_remove_range()
2732 key_read(c, &xent->key, &key1); in ubifs_tnc_remove_ino()
2766 union ubifs_key *key, in ubifs_tnc_next_ent() argument
2769 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent()
2775 dbg_tnck(key, "%s ", nm->name ? (char *)nm->name : "(lowest)"); in ubifs_tnc_next_ent()
2776 ubifs_assert(is_hash_key(c, key)); in ubifs_tnc_next_ent()
2779 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2787 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_next_ent()
2790 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
2830 dkey = &zbr->key; in ubifs_tnc_next_ent()
2831 if (key_inum(c, dkey) != key_inum(c, key) || in ubifs_tnc_next_ent()
2993 union ubifs_key *key, int level, in lookup_znode() argument
2999 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in lookup_znode()
3022 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3037 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3050 if (!is_hash_key(c, key)) in lookup_znode()
3076 if (keys_cmp(c, &znode->zbranch[n].key, key) < 0) in lookup_znode()
3098 if (keys_cmp(c, &znode->zbranch[n].key, key) > 0) in lookup_znode()
3121 int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, in is_idx_node_in_tnc() argument
3126 znode = lookup_znode(c, key, level, lnum, offs); in is_idx_node_in_tnc()
3148 static int is_leaf_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, in is_leaf_node_in_tnc() argument
3154 const int unique = !is_hash_key(c, key); in is_leaf_node_in_tnc()
3156 found = ubifs_lookup_level0(c, key, &znode, &n); in is_leaf_node_in_tnc()
3179 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3195 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3218 int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_tnc_has_node() argument
3225 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3237 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3258 int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_dirty_idx_node() argument
3265 znode = lookup_znode(c, key, level, lnum, offs); in ubifs_dirty_idx_node()
3298 union ubifs_key from_key, to_key, *key; in dbg_check_inode_size() local
3317 key = &from_key; in dbg_check_inode_size()
3330 key = &znode->zbranch[n].key; in dbg_check_inode_size()
3331 if (!key_in_range(c, key, &from_key, &to_key)) in dbg_check_inode_size()
3335 block = key_block(c, key); in dbg_check_inode_size()