• Home
  • Raw
  • Download

Lines Matching refs:key

27 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
314 ubifs_assert(c, is_hash_key(c, &zbr->key)); in lnc_add()
389 ubifs_assert(c, is_hash_key(c, &zbr->key)); in tnc_read_hashed_node()
399 err = fallible_read_node(c, &zbr->key, zbr, node); in tnc_read_hashed_node()
497 static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, in fallible_read_node() argument
502 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); in fallible_read_node()
504 ret = try_read_node(c, node, key_type(c, key), zbr); in fallible_read_node()
510 key_read(c, &dent->key, &node_key); in fallible_read_node()
511 if (keys_cmp(c, key, &node_key) != 0) in fallible_read_node()
515 dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ", in fallible_read_node()
700 static int resolve_collision(struct ubifs_info *c, const union ubifs_key *key, in resolve_collision() argument
723 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in resolve_collision()
787 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision()
831 err = fallible_read_node(c, &zbr->key, zbr, dent); in fallible_matches_name()
889 const union ubifs_key *key, in fallible_resolve_collision() argument
925 if (keys_cmp(c, &(*zn)->zbranch[*n].key, key)) { in fallible_resolve_collision()
970 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in fallible_resolve_collision()
992 dbg_mntk(key, "dangling match LEB %d:%d len %d key ", in fallible_resolve_collision()
1034 const union ubifs_key *key, in resolve_collision_directly() argument
1053 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1071 if (keys_cmp(c, &znode->zbranch[nn].key, key)) in resolve_collision_directly()
1170 int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, in ubifs_lookup_level0() argument
1177 dbg_tnck(key, "search key "); in ubifs_lookup_level0()
1178 ubifs_assert(c, key_type(c, key) < UBIFS_INVALID_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_tnck(key, "search and dirty 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()
1723 if (!keys_eq(c, &zbr->key, &key1)) { in validate_data_node()
1726 dbg_tnck(&zbr->key, "looked for key "); in validate_data_node()
1780 dbg_tnck(&bu->key, "key "); in ubifs_tnc_bulk_read()
1809 static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_nm() argument
1815 dbg_tnck(key, "key "); in do_lookup_nm()
1817 found = ubifs_lookup_level0(c, key, &znode, &n); in do_lookup_nm()
1828 err = resolve_collision(c, key, &znode, &n, nm); in do_lookup_nm()
1857 int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_nm() argument
1867 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_nm()
1880 return do_lookup_nm(c, key, node, nm); in ubifs_tnc_lookup_nm()
1883 static int search_dh_cookie(struct ubifs_info *c, const union ubifs_key *key, in search_dh_cookie() argument
1900 dkey = &zbr->key; in search_dh_cookie()
1902 if (key_inum(c, dkey) != key_inum(c, key) || in search_dh_cookie()
1903 key_type(c, dkey) != key_type(c, key)) { in search_dh_cookie()
1911 if (key_hash(c, key) == key_hash(c, dkey) && in search_dh_cookie()
1923 static int do_lookup_dh(struct ubifs_info *c, const union ubifs_key *key, in do_lookup_dh() argument
1930 ubifs_assert(c, is_hash_key(c, key)); in do_lookup_dh()
1932 lowest_dent_key(c, &start_key, key_inum(c, key)); in do_lookup_dh()
1939 err = search_dh_cookie(c, key, dent, cookie, &znode, &n, err); in do_lookup_dh()
1960 int ubifs_tnc_lookup_dh(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_lookup_dh() argument
1973 err = ubifs_tnc_lookup(c, key, node); in ubifs_tnc_lookup_dh()
1984 return do_lookup_dh(c, key, node, cookie); in ubifs_tnc_lookup_dh()
1999 union ubifs_key *key, *key1; in correct_parent_keys() local
2004 key = &znode->zbranch[0].key; in correct_parent_keys()
2005 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
2007 while (keys_cmp(c, key, key1) < 0) { in correct_parent_keys()
2008 key_copy(c, key, key1); in correct_parent_keys()
2013 key1 = &znode->parent->zbranch[0].key; in correct_parent_keys()
2086 union ubifs_key *key = &zbr->key, *key1; in tnc_insert() local
2095 dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level); in tnc_insert()
2110 dbg_tnck(key, "splitting level %d, key ", znode->level); in tnc_insert()
2126 if (znode->level == 0 && key_type(c, key) == UBIFS_DATA_KEY) { in tnc_insert()
2129 key1 = &znode->zbranch[n - 1].key; in tnc_insert()
2130 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2140 key1 = &znode->zbranch[0].key; in tnc_insert()
2141 if (key_inum(c, key1) == key_inum(c, key) && in tnc_insert()
2143 key1 = &znode->zbranch[n].key; in tnc_insert()
2144 if (key_inum(c, key1) != key_inum(c, key) || in tnc_insert()
2204 dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level); in tnc_insert()
2217 zbr->key = zn->zbranch[0].key; in tnc_insert()
2240 zi->zbranch[0].key = znode->zbranch[0].key; in tnc_insert()
2245 zi->zbranch[1].key = zn->zbranch[0].key; in tnc_insert()
2274 int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, in ubifs_tnc_add() argument
2281 dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len); in ubifs_tnc_add()
2282 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add()
2291 key_copy(c, key, &zbr.key); in ubifs_tnc_add()
2325 int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_replace() argument
2332 dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum, in ubifs_tnc_replace()
2334 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_replace()
2353 } else if (is_hash_key(c, key)) { in ubifs_tnc_replace()
2354 found = resolve_collision_directly(c, key, &znode, &n, in ubifs_tnc_replace()
2409 int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_add_nm() argument
2417 dbg_tnck(key, "LEB %d:%d, key ", lnum, offs); in ubifs_tnc_add_nm()
2418 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_add_nm()
2426 found = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_add_nm()
2429 found = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_add_nm()
2466 key_copy(c, key, &zbr.key); in ubifs_tnc_add_nm()
2483 return ubifs_tnc_remove_nm(c, key, &noname); in ubifs_tnc_add_nm()
2512 dbg_tnck(&znode->zbranch[n].key, "deleting key "); in tnc_delete()
2616 int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) in ubifs_tnc_remove() argument
2622 dbg_tnck(key, "key "); in ubifs_tnc_remove()
2623 found = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove()
2646 int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_nm() argument
2653 dbg_tnck(key, "key "); in ubifs_tnc_remove_nm()
2654 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_nm()
2660 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_remove_nm()
2663 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_remove_nm()
2695 int ubifs_tnc_remove_dh(struct ubifs_info *c, const union ubifs_key *key, in ubifs_tnc_remove_dh() argument
2707 err = lookup_level0_dirty(c, key, &znode, &n); in ubifs_tnc_remove_dh()
2726 lowest_dent_key(c, &start_key, key_inum(c, key)); in ubifs_tnc_remove_dh()
2732 err = search_dh_cookie(c, key, dent, cookie, &znode, &n, err); in ubifs_tnc_remove_dh()
2764 static int key_in_range(struct ubifs_info *c, union ubifs_key *key, in key_in_range() argument
2767 if (keys_cmp(c, key, from_key) < 0) in key_in_range()
2769 if (keys_cmp(c, key, to_key) > 0) in key_in_range()
2789 union ubifs_key *key; in ubifs_tnc_remove_range() local
2799 key = from_key; in ubifs_tnc_remove_range()
2808 key = &znode->zbranch[n].key; in ubifs_tnc_remove_range()
2809 if (!key_in_range(c, key, from_key, to_key)) { in ubifs_tnc_remove_range()
2826 key = &znode->zbranch[i].key; in ubifs_tnc_remove_range()
2827 if (!key_in_range(c, key, from_key, to_key)) in ubifs_tnc_remove_range()
2836 dbg_tnck(key, "removing key "); in ubifs_tnc_remove_range()
2915 key_read(c, &xent->key, &key1); in ubifs_tnc_remove_ino()
2949 union ubifs_key *key, in ubifs_tnc_next_ent() argument
2952 int n, err, type = key_type(c, key); in ubifs_tnc_next_ent()
2958 dbg_tnck(key, "key "); in ubifs_tnc_next_ent()
2959 ubifs_assert(c, is_hash_key(c, key)); in ubifs_tnc_next_ent()
2962 err = ubifs_lookup_level0(c, key, &znode, &n); in ubifs_tnc_next_ent()
2970 err = fallible_resolve_collision(c, key, &znode, &n, in ubifs_tnc_next_ent()
2973 err = resolve_collision(c, key, &znode, &n, nm); in ubifs_tnc_next_ent()
3013 dkey = &zbr->key; in ubifs_tnc_next_ent()
3014 if (key_inum(c, dkey) != key_inum(c, key) || in ubifs_tnc_next_ent()
3176 union ubifs_key *key, int level, in lookup_znode() argument
3182 ubifs_assert(c, key_type(c, key) < UBIFS_INVALID_KEY); in lookup_znode()
3205 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3220 ubifs_search_zbranch(c, znode, key, &n); in lookup_znode()
3233 if (!is_hash_key(c, key)) in lookup_znode()
3259 if (keys_cmp(c, &znode->zbranch[n].key, key) < 0) in lookup_znode()
3281 if (keys_cmp(c, &znode->zbranch[n].key, key) > 0) in lookup_znode()
3304 int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, in is_idx_node_in_tnc() argument
3309 znode = lookup_znode(c, key, level, lnum, offs); in is_idx_node_in_tnc()
3331 static int is_leaf_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, in is_leaf_node_in_tnc() argument
3337 const int unique = !is_hash_key(c, key); in is_leaf_node_in_tnc()
3339 found = ubifs_lookup_level0(c, key, &znode, &n); in is_leaf_node_in_tnc()
3362 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3378 if (keys_cmp(c, key, &znode->zbranch[n].key)) in is_leaf_node_in_tnc()
3401 int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_tnc_has_node() argument
3408 err = is_idx_node_in_tnc(c, key, level, lnum, offs); in ubifs_tnc_has_node()
3420 err = is_leaf_node_in_tnc(c, key, lnum, offs); in ubifs_tnc_has_node()
3441 int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, in ubifs_dirty_idx_node() argument
3448 znode = lookup_znode(c, key, level, lnum, offs); in ubifs_dirty_idx_node()
3481 union ubifs_key from_key, to_key, *key; in dbg_check_inode_size() local
3500 key = &from_key; in dbg_check_inode_size()
3513 key = &znode->zbranch[n].key; in dbg_check_inode_size()
3514 if (!key_in_range(c, key, &from_key, &to_key)) in dbg_check_inode_size()
3518 block = key_block(c, key); in dbg_check_inode_size()