Lines Matching refs: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()
487 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, in fallible_read_node() argument
492 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
494 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, in fallible_read_node()
501 key_read(c, &dent->key, &node_key); in fallible_read_node()
502 if (keys_cmp(c, key, &node_key) != 0) in fallible_read_node()
506 dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ", in fallible_read_node()
691 static int resolve_collision(struct ubifs_info *c, const union ubifs_key *key, in resolve_collision() argument
714 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in resolve_collision()
778 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision()
822 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
880 const union ubifs_key *key, in fallible_resolve_collision() argument
915 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in fallible_resolve_collision()
960 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in fallible_resolve_collision()
982 dbg_mntk(key, "dangling match LEB %d:%d len %d key ", in fallible_resolve_collision()
1024 const union ubifs_key *key, in resolve_collision_directly() argument
1043 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1061 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1159 int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, in ubifs_lookup_level0() argument
1166 dbg_tnck(key, "search key "); in ubifs_lookup_level0()
1167 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in ubifs_lookup_level0()
1181 exact = ubifs_search_zbranch(c, znode, key, n); in ubifs_lookup_level0()
1203 if (exact || !is_hash_key(c, key) || *n != -1) { in ubifs_lookup_level0()
1259 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in ubifs_lookup_level0()
1295 static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, in lookup_level0_dirty() argument
1302 dbg_tnck(key, "search and dirty key "); in lookup_level0_dirty()
1320 exact = ubifs_search_zbranch(c, znode, key, n); in lookup_level0_dirty()
1347 if (exact || !is_hash_key(c, key) || *n != -1) { in lookup_level0_dirty()
1364 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in lookup_level0_dirty()
1430 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_locate() argument
1439 found = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_locate()
1452 if (is_hash_key(c, key)) { in ubifs_tnc_locate()
1475 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1508 unsigned int block = key_block(c, &bu->key); in ubifs_tnc_get_bu_keys()
1517 err = ubifs_lookup_level0(c, &bu->key, &znode, &n); in ubifs_tnc_get_bu_keys()
1536 union ubifs_key *key; in ubifs_tnc_get_bu_keys() local
1544 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1546 if (key_inum(c, key) != key_inum(c, &bu->key) || in ubifs_tnc_get_bu_keys()
1547 key_type(c, key) != UBIFS_DATA_KEY) { in ubifs_tnc_get_bu_keys()
1574 next_block = key_block(c, key); in ubifs_tnc_get_bu_keys()
1616 block = key_block(c, &bu->key) + bu->blk_cnt; in ubifs_tnc_get_bu_keys()
1619 if (key_block(c, &bu->zbranch[bu->cnt - 1].key) < block) in ubifs_tnc_get_bu_keys()
1706 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1709 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1763 dbg_tnck(&bu->key, "key "); in ubifs_tnc_bulk_read()
1792 static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_nm() argument
1798 dbg_tnck(key, "name '%.*s' key ", nm->len, nm->name); in do_lookup_nm()
1800 found = ubifs_lookup_level0(c, key, &znode, &n); in do_lookup_nm()
1811 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1840 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_nm() argument
1850 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1862 return do_lookup_nm(c, key, node, nm); in ubifs_tnc_lookup_nm()
1877 union ubifs_key *key, *key1; in correct_parent_keys() local
1882 key = &znode->zbranch[0].key; in correct_parent_keys()
1883 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1885 while (keys_cmp(c, key, key1) < 0) { in correct_parent_keys()
1886 key_copy(c, key, key1); in correct_parent_keys()
1891 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1963 union ubifs_key *key = &zbr->key, *key1; in tnc_insert() local
1972 dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level); in tnc_insert()
1987 dbg_tnck(key, "splitting level %d, key ", znode->level); in tnc_insert()
2003 if (znode->level == 0 && key_type(c, key) == UBIFS_DATA_KEY) { in tnc_insert()
2006 key1 = &znode->zbranch[n - 1].key; in tnc_insert()
2007 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2017 key1 = &znode->zbranch[0].key; in tnc_insert()
2018 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2020 key1 = &znode->zbranch[n].key; in tnc_insert()
2021 if (key_inum(c, key1) != key_inum(c, key) || in tnc_insert()
2081 dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level); in tnc_insert()
2094 zbr->key = zn->zbranch[0].key; in tnc_insert()
2117 zi->zbranch[0].key = znode->zbranch[0].key; in tnc_insert()
2122 zi->zbranch[1].key = zn->zbranch[0].key; in tnc_insert()
2150 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, in ubifs_tnc_add() argument
2157 dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len); in ubifs_tnc_add()
2158 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add()
2166 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2199 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_replace() argument
2206 dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum, in ubifs_tnc_replace()
2208 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_replace()
2227 } else if (is_hash_key(c, key)) { in ubifs_tnc_replace()
2228 found = resolve_collision_directly(c, key, &znode, &n, in ubifs_tnc_replace()
2282 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_add_nm() argument
2289 dbg_tnck(key, "LEB %d:%d, name '%.*s', key ", in ubifs_tnc_add_nm()
2291 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add_nm()
2299 found = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_add_nm()
2302 found = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_add_nm()
2337 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2354 return ubifs_tnc_remove_nm(c, key, &noname); in ubifs_tnc_add_nm()
2383 dbg_tnck(&znode->zbranch[n].key, "deleting key "); in tnc_delete()
2487 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) in ubifs_tnc_remove() argument
2493 dbg_tnck(key, "key "); in ubifs_tnc_remove()
2494 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove()
2517 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_nm() argument
2524 dbg_tnck(key, "%.*s, key ", nm->len, nm->name); in ubifs_tnc_remove_nm()
2525 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2531 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2534 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2567 static int key_in_range(struct ubifs_info *c, union ubifs_key *key, in key_in_range() argument
2570 if (keys_cmp(c, key, from_key) < 0) in key_in_range()
2572 if (keys_cmp(c, key, to_key) > 0) in key_in_range()
2592 union ubifs_key *key; in ubifs_tnc_remove_range() local
2602 key = from_key; in ubifs_tnc_remove_range()
2611 key = &znode->zbranch[n].key; in ubifs_tnc_remove_range()
2612 if (!key_in_range(c, key, from_key, to_key)) { in ubifs_tnc_remove_range()
2629 key = &znode->zbranch[i].key; in ubifs_tnc_remove_range()
2630 if (!key_in_range(c, key, from_key, to_key)) in ubifs_tnc_remove_range()
2639 dbg_tnck(key, "removing key "); in ubifs_tnc_remove_range()
2716 key_read(c, &xent->key, &key1); in ubifs_tnc_remove_ino()
2750 union ubifs_key *key, in ubifs_tnc_next_ent() argument
2753 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent()
2759 dbg_tnck(key, "%s ", nm->name ? (char *)nm->name : "(lowest)"); in ubifs_tnc_next_ent()
2760 ubifs_assert(is_hash_key(c, key)); in ubifs_tnc_next_ent()
2763 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2770 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
2810 dkey = &zbr->key; in ubifs_tnc_next_ent()
2811 if (key_inum(c, dkey) != key_inum(c, key) || in ubifs_tnc_next_ent()
2973 union ubifs_key *key, int level, in lookup_znode() argument
2979 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); in lookup_znode()
3002 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3017 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3030 if (!is_hash_key(c, key)) in lookup_znode()
3056 if (keys_cmp(c, &znode->zbranch[n].key, key) < 0) in lookup_znode()
3078 if (keys_cmp(c, &znode->zbranch[n].key, key) > 0) in lookup_znode()
3101 int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, in is_idx_node_in_tnc() argument
3106 znode = lookup_znode(c, key, level, lnum, offs); in is_idx_node_in_tnc()
3128 static int is_leaf_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, in is_leaf_node_in_tnc() argument
3134 const int unique = !is_hash_key(c, key); in is_leaf_node_in_tnc()
3136 found = ubifs_lookup_level0(c, key, &znode, &n); in is_leaf_node_in_tnc()
3159 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3175 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3198 int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_tnc_has_node() argument
3205 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3217 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3238 int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_dirty_idx_node() argument
3245 znode = lookup_znode(c, key, level, lnum, offs); in ubifs_dirty_idx_node()
3278 union ubifs_key from_key, to_key, *key; in dbg_check_inode_size() local
3297 key = &from_key; in dbg_check_inode_size()
3310 key = &znode->zbranch[n].key; in dbg_check_inode_size()
3311 if (!key_in_range(c, key, &from_key, &to_key)) in dbg_check_inode_size()
3315 block = key_block(c, key); in dbg_check_inode_size()