Lines Matching refs:key

316 	ubifs_assert(is_hash_key(c, &zbr->key));  in lnc_add()
391 ubifs_assert(is_hash_key(c, &zbr->key)); in tnc_read_node_nm()
481 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, in fallible_read_node() argument
486 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
488 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, in fallible_read_node()
495 key_read(c, &dent->key, &node_key); in fallible_read_node()
496 if (keys_cmp(c, key, &node_key) != 0) in fallible_read_node()
500 dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ", in fallible_read_node()
685 static int resolve_collision(struct ubifs_info *c, const union ubifs_key *key, in resolve_collision() argument
708 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in resolve_collision()
772 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision()
816 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
874 const union ubifs_key *key, in fallible_resolve_collision() argument
909 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in fallible_resolve_collision()
954 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in fallible_resolve_collision()
976 dbg_mntk(key, "dangling match LEB %d:%d len %d key ", in fallible_resolve_collision()
1018 const union ubifs_key *key, in resolve_collision_directly() argument
1037 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1055 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1153 int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, in ubifs_lookup_level0() argument
1160 dbg_tnck(key, "search key "); in ubifs_lookup_level0()
1161 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in ubifs_lookup_level0()
1175 exact = ubifs_search_zbranch(c, znode, key, n); in ubifs_lookup_level0()
1197 if (exact || !is_hash_key(c, key) || *n != -1) { in ubifs_lookup_level0()
1253 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in ubifs_lookup_level0()
1289 static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, in lookup_level0_dirty() argument
1296 dbg_tnck(key, "search and dirty key "); in lookup_level0_dirty()
1314 exact = ubifs_search_zbranch(c, znode, key, n); in lookup_level0_dirty()
1341 if (exact || !is_hash_key(c, key) || *n != -1) { in lookup_level0_dirty()
1358 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in lookup_level0_dirty()
1428 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_locate() argument
1437 found = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_locate()
1450 if (is_hash_key(c, key)) { in ubifs_tnc_locate()
1473 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1506 unsigned int block = key_block(c, &bu->key); in ubifs_tnc_get_bu_keys()
1515 err = ubifs_lookup_level0(c, &bu->key, &znode, &n); in ubifs_tnc_get_bu_keys()
1534 union ubifs_key *key; in ubifs_tnc_get_bu_keys() local
1542 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1544 if (key_inum(c, key) != key_inum(c, &bu->key) || in ubifs_tnc_get_bu_keys()
1545 key_type(c, key) != UBIFS_DATA_KEY) { in ubifs_tnc_get_bu_keys()
1572 next_block = key_block(c, key); in ubifs_tnc_get_bu_keys()
1614 block = key_block(c, &bu->key) + bu->blk_cnt; in ubifs_tnc_get_bu_keys()
1617 if (key_block(c, &bu->zbranch[bu->cnt - 1].key) < block) in ubifs_tnc_get_bu_keys()
1704 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1707 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1761 dbg_tnck(&bu->key, "key "); in ubifs_tnc_bulk_read()
1790 static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_nm() argument
1796 dbg_tnck(key, "name '%.*s' key ", nm->len, nm->name); in do_lookup_nm()
1798 found = ubifs_lookup_level0(c, key, &znode, &n); in do_lookup_nm()
1809 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1838 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_nm() argument
1848 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1860 return do_lookup_nm(c, key, node, nm); in ubifs_tnc_lookup_nm()
1875 union ubifs_key *key, *key1; in correct_parent_keys() local
1880 key = &znode->zbranch[0].key; in correct_parent_keys()
1881 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1883 while (keys_cmp(c, key, key1) < 0) { in correct_parent_keys()
1884 key_copy(c, key, key1); in correct_parent_keys()
1889 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1961 union ubifs_key *key = &zbr->key, *key1; in tnc_insert() local
1970 dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level); in tnc_insert()
1985 dbg_tnck(key, "splitting level %d, key ", znode->level); in tnc_insert()
2001 if (znode->level == 0 && key_type(c, key) == UBIFS_DATA_KEY) { in tnc_insert()
2004 key1 = &znode->zbranch[n - 1].key; in tnc_insert()
2005 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2015 key1 = &znode->zbranch[0].key; in tnc_insert()
2016 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2018 key1 = &znode->zbranch[n].key; in tnc_insert()
2019 if (key_inum(c, key1) != key_inum(c, key) || in tnc_insert()
2079 dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level); in tnc_insert()
2092 zbr->key = zn->zbranch[0].key; in tnc_insert()
2115 zi->zbranch[0].key = znode->zbranch[0].key; in tnc_insert()
2120 zi->zbranch[1].key = zn->zbranch[0].key; in tnc_insert()
2148 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, in ubifs_tnc_add() argument
2155 dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len); in ubifs_tnc_add()
2156 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add()
2164 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2197 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_replace() argument
2204 dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum, in ubifs_tnc_replace()
2206 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_replace()
2225 } else if (is_hash_key(c, key)) { in ubifs_tnc_replace()
2226 found = resolve_collision_directly(c, key, &znode, &n, in ubifs_tnc_replace()
2280 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_add_nm() argument
2287 dbg_tnck(key, "LEB %d:%d, name '%.*s', key ", in ubifs_tnc_add_nm()
2289 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add_nm()
2297 found = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_add_nm()
2300 found = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_add_nm()
2335 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2352 return ubifs_tnc_remove_nm(c, key, &noname); in ubifs_tnc_add_nm()
2381 dbg_tnck(&znode->zbranch[n].key, "deleting key "); in tnc_delete()
2485 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) in ubifs_tnc_remove() argument
2491 dbg_tnck(key, "key "); in ubifs_tnc_remove()
2492 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove()
2515 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_nm() argument
2522 dbg_tnck(key, "%.*s, key ", nm->len, nm->name); in ubifs_tnc_remove_nm()
2523 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2529 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2532 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2565 static int key_in_range(struct ubifs_info *c, union ubifs_key *key, in key_in_range() argument
2568 if (keys_cmp(c, key, from_key) < 0) in key_in_range()
2570 if (keys_cmp(c, key, to_key) > 0) in key_in_range()
2590 union ubifs_key *key; in ubifs_tnc_remove_range() local
2600 key = from_key; in ubifs_tnc_remove_range()
2609 key = &znode->zbranch[n].key; in ubifs_tnc_remove_range()
2610 if (!key_in_range(c, key, from_key, to_key)) { in ubifs_tnc_remove_range()
2627 key = &znode->zbranch[i].key; in ubifs_tnc_remove_range()
2628 if (!key_in_range(c, key, from_key, to_key)) in ubifs_tnc_remove_range()
2637 dbg_tnck(key, "removing key "); in ubifs_tnc_remove_range()
2714 key_read(c, &xent->key, &key1); in ubifs_tnc_remove_ino()
2748 union ubifs_key *key, in ubifs_tnc_next_ent() argument
2751 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent()
2757 dbg_tnck(key, "%s ", nm->name ? (char *)nm->name : "(lowest)"); in ubifs_tnc_next_ent()
2758 ubifs_assert(is_hash_key(c, key)); in ubifs_tnc_next_ent()
2761 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2768 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
2808 dkey = &zbr->key; in ubifs_tnc_next_ent()
2809 if (key_inum(c, dkey) != key_inum(c, key) || in ubifs_tnc_next_ent()
2971 union ubifs_key *key, int level, in lookup_znode() argument
2977 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in lookup_znode()
3000 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3015 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3028 if (!is_hash_key(c, key)) in lookup_znode()
3054 if (keys_cmp(c, &znode->zbranch[n].key, key) < 0) in lookup_znode()
3076 if (keys_cmp(c, &znode->zbranch[n].key, key) > 0) in lookup_znode()
3099 int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, in is_idx_node_in_tnc() argument
3104 znode = lookup_znode(c, key, level, lnum, offs); in is_idx_node_in_tnc()
3126 static int is_leaf_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, in is_leaf_node_in_tnc() argument
3132 const int unique = !is_hash_key(c, key); in is_leaf_node_in_tnc()
3134 found = ubifs_lookup_level0(c, key, &znode, &n); in is_leaf_node_in_tnc()
3157 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3173 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3196 int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_tnc_has_node() argument
3203 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3215 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3236 int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_dirty_idx_node() argument
3243 znode = lookup_znode(c, key, level, lnum, offs); in ubifs_dirty_idx_node()
3276 union ubifs_key from_key, to_key, *key; in dbg_check_inode_size() local
3295 key = &from_key; in dbg_check_inode_size()
3308 key = &znode->zbranch[n].key; in dbg_check_inode_size()
3309 if (!key_in_range(c, key, &from_key, &to_key)) in dbg_check_inode_size()
3313 block = key_block(c, key); in dbg_check_inode_size()