Lines Matching refs:key
337 ubifs_assert(is_hash_key(c, &zbr->key)); in lnc_add()
413 ubifs_assert(is_hash_key(c, &zbr->key)); 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_tnc("LEB %d:%d, key %s", zbr->lnum, zbr->offs, DBGKEY(key)); 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()
519 zbr->lnum, zbr->offs, zbr->len, DBGKEY(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()
996 o_znode->zbranch[o_n].len, DBGKEY(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_tnc("search key %s", DBGKEY(key)); in ubifs_lookup_level0()
1192 exact = ubifs_search_zbranch(c, znode, key, n); in ubifs_lookup_level0()
1214 if (exact || !is_hash_key(c, key) || *n != -1) { in ubifs_lookup_level0()
1270 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in ubifs_lookup_level0()
1306 static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, in lookup_level0_dirty() argument
1313 dbg_tnc("search and dirty key %s", DBGKEY(key)); in lookup_level0_dirty()
1331 exact = ubifs_search_zbranch(c, znode, key, n); in lookup_level0_dirty()
1358 if (exact || !is_hash_key(c, key) || *n != -1) { in lookup_level0_dirty()
1375 if (keys_cmp(c, key, &znode->zbranch[*n].key)) { in lookup_level0_dirty()
1441 int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_locate() argument
1450 found = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_locate()
1463 if (is_hash_key(c, key)) { in ubifs_tnc_locate()
1486 err = fallible_read_node(c, key, &zbr, node); in ubifs_tnc_locate()
1519 unsigned int block = key_block(c, &bu->key); in ubifs_tnc_get_bu_keys()
1528 err = ubifs_lookup_level0(c, &bu->key, &znode, &n); in ubifs_tnc_get_bu_keys()
1547 union ubifs_key *key; in ubifs_tnc_get_bu_keys() local
1555 key = &zbr->key; in ubifs_tnc_get_bu_keys()
1557 if (key_inum(c, key) != key_inum(c, &bu->key) || in ubifs_tnc_get_bu_keys()
1558 key_type(c, key) != UBIFS_DATA_KEY) { in ubifs_tnc_get_bu_keys()
1585 next_block = key_block(c, key); in ubifs_tnc_get_bu_keys()
1627 block = key_block(c, &bu->key) + bu->blk_cnt; in ubifs_tnc_get_bu_keys()
1630 if (key_block(c, &bu->zbranch[bu->cnt - 1].key) < block) in ubifs_tnc_get_bu_keys()
1717 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1721 DBGKEY(&zbr->key), DBGKEY1(&key1)); in validate_data_node()
1774 dbg_tnc("key %s", DBGKEY(&bu->key)); in ubifs_tnc_bulk_read()
1803 static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_nm() argument
1809 dbg_tnc("name '%.*s' key %s", nm->len, nm->name, DBGKEY(key)); in do_lookup_nm()
1811 found = ubifs_lookup_level0(c, key, &znode, &n); in do_lookup_nm()
1822 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1851 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_nm() argument
1861 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1873 return do_lookup_nm(c, key, node, nm); in ubifs_tnc_lookup_nm()
1888 union ubifs_key *key, *key1; in correct_parent_keys() local
1893 key = &znode->zbranch[0].key; in correct_parent_keys()
1894 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1896 while (keys_cmp(c, key, key1) < 0) { in correct_parent_keys()
1897 key_copy(c, key, key1); in correct_parent_keys()
1902 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
1974 union ubifs_key *key = &zbr->key, *key1; in tnc_insert() local
1984 DBGKEY(key)); in tnc_insert()
1999 dbg_tnc("splitting level %d, key %s", znode->level, DBGKEY(key)); in tnc_insert()
2015 if (znode->level == 0 && key_type(c, key) == UBIFS_DATA_KEY) { in tnc_insert()
2018 key1 = &znode->zbranch[n - 1].key; in tnc_insert()
2019 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2029 key1 = &znode->zbranch[0].key; in tnc_insert()
2030 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2032 key1 = &znode->zbranch[n].key; in tnc_insert()
2033 if (key_inum(c, key1) != key_inum(c, key) || in tnc_insert()
2093 dbg_tnc("inserting at %d level %d, key %s", n, zn->level, DBGKEY(key)); in tnc_insert()
2106 zbr->key = zn->zbranch[0].key; in tnc_insert()
2129 zi->zbranch[0].key = znode->zbranch[0].key; in tnc_insert()
2134 zi->zbranch[1].key = zn->zbranch[0].key; in tnc_insert()
2162 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, in ubifs_tnc_add() argument
2169 dbg_tnc("%d:%d, len %d, key %s", lnum, offs, len, DBGKEY(key)); in ubifs_tnc_add()
2170 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add()
2178 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2211 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_replace() argument
2219 old_offs, lnum, offs, len, DBGKEY(key)); in ubifs_tnc_replace()
2220 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_replace()
2239 } else if (is_hash_key(c, key)) { in ubifs_tnc_replace()
2240 found = resolve_collision_directly(c, key, &znode, &n, in ubifs_tnc_replace()
2294 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_add_nm() argument
2302 DBGKEY(key)); in ubifs_tnc_add_nm()
2303 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add_nm()
2311 found = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_add_nm()
2314 found = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_add_nm()
2349 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2366 return ubifs_tnc_remove_nm(c, key, &noname); in ubifs_tnc_add_nm()
2395 dbg_tnc("deleting %s", DBGKEY(&znode->zbranch[n].key)); in tnc_delete()
2500 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) in ubifs_tnc_remove() argument
2506 dbg_tnc("key %s", DBGKEY(key)); in ubifs_tnc_remove()
2507 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove()
2530 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_nm() argument
2537 dbg_tnc("%.*s, key %s", nm->len, nm->name, DBGKEY(key)); in ubifs_tnc_remove_nm()
2538 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2544 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2547 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2580 static int key_in_range(struct ubifs_info *c, union ubifs_key *key, in key_in_range() argument
2583 if (keys_cmp(c, key, from_key) < 0) in key_in_range()
2585 if (keys_cmp(c, key, to_key) > 0) in key_in_range()
2605 union ubifs_key *key; in ubifs_tnc_remove_range() local
2615 key = from_key; in ubifs_tnc_remove_range()
2624 key = &znode->zbranch[n].key; in ubifs_tnc_remove_range()
2625 if (!key_in_range(c, key, from_key, to_key)) { in ubifs_tnc_remove_range()
2642 key = &znode->zbranch[i].key; in ubifs_tnc_remove_range()
2643 if (!key_in_range(c, key, from_key, to_key)) in ubifs_tnc_remove_range()
2652 dbg_tnc("removing %s", DBGKEY(key)); in ubifs_tnc_remove_range()
2729 key_read(c, &xent->key, &key1); in ubifs_tnc_remove_ino()
2763 union ubifs_key *key, in ubifs_tnc_next_ent() argument
2766 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent()
2772 dbg_tnc("%s %s", nm->name ? (char *)nm->name : "(lowest)", DBGKEY(key)); in ubifs_tnc_next_ent()
2773 ubifs_assert(is_hash_key(c, key)); in ubifs_tnc_next_ent()
2776 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2783 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
2823 dkey = &zbr->key; in ubifs_tnc_next_ent()
2824 if (key_inum(c, dkey) != key_inum(c, key) || in ubifs_tnc_next_ent()
2984 union ubifs_key *key, int level, in lookup_znode() argument
3011 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3026 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3039 if (!is_hash_key(c, key)) in lookup_znode()
3065 if (keys_cmp(c, &znode->zbranch[n].key, key) < 0) in lookup_znode()
3087 if (keys_cmp(c, &znode->zbranch[n].key, key) > 0) in lookup_znode()
3110 int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, in is_idx_node_in_tnc() argument
3115 znode = lookup_znode(c, key, level, lnum, offs); in is_idx_node_in_tnc()
3137 static int is_leaf_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, in is_leaf_node_in_tnc() argument
3143 const int unique = !is_hash_key(c, key); in is_leaf_node_in_tnc()
3145 found = ubifs_lookup_level0(c, key, &znode, &n); in is_leaf_node_in_tnc()
3168 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3184 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3207 int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_tnc_has_node() argument
3214 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3226 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3247 int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_dirty_idx_node() argument
3254 znode = lookup_znode(c, key, level, lnum, offs); in ubifs_dirty_idx_node()