Lines Matching refs:key

321 	ubifs_assert(is_hash_key(c, &zbr->key));  in lnc_add()
396 ubifs_assert(is_hash_key(c, &zbr->key)); in tnc_read_node_nm()
486 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, in fallible_read_node() argument
491 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
493 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, in fallible_read_node()
500 key_read(c, &dent->key, &node_key); in fallible_read_node()
501 if (keys_cmp(c, key, &node_key) != 0) in fallible_read_node()
505 dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ", in fallible_read_node()
690 static int resolve_collision(struct ubifs_info *c, const union ubifs_key *key, in resolve_collision() argument
713 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in resolve_collision()
777 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision()
821 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
879 const union ubifs_key *key, in fallible_resolve_collision() argument
914 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in fallible_resolve_collision()
959 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in fallible_resolve_collision()
981 dbg_mntk(key, "dangling match LEB %d:%d len %d key ", in fallible_resolve_collision()
1023 const union ubifs_key *key, in resolve_collision_directly() argument
1042 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1060 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1158 int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, in ubifs_lookup_level0() argument
1165 dbg_tnck(key, "search key "); in ubifs_lookup_level0()
1166 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in ubifs_lookup_level0()
1180 exact = ubifs_search_zbranch(c, znode, key, n); in ubifs_lookup_level0()
1202 if (exact || !is_hash_key(c, key) || *n != -1) { in ubifs_lookup_level0()
1258 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in ubifs_lookup_level0()
1294 static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, in lookup_level0_dirty() argument
1301 dbg_tnck(key, "search and dirty key "); in lookup_level0_dirty()
1319 exact = ubifs_search_zbranch(c, znode, key, n); in lookup_level0_dirty()
1346 if (exact || !is_hash_key(c, key) || *n != -1) { in lookup_level0_dirty()
1363 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in lookup_level0_dirty()
1429 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_locate() argument
1438 found = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_locate()
1451 if (is_hash_key(c, key)) { in ubifs_tnc_locate()
1474 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1507 unsigned int block = key_block(c, &bu->key); in ubifs_tnc_get_bu_keys()
1516 err = ubifs_lookup_level0(c, &bu->key, &znode, &n); in ubifs_tnc_get_bu_keys()
1535 union ubifs_key *key; in ubifs_tnc_get_bu_keys() local
1543 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1545 if (key_inum(c, key) != key_inum(c, &bu->key) || in ubifs_tnc_get_bu_keys()
1546 key_type(c, key) != UBIFS_DATA_KEY) { in ubifs_tnc_get_bu_keys()
1573 next_block = key_block(c, key); in ubifs_tnc_get_bu_keys()
1615 block = key_block(c, &bu->key) + bu->blk_cnt; in ubifs_tnc_get_bu_keys()
1618 if (key_block(c, &bu->zbranch[bu->cnt - 1].key) < block) in ubifs_tnc_get_bu_keys()
1705 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1708 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1762 dbg_tnck(&bu->key, "key "); in ubifs_tnc_bulk_read()
1791 static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_nm() argument
1797 dbg_tnck(key, "name '%.*s' key ", nm->len, nm->name); in do_lookup_nm()
1799 found = ubifs_lookup_level0(c, key, &znode, &n); in do_lookup_nm()
1810 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1839 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_nm() argument
1849 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1861 return do_lookup_nm(c, key, node, nm); in ubifs_tnc_lookup_nm()
1876 union ubifs_key *key, *key1; in correct_parent_keys() local
1881 key = &znode->zbranch[0].key; in correct_parent_keys()
1882 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1884 while (keys_cmp(c, key, key1) < 0) { in correct_parent_keys()
1885 key_copy(c, key, key1); in correct_parent_keys()
1890 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1962 union ubifs_key *key = &zbr->key, *key1; in tnc_insert() local
1971 dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level); in tnc_insert()
1986 dbg_tnck(key, "splitting level %d, key ", znode->level); in tnc_insert()
2002 if (znode->level == 0 && key_type(c, key) == UBIFS_DATA_KEY) { in tnc_insert()
2005 key1 = &znode->zbranch[n - 1].key; in tnc_insert()
2006 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2016 key1 = &znode->zbranch[0].key; in tnc_insert()
2017 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2019 key1 = &znode->zbranch[n].key; in tnc_insert()
2020 if (key_inum(c, key1) != key_inum(c, key) || in tnc_insert()
2080 dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level); in tnc_insert()
2093 zbr->key = zn->zbranch[0].key; in tnc_insert()
2116 zi->zbranch[0].key = znode->zbranch[0].key; in tnc_insert()
2121 zi->zbranch[1].key = zn->zbranch[0].key; in tnc_insert()
2149 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, in ubifs_tnc_add() argument
2156 dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len); in ubifs_tnc_add()
2157 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add()
2165 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2198 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_replace() argument
2205 dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum, in ubifs_tnc_replace()
2207 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_replace()
2226 } else if (is_hash_key(c, key)) { in ubifs_tnc_replace()
2227 found = resolve_collision_directly(c, key, &znode, &n, in ubifs_tnc_replace()
2281 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_add_nm() argument
2288 dbg_tnck(key, "LEB %d:%d, name '%.*s', key ", in ubifs_tnc_add_nm()
2290 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add_nm()
2298 found = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_add_nm()
2301 found = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_add_nm()
2336 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2353 return ubifs_tnc_remove_nm(c, key, &noname); in ubifs_tnc_add_nm()
2382 dbg_tnck(&znode->zbranch[n].key, "deleting key "); in tnc_delete()
2486 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) in ubifs_tnc_remove() argument
2492 dbg_tnck(key, "key "); in ubifs_tnc_remove()
2493 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove()
2516 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_nm() argument
2523 dbg_tnck(key, "%.*s, key ", nm->len, nm->name); in ubifs_tnc_remove_nm()
2524 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2530 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2533 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2566 static int key_in_range(struct ubifs_info *c, union ubifs_key *key, in key_in_range() argument
2569 if (keys_cmp(c, key, from_key) < 0) in key_in_range()
2571 if (keys_cmp(c, key, to_key) > 0) in key_in_range()
2591 union ubifs_key *key; in ubifs_tnc_remove_range() local
2601 key = from_key; in ubifs_tnc_remove_range()
2610 key = &znode->zbranch[n].key; in ubifs_tnc_remove_range()
2611 if (!key_in_range(c, key, from_key, to_key)) { in ubifs_tnc_remove_range()
2628 key = &znode->zbranch[i].key; in ubifs_tnc_remove_range()
2629 if (!key_in_range(c, key, from_key, to_key)) in ubifs_tnc_remove_range()
2638 dbg_tnck(key, "removing key "); in ubifs_tnc_remove_range()
2715 key_read(c, &xent->key, &key1); in ubifs_tnc_remove_ino()
2749 union ubifs_key *key, in ubifs_tnc_next_ent() argument
2752 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent()
2758 dbg_tnck(key, "%s ", nm->name ? (char *)nm->name : "(lowest)"); in ubifs_tnc_next_ent()
2759 ubifs_assert(is_hash_key(c, key)); in ubifs_tnc_next_ent()
2762 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2769 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
2809 dkey = &zbr->key; in ubifs_tnc_next_ent()
2810 if (key_inum(c, dkey) != key_inum(c, key) || in ubifs_tnc_next_ent()
2972 union ubifs_key *key, int level, in lookup_znode() argument
2978 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in lookup_znode()
3001 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3016 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3029 if (!is_hash_key(c, key)) in lookup_znode()
3055 if (keys_cmp(c, &znode->zbranch[n].key, key) < 0) in lookup_znode()
3077 if (keys_cmp(c, &znode->zbranch[n].key, key) > 0) in lookup_znode()
3100 int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, in is_idx_node_in_tnc() argument
3105 znode = lookup_znode(c, key, level, lnum, offs); in is_idx_node_in_tnc()
3127 static int is_leaf_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, in is_leaf_node_in_tnc() argument
3133 const int unique = !is_hash_key(c, key); in is_leaf_node_in_tnc()
3135 found = ubifs_lookup_level0(c, key, &znode, &n); in is_leaf_node_in_tnc()
3158 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3174 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3197 int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_tnc_has_node() argument
3204 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3216 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3237 int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_dirty_idx_node() argument
3244 znode = lookup_znode(c, key, level, lnum, offs); in ubifs_dirty_idx_node()
3277 union ubifs_key from_key, to_key, *key; in dbg_check_inode_size() local
3296 key = &from_key; in dbg_check_inode_size()
3309 key = &znode->zbranch[n].key; in dbg_check_inode_size()
3310 if (!key_in_range(c, key, &from_key, &to_key)) in dbg_check_inode_size()
3314 block = key_block(c, key); in dbg_check_inode_size()