Lines Matching refs:de
16 static int bin_search_in_dir_item (struct reiserfs_dir_entry * de, loff_t off) in bin_search_in_dir_item() argument
18 struct item_head * ih = de->de_ih; in bin_search_in_dir_item()
19 struct reiserfs_de_head * deh = de->de_deh; in bin_search_in_dir_item()
35 de->de_entry_num = j; in bin_search_in_dir_item()
39 de->de_entry_num = lbound; in bin_search_in_dir_item()
45 static inline void set_de_item_location (struct reiserfs_dir_entry * de, struct path * path) in set_de_item_location() argument
47 de->de_bh = get_last_bh (path); in set_de_item_location()
48 de->de_ih = get_ih (path); in set_de_item_location()
49 de->de_deh = B_I_DEH (de->de_bh, de->de_ih); in set_de_item_location()
50 de->de_item_num = PATH_LAST_POSITION (path); in set_de_item_location()
55 inline void set_de_name_and_namelen (struct reiserfs_dir_entry * de) in set_de_name_and_namelen() argument
57 struct reiserfs_de_head * deh = de->de_deh + de->de_entry_num; in set_de_name_and_namelen()
59 if (de->de_entry_num >= ih_entry_count (de->de_ih)) in set_de_name_and_namelen()
62 de->de_entrylen = entry_length (de->de_bh, de->de_ih, de->de_entry_num); in set_de_name_and_namelen()
63 de->de_namelen = de->de_entrylen - (de_with_sd (deh) ? SD_SIZE : 0); in set_de_name_and_namelen()
64 de->de_name = B_I_PITEM (de->de_bh, de->de_ih) + deh_location(deh); in set_de_name_and_namelen()
65 if (de->de_name[de->de_namelen - 1] == 0) in set_de_name_and_namelen()
66 de->de_namelen = strlen (de->de_name); in set_de_name_and_namelen()
71 static inline void set_de_object_key (struct reiserfs_dir_entry * de) in set_de_object_key() argument
73 if (de->de_entry_num >= ih_entry_count (de->de_ih)) in set_de_object_key()
75 de->de_dir_id = deh_dir_id( &(de->de_deh[de->de_entry_num])); in set_de_object_key()
76 de->de_objectid = deh_objectid( &(de->de_deh[de->de_entry_num])); in set_de_object_key()
80 static inline void store_de_entry_key (struct reiserfs_dir_entry * de) in store_de_entry_key() argument
82 struct reiserfs_de_head * deh = de->de_deh + de->de_entry_num; in store_de_entry_key()
84 if (de->de_entry_num >= ih_entry_count (de->de_ih)) in store_de_entry_key()
88 de->de_entry_key.version = KEY_FORMAT_3_5; in store_de_entry_key()
89 de->de_entry_key.on_disk_key.k_dir_id = le32_to_cpu (de->de_ih->ih_key.k_dir_id); in store_de_entry_key()
90 de->de_entry_key.on_disk_key.k_objectid = le32_to_cpu (de->de_ih->ih_key.k_objectid); in store_de_entry_key()
91 set_cpu_key_k_offset (&(de->de_entry_key), deh_offset (deh)); in store_de_entry_key()
92 set_cpu_key_k_type (&(de->de_entry_key), TYPE_DIRENTRY); in store_de_entry_key()
109 struct path * path, struct reiserfs_dir_entry * de) in search_by_entry_key() argument
135 set_de_item_location (de, path); in search_by_entry_key()
138 if (!is_direntry_le_ih (de->de_ih) || in search_by_entry_key()
139 COMP_SHORT_KEYS (&(de->de_ih->ih_key), key)) { in search_by_entry_key()
140 print_block (de->de_bh, 0, -1, -1); in search_by_entry_key()
142 "does not belong to the same directory as key %K", de->de_ih, key); in search_by_entry_key()
148 retval = bin_search_in_dir_item (de, cpu_key_k_offset (key)); in search_by_entry_key()
149 path->pos_in_item = de->de_entry_num; in search_by_entry_key()
152 set_de_name_and_namelen (de); in search_by_entry_key()
153 set_de_object_key (de); in search_by_entry_key()
189 static int reiserfs_match (struct reiserfs_dir_entry * de, in reiserfs_match() argument
194 if ((namelen == de->de_namelen) && in reiserfs_match()
195 !memcmp(de->de_name, name, de->de_namelen)) in reiserfs_match()
196 retval = (de_visible (de->de_deh + de->de_entry_num) ? NAME_FOUND : NAME_FOUND_INVISIBLE); in reiserfs_match()
207 static int linear_search_in_dir_item (struct cpu_key * key, struct reiserfs_dir_entry * de, in linear_search_in_dir_item() argument
210 struct reiserfs_de_head * deh = de->de_deh; in linear_search_in_dir_item()
214 i = de->de_entry_num; in linear_search_in_dir_item()
216 if (i == I_ENTRY_COUNT (de->de_ih) || in linear_search_in_dir_item()
221 RFALSE( de->de_deh != B_I_DEH (de->de_bh, de->de_ih), in linear_search_in_dir_item()
234 if (de->de_gen_number_bit_string) in linear_search_in_dir_item()
235 … set_bit (GET_GENERATION_NUMBER (deh_offset (deh)), (unsigned long *)de->de_gen_number_bit_string); in linear_search_in_dir_item()
238 de->de_entry_num = i; in linear_search_in_dir_item()
239 set_de_name_and_namelen (de); in linear_search_in_dir_item()
241 if ((retval = reiserfs_match (de, name, namelen)) != NAME_NOT_FOUND) { in linear_search_in_dir_item()
245 set_de_object_key (de); in linear_search_in_dir_item()
247 store_de_entry_key (de); in linear_search_in_dir_item()
254 if (GET_GENERATION_NUMBER (le_ih_k_offset (de->de_ih)) == 0) in linear_search_in_dir_item()
264 RFALSE( de->de_item_num, in linear_search_in_dir_item()
274 struct path * path_to_entry, struct reiserfs_dir_entry * de) in reiserfs_find_entry() argument
288 retval = search_by_entry_key (dir->i_sb, &key_to_search, path_to_entry, de); in reiserfs_find_entry()
295 retval = linear_search_in_dir_item (&key_to_search, de, name, namelen); in reiserfs_find_entry()
298 path_to_entry->pos_in_item = de->de_entry_num; in reiserfs_find_entry()
303 set_cpu_key_k_offset (&key_to_search, le_ih_k_offset (de->de_ih) - 1); in reiserfs_find_entry()
314 struct reiserfs_dir_entry de; in reiserfs_lookup() local
322 de.de_gen_number_bit_string = 0; in reiserfs_lookup()
323 … retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path_to_entry, &de); in reiserfs_lookup()
326 inode = reiserfs_iget (dir->i_sb, (struct cpu_key *)&(de.de_dir_id)); in reiserfs_lookup()
352 struct reiserfs_dir_entry de; in reiserfs_add_entry() local
404 de.de_gen_number_bit_string = (char *)bit_string; in reiserfs_add_entry()
405 retval = reiserfs_find_entry (dir, name, namelen, &path, &de); in reiserfs_add_entry()
455 if (search_by_entry_key (dir->i_sb, &entry_key, &path, &de) != NAME_NOT_FOUND) { in reiserfs_add_entry()
703 struct reiserfs_dir_entry de; in reiserfs_rmdir() local
712 de.de_gen_number_bit_string = 0; in reiserfs_rmdir()
713 …if ( (retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path, &de)) == … in reiserfs_rmdir()
726 if (de.de_objectid != inode->i_ino) { in reiserfs_rmdir()
738 retval = reiserfs_cut_from_item (&th, &path, &(de.de_entry_key), dir, in reiserfs_rmdir()
752 dir->i_size -= (DEH_SIZE + de.de_entrylen); in reiserfs_rmdir()
779 struct reiserfs_dir_entry de; in reiserfs_unlink() local
795 de.de_gen_number_bit_string = 0; in reiserfs_unlink()
796 …if ( (retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path, &de)) == … in reiserfs_unlink()
807 if (de.de_objectid != inode->i_ino) { in reiserfs_unlink()
829 retval = reiserfs_cut_from_item (&th, &path, &(de.de_entry_key), dir, NULL, 0); in reiserfs_unlink()
837 dir->i_size -= (de.de_entrylen + DEH_SIZE); in reiserfs_unlink()
987 static int de_still_valid (const char * name, int len, struct reiserfs_dir_entry * de) in de_still_valid() argument
989 struct reiserfs_dir_entry tmp = *de; in de_still_valid()
994 if (tmp.de_namelen != len || memcmp (name, de->de_name, len)) in de_still_valid()
1000 static int entry_points_to_object (const char * name, int len, struct reiserfs_dir_entry * de, stru… in entry_points_to_object() argument
1002 if (!de_still_valid (name, len, de)) in entry_points_to_object()
1006 if (!de_visible (de->de_deh + de->de_entry_num)) in entry_points_to_object()
1008 return (de->de_objectid == inode->i_ino) ? 1 : 0; in entry_points_to_object()
1012 if (de_visible (de->de_deh + de->de_entry_num)) in entry_points_to_object()
1020 static void set_ino_in_dir_entry (struct reiserfs_dir_entry * de, struct key * key) in set_ino_in_dir_entry() argument
1023 de->de_deh[de->de_entry_num].deh_dir_id = key->k_dir_id; in set_ino_in_dir_entry()
1024 de->de_deh[de->de_entry_num].deh_objectid = key->k_objectid; in set_ino_in_dir_entry()