cleanup: rename common structure names
In order to convert reiserfscore into a externally-usable library, we need to rename structures so they won't collide with other namespaces. Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
1 parent
a465518a51
commit
b23d40f723
25 files changed
+339
-339
No files matched your search
@@ -507,7 +507,7 @@ void do_one_corruption_in_one_block (reiserfs_filsys_t * fs,
|
||||
|
||||
case 'O': /* make item out of order */
|
||||
{
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
if (sscanf (corruption_command, "%c %d\n", &code, &item_num) != 2) {
|
||||
printf ("Wrong format \'%c\'\n", corruption_command [0]);
|
||||
return;
|
||||
|
||||
@@ -563,7 +563,7 @@ static void do_dump_tree (reiserfs_filsys_t * fs)
|
||||
}
|
||||
|
||||
static void callback_badblock_print(reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
struct reiserfs_path *badblock_path,
|
||||
void *data)
|
||||
{
|
||||
struct item_head *tmp_ih;
|
||||
|
||||
@@ -22,7 +22,7 @@ void do_recover (reiserfs_filsys_t fs)
|
||||
char * line = 0;
|
||||
int n = 0;
|
||||
int fd;
|
||||
struct key key = {0, 0, };
|
||||
struct reiserfs_key key = {0, 0, };
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
unsigned long block;
|
||||
|
||||
+15
-15
@@ -254,7 +254,7 @@ static void scan_for_name (struct buffer_head * bh)
|
||||
return;
|
||||
}
|
||||
|
||||
static struct saved_name *scan_for_key(struct key *key) {
|
||||
static struct saved_name *scan_for_key(struct reiserfs_key *key) {
|
||||
char *name;
|
||||
struct saved_name * new, *name_in;
|
||||
|
||||
@@ -296,7 +296,7 @@ static struct saved_name *scan_for_key(struct key *key) {
|
||||
return new;
|
||||
}
|
||||
|
||||
static int comp_token_key(struct buffer_head *bh, struct item_head *ih, struct key *key) {
|
||||
static int comp_token_key(struct buffer_head *bh, struct item_head *ih, struct reiserfs_key *key) {
|
||||
struct reiserfs_de_head * deh;
|
||||
int j, ih_entry_count = 0;
|
||||
int min_entry_size = 1;
|
||||
@@ -332,7 +332,7 @@ static int comp_token_key(struct buffer_head *bh, struct item_head *ih, struct k
|
||||
|
||||
/* take every item, look for its key in the key index, if it is found - store
|
||||
item in the sorted list of items of a file */
|
||||
static void scan_items (struct buffer_head * bh, struct key *key) {
|
||||
static void scan_items (struct buffer_head * bh, struct reiserfs_key *key) {
|
||||
int i, i_num, pos;
|
||||
struct item_head * ih;
|
||||
struct saved_name * name_in_store;
|
||||
@@ -563,9 +563,9 @@ static void map_one_item (struct saved_item * item)
|
||||
|
||||
// flush map which is in variable map
|
||||
static void flush_map (reiserfs_filsys_t * fs,
|
||||
struct key * dir,
|
||||
struct reiserfs_key *dir,
|
||||
char * name,
|
||||
struct key * key)
|
||||
struct reiserfs_key *key)
|
||||
{
|
||||
int i;
|
||||
FILE * fp;
|
||||
@@ -684,8 +684,8 @@ static void make_file_map (const void *nodep, VISIT value, int level)
|
||||
twalk (name->items, map_item_list);
|
||||
|
||||
// write map to a file
|
||||
flush_map (fs, (struct key *)&name->parent_dirid, name->name,
|
||||
(struct key *)&name->dirid);
|
||||
flush_map (fs, (struct reiserfs_key *)&name->parent_dirid, name->name,
|
||||
(struct reiserfs_key *)&name->dirid);
|
||||
|
||||
} else if (name->first_name)
|
||||
reiserfs_warning (stdout, "[%K]:\"%s\" has item list\n",
|
||||
@@ -812,10 +812,10 @@ static void make_map(const void *nodep, VISIT value, int level) {
|
||||
}
|
||||
|
||||
/* store map if it is a regular file */
|
||||
static void locate_file (reiserfs_filsys_t * fs, struct key * key)
|
||||
static void locate_file (reiserfs_filsys_t * fs, struct reiserfs_key *key)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
struct key * next_key;
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
struct reiserfs_key *next_key;
|
||||
int retval;
|
||||
|
||||
do {
|
||||
@@ -850,10 +850,10 @@ static void locate_file (reiserfs_filsys_t * fs, struct key * key)
|
||||
/* read stdin and look for specified name in the specified directory */
|
||||
static void look_for_name (reiserfs_filsys_t * fs)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
char * name, * objectid, * dirid;
|
||||
size_t n;
|
||||
struct key key = {0, };
|
||||
struct reiserfs_key key = {0, };
|
||||
|
||||
reiserfs_warning (stderr,
|
||||
"Enter dirid objectid \"name\" or press ^D to quit\n");
|
||||
@@ -880,7 +880,7 @@ static void look_for_name (reiserfs_filsys_t * fs)
|
||||
name, &key);
|
||||
|
||||
if (reiserfs_locate_entry (fs, &key, name, &path)) {
|
||||
struct key fkey = {0, };
|
||||
struct reiserfs_key fkey = {0, };
|
||||
struct reiserfs_de_head * deh;
|
||||
|
||||
reiserfs_warning (stdout, "name is found in block %lu (item %d, entry %d)\n",
|
||||
@@ -910,7 +910,7 @@ static void look_for_name (reiserfs_filsys_t * fs)
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void scan_for_key (struct buffer_head * bh, struct key * key)
|
||||
static void scan_for_key (struct buffer_head * bh, struct reiserfs_key *key)
|
||||
{
|
||||
int i, j, i_num;
|
||||
struct item_head * ih;
|
||||
@@ -961,7 +961,7 @@ void do_scan (reiserfs_filsys_t * fs)
|
||||
int type;
|
||||
char * answer = 0;
|
||||
size_t n = 0;
|
||||
struct key key = {0, 0, };
|
||||
struct reiserfs_key key = {0, 0, };
|
||||
unsigned long done, total;
|
||||
|
||||
if (debug_mode (fs) == DO_LOOK_FOR_NAME) {
|
||||
|
||||
+10
-10
@@ -15,22 +15,22 @@ struct check_relocated {
|
||||
|
||||
static struct check_relocated * relocated_list;
|
||||
|
||||
void to_be_relocated (struct key * key)
|
||||
void to_be_relocated (struct reiserfs_key *key)
|
||||
{
|
||||
struct check_relocated * cur, * prev, * new_relocated;
|
||||
|
||||
cur = relocated_list;
|
||||
prev = 0;
|
||||
|
||||
while (cur && comp_short_keys(key, (struct key *)cur) != 1) {
|
||||
if (comp_short_keys (key, (struct key *)cur) == 0)
|
||||
while (cur && comp_short_keys(key, (struct reiserfs_key *)cur) != 1) {
|
||||
if (comp_short_keys (key, (struct reiserfs_key *)cur) == 0)
|
||||
return;
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
new_relocated = getmem (sizeof (struct check_relocated));
|
||||
copy_short_key ((struct key *)new_relocated, key);
|
||||
copy_short_key ((struct reiserfs_key *)new_relocated, key);
|
||||
|
||||
if (prev) {
|
||||
new_relocated->next = prev->next;
|
||||
@@ -41,7 +41,7 @@ void to_be_relocated (struct key * key)
|
||||
}
|
||||
}
|
||||
|
||||
int should_be_relocated (struct key * key)
|
||||
int should_be_relocated (struct reiserfs_key *key)
|
||||
{
|
||||
struct check_relocated *cur, *prev;
|
||||
int ret = 0;
|
||||
@@ -52,8 +52,8 @@ int should_be_relocated (struct key * key)
|
||||
cur = relocated_list;
|
||||
|
||||
prev = NULL;
|
||||
while (cur && comp_short_keys(key, (struct key *)cur) != 1) {
|
||||
if (comp_short_keys (key, (struct key *)cur) == 0) {
|
||||
while (cur && comp_short_keys(key, (struct reiserfs_key *)cur) != 1) {
|
||||
if (comp_short_keys (key, (struct reiserfs_key *)cur) == 0) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
@@ -996,7 +996,7 @@ static int get_pos (struct buffer_head * bh, unsigned long block)
|
||||
|
||||
|
||||
/* path[h] - leaf node */
|
||||
static struct key * lkey (struct buffer_head ** path, int h)
|
||||
static struct reiserfs_key *lkey (struct buffer_head ** path, int h)
|
||||
{
|
||||
int pos;
|
||||
|
||||
@@ -1011,7 +1011,7 @@ static struct key * lkey (struct buffer_head ** path, int h)
|
||||
|
||||
|
||||
/* path[h] - leaf node */
|
||||
static struct key * rkey (struct buffer_head ** path, int h)
|
||||
static struct reiserfs_key *rkey (struct buffer_head ** path, int h)
|
||||
{
|
||||
int pos;
|
||||
|
||||
@@ -1029,7 +1029,7 @@ static struct key * rkey (struct buffer_head ** path, int h)
|
||||
static int bad_path (reiserfs_filsys_t * fs, struct buffer_head ** path, int h1)
|
||||
{
|
||||
int h = 0;
|
||||
struct key * dk;
|
||||
struct reiserfs_key *dk;
|
||||
int pos = 0;
|
||||
|
||||
while (path[h])
|
||||
|
||||
+19
-19
@@ -120,7 +120,7 @@ void pass_2 (reiserfs_filsys_t *);
|
||||
void load_pass_2_result (reiserfs_filsys_t *);
|
||||
void insert_item_separately (struct item_head * ih, char * item, int was_in_tree);
|
||||
void save_item (struct si ** head, struct item_head * ih, char * item, __u32 blocknr);
|
||||
struct si * save_and_delete_file_item (struct si * si, struct path * path);
|
||||
struct si * save_and_delete_file_item (struct si * si, struct reiserfs_path *path);
|
||||
void take_bad_blocks_put_into_tree (void);
|
||||
void rewrite_object (struct item_head * ih, int do_remap);
|
||||
void pass_2_take_bad_blocks_put_into_tree (void);
|
||||
@@ -129,8 +129,8 @@ void link_relocated_files (void);
|
||||
int should_relocate (struct item_head * ih);
|
||||
void relocate_dir (struct item_head * ih, int change_ih);
|
||||
|
||||
extern __u32 objectid_for_relocation (struct key * key);
|
||||
extern void linked_already(struct key *new_key);
|
||||
extern __u32 objectid_for_relocation (struct reiserfs_key *key);
|
||||
extern void linked_already(struct reiserfs_key *new_key);
|
||||
|
||||
/* file.c */
|
||||
struct si {
|
||||
@@ -145,7 +145,7 @@ struct si {
|
||||
void put_saved_items_into_tree (struct si *);
|
||||
int reiserfsck_file_write (struct item_head * ih, char * item, int was_in_tree);
|
||||
int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, __u32 * blocks, int mark_passed_items, int * symlink);
|
||||
int delete_N_items_after_key(struct key * start_key, struct si ** save_here, int skip_dir_items, int n_to_delete);
|
||||
int delete_N_items_after_key(struct reiserfs_key *start_key, struct si ** save_here, int skip_dir_items, int n_to_delete);
|
||||
void rewrite_file (struct item_head * ih, int should_relocate, int should_change_ih);
|
||||
|
||||
|
||||
@@ -163,18 +163,18 @@ void load_semantic_result (FILE *, reiserfs_filsys_t *);
|
||||
|
||||
void pass_3_semantic (reiserfs_filsys_t *);
|
||||
void semantic_check (void);
|
||||
int check_semantic_tree (struct key * key, struct key * parent, int is_dot_dot, int lost_found, struct item_head * new_ih);
|
||||
int check_semantic_tree (struct reiserfs_key *key, struct reiserfs_key *parent, int is_dot_dot, int lost_found, struct item_head * new_ih);
|
||||
void zero_nlink (struct item_head * ih, void * sd);
|
||||
int not_a_directory (void * sd);
|
||||
int not_a_regfile (void * sd);
|
||||
int fix_obviously_wrong_sd_mode (struct path * path);
|
||||
int fix_obviously_wrong_sd_mode (struct reiserfs_path *path);
|
||||
int is_dot_dot (char * name, int namelen);
|
||||
int is_dot (char * name, int namelen);
|
||||
/*void create_dir_sd (reiserfs_filsys_t * fs,
|
||||
struct path * path, struct key * key);*/
|
||||
int rebuild_check_regular_file (struct path * path, void * sd,
|
||||
struct reiserfs_path *path, struct reiserfs_key *key);*/
|
||||
int rebuild_check_regular_file (struct reiserfs_path *path, void * sd,
|
||||
struct item_head * new_ih);
|
||||
int rebuild_semantic_pass (struct key * key, struct key * parent, int is_dot_dot,
|
||||
int rebuild_semantic_pass (struct reiserfs_key *key, struct reiserfs_key *parent, int is_dot_dot,
|
||||
struct item_head * new_ih);
|
||||
|
||||
|
||||
@@ -207,23 +207,23 @@ int bad_pair (reiserfs_filsys_t *, struct buffer_head * bh, int i);
|
||||
int bad_leaf_2 (reiserfs_filsys_t *, struct buffer_head * bh);
|
||||
|
||||
#if 0
|
||||
extern int should_be_relocated (struct key * key);
|
||||
extern void to_be_relocated (struct key * key);
|
||||
extern int should_be_relocated (struct reiserfs_key *key);
|
||||
extern void to_be_relocated (struct reiserfs_key *key);
|
||||
extern void clear_relocated_list(void);
|
||||
#endif
|
||||
|
||||
/* ustree.c */
|
||||
void reiserfsck_paste_into_item (struct path * path, const char * body, int size);
|
||||
void reiserfsck_insert_item (struct path * path, struct item_head * ih, const char * body);
|
||||
void reiserfsck_delete_item (struct path * path, int temporary);
|
||||
void reiserfsck_cut_from_item (struct path * path, int cut_size);
|
||||
void reiserfsck_paste_into_item (struct reiserfs_path *path, const char * body, int size);
|
||||
void reiserfsck_insert_item (struct reiserfs_path *path, struct item_head * ih, const char * body);
|
||||
void reiserfsck_delete_item (struct reiserfs_path *path, int temporary);
|
||||
void reiserfsck_cut_from_item (struct reiserfs_path *path, int cut_size);
|
||||
/*typedef int (comp3_function_t)(void * key1, void * key2, int version);*/
|
||||
/*typedef int (comp_function_t)(struct key * key1, struct key * key2);*/
|
||||
/*typedef int (comp_function_t)(struct reiserfs_key *key1, struct reiserfs_key *key2);*/
|
||||
/*int ubin_search_id(__u32 * id, __u32 * base, __u32 number, __u32 * pos);*/
|
||||
/*int usearch_by_key (struct super_block * s, struct key * key, struct path * path);*/
|
||||
/*int usearch_by_key_3 (struct super_block * s, struct key * key, struct path * path, int * repeat, int stop_level,
|
||||
/*int usearch_by_key (struct super_block * s, struct reiserfs_key *key, struct reiserfs_path *path);*/
|
||||
/*int usearch_by_key_3 (struct super_block * s, struct reiserfs_key *key, struct reiserfs_path *path, int * repeat, int stop_level,
|
||||
comp3_function_t comp_func, int version);
|
||||
int usearch_by_entry_key (struct super_block * s, struct key * key, struct path * path);*/
|
||||
int usearch_by_entry_key (struct super_block * s, struct reiserfs_key *key, struct reiserfs_path *path);*/
|
||||
|
||||
typedef int do_after_read_t (reiserfs_filsys_t *, struct buffer_head **, int h);
|
||||
typedef int do_on_full_path_t (reiserfs_filsys_t *, struct buffer_head **, int);
|
||||
|
||||
+8
-8
@@ -14,8 +14,8 @@ void modify_item (struct item_head * ih, void * item);
|
||||
/* fixme: search_by_key is not needed after any add_entry */
|
||||
static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
|
||||
{
|
||||
struct key key, prev_key, * rdkey;
|
||||
INITIALIZE_PATH (path);
|
||||
struct reiserfs_key key, prev_key, * rdkey;
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
int item_pos;
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
@@ -75,8 +75,8 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
|
||||
|
||||
if (is_direntry_ih (ih)) {
|
||||
/* if this directory has no stat data - try to recover it */
|
||||
struct key sd;
|
||||
struct path tmp;
|
||||
struct reiserfs_key sd;
|
||||
struct reiserfs_path tmp;
|
||||
|
||||
sd = ih->ih_key;
|
||||
set_type_and_offset (KEY_FORMAT_1, &sd, SD_OFFSET, TYPE_STAT_DATA);
|
||||
@@ -102,8 +102,8 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
|
||||
is_it_dir = ((not_a_directory (B_I_PITEM (bh,ih))) ? 0 : 1);
|
||||
|
||||
if (is_it_dir) {
|
||||
struct key tmp_key;
|
||||
INITIALIZE_PATH (tmp_path);
|
||||
struct reiserfs_key tmp_key;
|
||||
INITIALIZE_REISERFS_PATH(tmp_path);
|
||||
struct item_head * tmp_ih;
|
||||
|
||||
/* there is no need to link empty lost directories into /lost+found */
|
||||
@@ -135,7 +135,7 @@ static __u64 _look_for_lost (reiserfs_filsys_t * fs, int link_lost_dirs)
|
||||
lost_found_pass_stat (fs)->lost_found ++;
|
||||
|
||||
{
|
||||
struct key obj_key = {0, 0, {{0, 0},}};
|
||||
struct reiserfs_key obj_key = {0, 0, {{0, 0},}};
|
||||
char * lost_name;
|
||||
struct item_head tmp_ih;
|
||||
|
||||
@@ -318,7 +318,7 @@ void after_lost_found (reiserfs_filsys_t * fs)
|
||||
|
||||
void pass_3a_look_for_lost (reiserfs_filsys_t * fs)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
struct item_head * ih;
|
||||
void * sd;
|
||||
__u64 size, sd_size;
|
||||
|
||||
+2
-2
@@ -566,7 +566,7 @@ static __inline__ int does_it_fit_into_dev (__u64 offset, __u64 fs_size) {
|
||||
}
|
||||
|
||||
|
||||
static int is_wrong_short_key (struct key * key) {
|
||||
static int is_wrong_short_key (struct reiserfs_key *key) {
|
||||
if (get_key_dirid (key) == 0 || get_key_objectid (key) == 0 || get_key_objectid (key) == 1 ||
|
||||
get_key_dirid (key) == ~(__u32)0 || get_key_objectid (key) == ~(__u32)0 ||
|
||||
get_key_dirid (key) == get_key_objectid (key) ||
|
||||
@@ -1263,7 +1263,7 @@ static void pass0_correct_leaf (reiserfs_filsys_t * fs,
|
||||
|
||||
/* Darko Palic's filesystem had item: [20079 17328 0xfffb1001 IND, len 4048], format old */
|
||||
{
|
||||
struct key tmp_key;
|
||||
struct reiserfs_key tmp_key;
|
||||
|
||||
tmp_key = ih->ih_key;
|
||||
set_offset (key_format (&tmp_key), &tmp_key,
|
||||
|
||||
+9
-9
@@ -26,7 +26,7 @@ struct buffer_head * make_buffer (int dev, unsigned long blocknr, int size, char
|
||||
}
|
||||
|
||||
|
||||
int find_not_of_one_file(struct key * to_find, struct key * key) {
|
||||
int find_not_of_one_file(struct reiserfs_key *to_find, struct reiserfs_key *key) {
|
||||
if ((get_key_objectid (to_find) != ~(__u32)0) &&
|
||||
(get_key_objectid (to_find) != get_key_objectid (key)))
|
||||
return 1;
|
||||
@@ -131,7 +131,7 @@ static void leaf_is_in_tree_now (struct buffer_head * bh)
|
||||
}
|
||||
|
||||
|
||||
static void insert_pointer (struct buffer_head * bh, struct path * path)
|
||||
static void insert_pointer (struct buffer_head * bh, struct reiserfs_path *path)
|
||||
{
|
||||
struct item_head * ih;
|
||||
char * body;
|
||||
@@ -180,10 +180,10 @@ int balance_condition_fails (struct buffer_head * left, struct buffer_head * rig
|
||||
|
||||
/* return 1 if new can be joined with last node on the path or with
|
||||
its right neighbor, 0 otherwise */
|
||||
int balance_condition_2_fails (struct buffer_head * new, struct path * path)
|
||||
int balance_condition_2_fails (struct buffer_head * new, struct reiserfs_path *path)
|
||||
{
|
||||
struct buffer_head * bh;
|
||||
struct key * right_dkey;
|
||||
struct reiserfs_key *right_dkey;
|
||||
int pos, used_space;
|
||||
|
||||
bh = PATH_PLAST_BUFFER (path);
|
||||
@@ -204,7 +204,7 @@ int balance_condition_2_fails (struct buffer_head * new, struct path * path)
|
||||
if (pos == B_NR_ITEMS (bh = PATH_H_PBUFFER (path, 1))) {
|
||||
/* we have to read parent of right neighbor. For simplicity we
|
||||
call search_by_key, which will read right neighbor as well */
|
||||
INITIALIZE_PATH(path_to_right_neighbor);
|
||||
INITIALIZE_REISERFS_PATH(path_to_right_neighbor);
|
||||
|
||||
if (reiserfs_search_by_key_4 (fs, right_dkey, &path_to_right_neighbor) != ITEM_FOUND)
|
||||
reiserfs_panic ("%s: block %lu, pointer %d: The left delimiting key %k of the block (%lu) is wrong,"
|
||||
@@ -225,7 +225,7 @@ int balance_condition_2_fails (struct buffer_head * new, struct path * path)
|
||||
}
|
||||
|
||||
|
||||
static void get_max_buffer_key (struct buffer_head * bh, struct key * key)
|
||||
static void get_max_buffer_key (struct buffer_head * bh, struct reiserfs_key *key)
|
||||
{
|
||||
struct item_head * ih;
|
||||
|
||||
@@ -264,10 +264,10 @@ void make_single_leaf_tree (struct buffer_head * bh)
|
||||
uninsertable in special bitmap */
|
||||
static void try_to_insert_pointer_to_leaf (struct buffer_head * new_bh)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
struct buffer_head * bh; /* last path buffer */
|
||||
struct key * first_bh_key, last_bh_key; /* first and last keys of new buffer */
|
||||
struct key last_path_buffer_last_key, * right_dkey;
|
||||
struct reiserfs_key *first_bh_key, last_bh_key; /* first and last keys of new buffer */
|
||||
struct reiserfs_key last_path_buffer_last_key, * right_dkey;
|
||||
int ret_value;
|
||||
|
||||
if (tree_is_empty () == 1) {
|
||||
|
||||
+11
-11
@@ -35,7 +35,7 @@ struct relocated {
|
||||
beginning of semantic pass */
|
||||
static struct relocated * relocated_list = NULL;
|
||||
|
||||
static __u32 get_relocated_objectid_from_list (struct key * key) {
|
||||
static __u32 get_relocated_objectid_from_list (struct reiserfs_key *key) {
|
||||
struct relocated *cur = relocated_list;
|
||||
|
||||
while (cur) {
|
||||
@@ -49,7 +49,7 @@ static __u32 get_relocated_objectid_from_list (struct key * key) {
|
||||
}
|
||||
|
||||
/* return objectid the object has to be remapped with */
|
||||
__u32 objectid_for_relocation (struct key * key)
|
||||
__u32 objectid_for_relocation (struct reiserfs_key *key)
|
||||
{
|
||||
struct relocated * cur;
|
||||
__u32 cur_id;
|
||||
@@ -71,7 +71,7 @@ __u32 objectid_for_relocation (struct key * key)
|
||||
/* relocated files get added into lost+found with slightly different names */
|
||||
static __u64 link_one (struct relocated * file) {
|
||||
char * name;
|
||||
struct key obj_key;
|
||||
struct reiserfs_key obj_key;
|
||||
__u64 len = 0;
|
||||
|
||||
asprintf (&name, "%lu,%lu", file->old_dir_id, file->new_objectid);
|
||||
@@ -88,7 +88,7 @@ static __u64 link_one (struct relocated * file) {
|
||||
return len;
|
||||
}
|
||||
|
||||
void linked_already(struct key *new_key /*, link_func_t link_func*/) {
|
||||
void linked_already(struct reiserfs_key *new_key /*, link_func_t link_func*/) {
|
||||
struct relocated *cur = relocated_list;
|
||||
struct relocated *prev = NULL;
|
||||
|
||||
@@ -152,7 +152,7 @@ void save_item (struct si ** head, struct item_head * ih, char * item, __u32 blo
|
||||
}
|
||||
|
||||
|
||||
struct si * save_and_delete_file_item (struct si * si, struct path * path)
|
||||
struct si * save_and_delete_file_item (struct si * si, struct reiserfs_path *path)
|
||||
{
|
||||
struct buffer_head * bh = PATH_PLAST_BUFFER (path);
|
||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
||||
@@ -168,9 +168,9 @@ struct si * save_and_delete_file_item (struct si * si, struct path * path)
|
||||
/* check whether there are any directory items with this key */
|
||||
int should_relocate (struct item_head * ih)
|
||||
{
|
||||
struct key key;
|
||||
struct key * rkey;
|
||||
struct path path;
|
||||
struct reiserfs_key key;
|
||||
struct reiserfs_key *rkey;
|
||||
struct reiserfs_path path;
|
||||
struct item_head * path_ih;
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ int should_relocate (struct item_head * ih)
|
||||
|
||||
/* either both sd-s are new of both are old */
|
||||
static void overwrite_stat_data (struct item_head * new_ih,
|
||||
void * new_item, struct path * path)
|
||||
void * new_item, struct reiserfs_path *path)
|
||||
{
|
||||
__u16 new_mode, old_mode;
|
||||
|
||||
@@ -281,7 +281,7 @@ static void overwrite_stat_data (struct item_head * new_ih,
|
||||
/* insert sd item if it does not exist, overwrite it otherwise */
|
||||
static void put_sd_into_tree (struct item_head * new_ih, char * new_item)
|
||||
{
|
||||
struct path path;
|
||||
struct reiserfs_path path;
|
||||
|
||||
if (!not_a_directory (new_item)) {
|
||||
/* new item is a stat data of a directory. So we have to
|
||||
@@ -368,7 +368,7 @@ static void put_directory_item_into_tree (struct item_head * comingih, char * it
|
||||
directory in the tree yet - new item will be inserted
|
||||
marked not reached */
|
||||
reiserfs_add_entry (fs, &(comingih->ih_key), buf, entry_length (comingih, deh, i),
|
||||
(struct key *)&(deh->deh2_dir_id), 1 << IH_Unreachable);
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id), 1 << IH_Unreachable);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -7,13 +7,13 @@
|
||||
|
||||
void pass_4_check_unaccessed_items (void)
|
||||
{
|
||||
struct key key;
|
||||
struct path path;
|
||||
struct reiserfs_key key;
|
||||
struct reiserfs_path path;
|
||||
int i;
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
unsigned long items;
|
||||
struct key * rdkey;
|
||||
struct reiserfs_key *rdkey;
|
||||
|
||||
path.path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
|
||||
key = root_dir_key;
|
||||
|
||||
+34
-34
@@ -4,38 +4,38 @@
|
||||
|
||||
#include "fsck.h"
|
||||
|
||||
static struct key *trunc_links = NULL;
|
||||
static struct reiserfs_key *trunc_links = NULL;
|
||||
static __u32 links_num = 0;
|
||||
|
||||
int wrong_mode (struct key * key, __u16 * mode, __u64 real_size, int symlink);
|
||||
int wrong_st_blocks(struct key * key, __u32 * blocks, __u32 sd_blocks, __u16 mode,
|
||||
int wrong_mode (struct reiserfs_key *key, __u16 * mode, __u64 real_size, int symlink);
|
||||
int wrong_st_blocks(struct reiserfs_key *key, __u32 * blocks, __u32 sd_blocks, __u16 mode,
|
||||
int new_format);
|
||||
int wrong_st_size (struct key * key, unsigned long long max_file_size, int blocksize,
|
||||
int wrong_st_size (struct reiserfs_key *key, unsigned long long max_file_size, int blocksize,
|
||||
__u64 * size, __u64 sd_size, int type);
|
||||
int wrong_first_direct_byte (struct key * key, int blocksize, __u32 * first_direct_byte,
|
||||
int wrong_first_direct_byte (struct reiserfs_key *key, int blocksize, __u32 * first_direct_byte,
|
||||
__u32 sd_first_direct_byte, __u32 size);
|
||||
void get_object_key (struct reiserfs_de_head * deh, struct key * key,
|
||||
struct key * entry_key, struct item_head * ih);
|
||||
void get_object_key (struct reiserfs_de_head * deh, struct reiserfs_key *key,
|
||||
struct reiserfs_key *entry_key, struct item_head * ih);
|
||||
void print_name (char * name, int len);
|
||||
void erase_name (int len);
|
||||
|
||||
|
||||
struct path_key
|
||||
struct reiserfs_path_key
|
||||
{
|
||||
struct short_key
|
||||
{
|
||||
__u32 k_dir_id;
|
||||
__u32 k_objectid;
|
||||
} key;
|
||||
struct path_key * next, * prev;
|
||||
struct reiserfs_path_key * next, * prev;
|
||||
};
|
||||
|
||||
struct path_key * head_key = NULL;
|
||||
struct path_key * tail_key = NULL;
|
||||
struct reiserfs_path_key * head_key = NULL;
|
||||
struct reiserfs_path_key * tail_key = NULL;
|
||||
|
||||
static int check_path_key(struct key * key)
|
||||
static int check_path_key(struct reiserfs_key *key)
|
||||
{
|
||||
struct path_key * cur = head_key;
|
||||
struct reiserfs_path_key * cur = head_key;
|
||||
|
||||
while(cur != NULL)
|
||||
{
|
||||
@@ -48,18 +48,18 @@ static int check_path_key(struct key * key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_path_key(struct key * key)
|
||||
static int add_path_key(struct reiserfs_key *key)
|
||||
{
|
||||
if (check_path_key(key))
|
||||
return LOOP_FOUND;
|
||||
|
||||
if (tail_key == NULL)
|
||||
{
|
||||
tail_key = getmem(sizeof(struct path_key));
|
||||
tail_key = getmem(sizeof(struct reiserfs_path_key));
|
||||
head_key = tail_key;
|
||||
tail_key->prev = NULL;
|
||||
}else{
|
||||
tail_key->next = getmem(sizeof(struct path_key));
|
||||
tail_key->next = getmem(sizeof(struct reiserfs_path_key));
|
||||
tail_key->next->prev = tail_key;
|
||||
tail_key = tail_key->next;
|
||||
}
|
||||
@@ -87,11 +87,11 @@ void del_path_key()
|
||||
|
||||
/* path is path to stat data. If file will be relocated - new_ih will contain
|
||||
a key file was relocated with */
|
||||
static int check_check_regular_file (struct path * path, void * sd,
|
||||
static int check_check_regular_file (struct reiserfs_path *path, void * sd,
|
||||
struct item_head * new_ih)
|
||||
{
|
||||
int is_new_file;
|
||||
// struct key key, sd_key;
|
||||
// struct reiserfs_key key, sd_key;
|
||||
__u16 mode;
|
||||
__u32 nlink;
|
||||
__u64 real_size, sd_size;
|
||||
@@ -215,12 +215,12 @@ static int check_check_regular_file (struct path * path, void * sd,
|
||||
|
||||
/* returns buffer, containing found directory item.*/
|
||||
static char * get_next_directory_item (
|
||||
struct key * key, /* on return this will contain key of next item in the tree */
|
||||
struct key * parent, struct item_head * ih, __u32 * pos_in_item, int dir_format)
|
||||
struct reiserfs_key *key, /* on return this will contain key of next item in the tree */
|
||||
struct reiserfs_key *parent, struct item_head * ih, __u32 * pos_in_item, int dir_format)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
char * dir_item;
|
||||
struct key * rdkey;
|
||||
struct reiserfs_key *rdkey;
|
||||
struct buffer_head * bh;
|
||||
struct reiserfs_de_head * deh;
|
||||
int i;
|
||||
@@ -296,7 +296,7 @@ start_again:
|
||||
|
||||
//deh->deh_objectid != REISERFS_ROOT_PARENT_OBJECTID)/*????*/ {
|
||||
fsck_log ("get_next_directory_item: The entry \".\" of the directory %K "
|
||||
"pointes to %K, instead of %K", key, (struct key *)(&(deh->deh2_dir_id)),
|
||||
"pointes to %K, instead of %K", key, (struct reiserfs_key *)(&(deh->deh2_dir_id)),
|
||||
key);
|
||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
||||
set_deh_dirid (deh, get_key_dirid (key));
|
||||
@@ -314,7 +314,7 @@ start_again:
|
||||
/* set ".." so that it points to the correct parent directory */
|
||||
if (comp_short_keys (&(deh->deh2_dir_id), parent)) {
|
||||
fsck_log ("get_next_directory_item: The entry \"..\" of the directory %K "
|
||||
"pointes to %K, instead of %K", key, (struct key *)(&(deh->deh2_dir_id)));
|
||||
"pointes to %K, instead of %K", key, (struct reiserfs_key *)(&(deh->deh2_dir_id)));
|
||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
||||
set_deh_dirid (deh, get_key_dirid (parent));
|
||||
set_deh_objectid (deh, get_key_objectid (parent));
|
||||
@@ -350,10 +350,10 @@ start_again:
|
||||
}
|
||||
|
||||
/* semantic pass of --check */
|
||||
static int check_semantic_pass (struct key * key, struct key * parent, int dot_dot,
|
||||
static int check_semantic_pass (struct reiserfs_key *key, struct reiserfs_key *parent, int dot_dot,
|
||||
struct item_head * new_ih)
|
||||
{
|
||||
struct path path;
|
||||
struct reiserfs_path path;
|
||||
void * sd;
|
||||
__u32 nlink;
|
||||
int is_new_dir;
|
||||
@@ -363,7 +363,7 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
|
||||
char * dir_item;
|
||||
__u32 pos_in_item;
|
||||
struct item_head tmp_ih;
|
||||
struct key next_item_key, entry_key, object_key;
|
||||
struct reiserfs_key next_item_key, entry_key, object_key;
|
||||
__u64 dir_size = 0;
|
||||
__u32 blocks;
|
||||
__u64 sd_size;
|
||||
@@ -526,15 +526,15 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
|
||||
/* not alighed directory of new format - delete it */
|
||||
if (fsck_mode (fs) == FSCK_FIX_FIXABLE) {
|
||||
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated "
|
||||
"properly - deleted\n", (struct key *)&(deh->deh2_dir_id),
|
||||
"properly - deleted\n", (struct reiserfs_key *)&(deh->deh2_dir_id),
|
||||
namelen, name, &tmp_ih.ih_key);
|
||||
reiserfs_remove_entry (fs, &entry_key);
|
||||
entry_len = name_length (name, dir_format);
|
||||
reiserfs_add_entry (fs, key, name, entry_len,
|
||||
(struct key *)&(deh->deh2_dir_id), 0);
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id), 0);
|
||||
} else {
|
||||
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated "
|
||||
"properly.\n", (struct key *)&(deh->deh2_dir_id), namelen, name,
|
||||
"properly.\n", (struct reiserfs_key *)&(deh->deh2_dir_id), namelen, name,
|
||||
&tmp_ih.ih_key);
|
||||
one_more_corruption (fs, FIXABLE);
|
||||
}
|
||||
@@ -670,10 +670,10 @@ static int check_semantic_pass (struct key * key, struct key * parent, int dot_d
|
||||
|
||||
int check_safe_links ()
|
||||
{
|
||||
struct path safe_link_path, path;
|
||||
struct key safe_link_key = {-1, 0, {{0, 0}}};
|
||||
struct key key = {0, 0, {{0, 0}}};
|
||||
struct key * rkey;
|
||||
struct reiserfs_path safe_link_path, path;
|
||||
struct reiserfs_key safe_link_key = {-1, 0, {{0, 0}}};
|
||||
struct reiserfs_key key = {0, 0, {{0, 0}}};
|
||||
struct reiserfs_key *rkey;
|
||||
struct item_head * tmp_ih;
|
||||
|
||||
while (1) {
|
||||
|
||||
+30
-30
@@ -95,7 +95,7 @@ void erase_name (int len)
|
||||
|
||||
|
||||
/* *size is "real" file size, sd_size - size from stat data */
|
||||
int wrong_st_size (struct key * key, unsigned long long max_file_size,
|
||||
int wrong_st_size (struct reiserfs_key *key, unsigned long long max_file_size,
|
||||
int blocksize, __u64 * size, __u64 sd_size, int type)
|
||||
{
|
||||
if (sd_size <= max_file_size) {
|
||||
@@ -166,7 +166,7 @@ int wrong_st_size (struct key * key, unsigned long long max_file_size,
|
||||
| file, dir, link | blocks | generation | blocks |
|
||||
|------------------------------------------------------------------|
|
||||
*/
|
||||
int wrong_st_blocks (struct key * key, __u32 * blocks, __u32 sd_blocks, __u16 mode,
|
||||
int wrong_st_blocks (struct reiserfs_key *key, __u32 * blocks, __u32 sd_blocks, __u16 mode,
|
||||
int new_format)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -192,7 +192,7 @@ int wrong_st_blocks (struct key * key, __u32 * blocks, __u32 sd_blocks, __u16 mo
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
int wrong_st_rdev (struct key * key, __u32 * sd_rdev, __u16 mode, int new_format)
|
||||
int wrong_st_rdev (struct reiserfs_key *key, __u32 * sd_rdev, __u16 mode, int new_format)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -212,7 +212,7 @@ int wrong_st_rdev (struct key * key, __u32 * sd_rdev, __u16 mode, int new_format
|
||||
*/
|
||||
/* only regular files and symlinks may have items but stat
|
||||
data. Symlink should have body */
|
||||
int wrong_mode (struct key * key, __u16 * mode, __u64 real_size, int symlink)
|
||||
int wrong_mode (struct reiserfs_key *key, __u16 * mode, __u64 real_size, int symlink)
|
||||
{
|
||||
int retval = 0;
|
||||
if (S_ISLNK (*mode) && !symlink) {
|
||||
@@ -247,7 +247,7 @@ int wrong_mode (struct key * key, __u16 * mode, __u64 real_size, int symlink)
|
||||
|
||||
|
||||
/* key is a key of last file item */
|
||||
int wrong_first_direct_byte (struct key * key, int blocksize,
|
||||
int wrong_first_direct_byte (struct reiserfs_key *key, int blocksize,
|
||||
__u32 * first_direct_byte,
|
||||
__u32 sd_first_direct_byte, __u32 size)
|
||||
{
|
||||
@@ -293,9 +293,9 @@ int wrong_first_direct_byte (struct key * key, int blocksize,
|
||||
other place */
|
||||
void relocate_dir (struct item_head * ih, int change_ih)
|
||||
{
|
||||
struct key key;
|
||||
struct key * rkey;
|
||||
struct path path;
|
||||
struct reiserfs_key key;
|
||||
struct reiserfs_key *rkey;
|
||||
struct reiserfs_path path;
|
||||
struct item_head * path_ih;
|
||||
struct si * si;
|
||||
__u32 new_objectid;
|
||||
@@ -380,11 +380,11 @@ void relocate_dir (struct item_head * ih, int change_ih)
|
||||
|
||||
/* path is path to stat data. If file will be relocated - new_ih will contain
|
||||
a key file was relocated with */
|
||||
int rebuild_check_regular_file (struct path * path, void * sd,
|
||||
int rebuild_check_regular_file (struct reiserfs_path *path, void * sd,
|
||||
struct item_head * new_ih)
|
||||
{
|
||||
int is_new_file;
|
||||
// struct key sd_key;
|
||||
// struct reiserfs_key sd_key;
|
||||
__u16 mode;
|
||||
__u32 nlink;
|
||||
__u64 real_size, saved_size;
|
||||
@@ -503,7 +503,7 @@ int rebuild_check_regular_file (struct path * path, void * sd,
|
||||
}
|
||||
|
||||
|
||||
static int is_rootdir_key (struct key * key)
|
||||
static int is_rootdir_key (struct reiserfs_key *key)
|
||||
{
|
||||
if (comp_keys (key, &root_dir_key))
|
||||
return 0;
|
||||
@@ -512,16 +512,16 @@ static int is_rootdir_key (struct key * key)
|
||||
|
||||
|
||||
/* returns buffer, containing found directory item.*/
|
||||
static char * get_next_directory_item (struct key * key, /* on return this will
|
||||
static char * get_next_directory_item (struct reiserfs_key *key, /* on return this will
|
||||
contain key of next item
|
||||
in the tree */
|
||||
struct key * parent,
|
||||
struct reiserfs_key *parent,
|
||||
struct item_head * ih,/*not in tree*/
|
||||
__u32 * pos_in_item)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
char * dir_item;
|
||||
struct key * rdkey;
|
||||
struct reiserfs_key *rdkey;
|
||||
struct buffer_head * bh;
|
||||
struct reiserfs_de_head * deh;
|
||||
int i;
|
||||
@@ -568,7 +568,7 @@ static char * get_next_directory_item (struct key * key, /* on return this will
|
||||
|
||||
//deh->deh_objectid != REISERFS_ROOT_PARENT_OBJECTID)/*????*/ {
|
||||
fsck_log ("get_next_directory_item: The entry \".\" of the directory %K pointes to %K, instead of %K",
|
||||
key, (struct key *)(&(deh->deh2_dir_id)), key);
|
||||
key, (struct reiserfs_key *)(&(deh->deh2_dir_id)), key);
|
||||
set_deh_dirid (deh, get_key_dirid (key));
|
||||
set_deh_objectid (deh, get_key_objectid (key));
|
||||
mark_buffer_dirty (bh);
|
||||
@@ -580,7 +580,7 @@ static char * get_next_directory_item (struct key * key, /* on return this will
|
||||
/* set ".." so that it points to the correct parent directory */
|
||||
if (comp_short_keys (&(deh->deh2_dir_id), parent)) {
|
||||
fsck_log ("get_next_directory_item: The entry \"..\" of the directory %K pointes to %K, instead of %K",
|
||||
key, (struct key *)(&(deh->deh2_dir_id)), parent);
|
||||
key, (struct reiserfs_key *)(&(deh->deh2_dir_id)), parent);
|
||||
set_deh_dirid (deh, get_key_dirid (parent));
|
||||
set_deh_objectid (deh, get_key_objectid (parent));
|
||||
mark_buffer_dirty (bh);
|
||||
@@ -612,8 +612,8 @@ static char * get_next_directory_item (struct key * key, /* on return this will
|
||||
|
||||
|
||||
// get key of an object pointed by direntry and the key of the entry itself
|
||||
void get_object_key (struct reiserfs_de_head * deh, struct key * key,
|
||||
struct key * entry_key, struct item_head * ih)
|
||||
void get_object_key (struct reiserfs_de_head * deh, struct reiserfs_key *key,
|
||||
struct reiserfs_key *entry_key, struct item_head * ih)
|
||||
{
|
||||
/* entry points to this key */
|
||||
set_key_dirid (key, get_deh_dirid (deh));
|
||||
@@ -628,8 +628,8 @@ void get_object_key (struct reiserfs_de_head * deh, struct key * key,
|
||||
set_key_uniqueness (entry_key, DIRENTRY_UNIQUENESS);
|
||||
}
|
||||
|
||||
int fix_obviously_wrong_sd_mode (struct path * path) {
|
||||
struct key * next_key = NULL;
|
||||
int fix_obviously_wrong_sd_mode (struct reiserfs_path *path) {
|
||||
struct reiserfs_key *next_key = NULL;
|
||||
__u16 mode;
|
||||
int retval = 0;
|
||||
|
||||
@@ -679,10 +679,10 @@ int fix_obviously_wrong_sd_mode (struct path * path) {
|
||||
object, STAT_DATA_NOT_FOUND if stat data was not found or RELOCATED when
|
||||
file was relocated because its objectid was already marked as used by
|
||||
another file */
|
||||
int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
|
||||
int rebuild_semantic_pass (struct reiserfs_key *key, struct reiserfs_key *parent, int dot_dot,
|
||||
struct item_head * new_ih)
|
||||
{
|
||||
struct path path;
|
||||
struct reiserfs_path path;
|
||||
void * sd;
|
||||
int is_new_dir;
|
||||
__u32 nlink;
|
||||
@@ -692,7 +692,7 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
|
||||
char * dir_item;
|
||||
__u32 pos_in_item;
|
||||
struct item_head tmp_ih;
|
||||
struct key item_key, entry_key, object_key;
|
||||
struct reiserfs_key item_key, entry_key, object_key;
|
||||
__u64 dir_size;
|
||||
__u32 blocks;
|
||||
__u64 saved_size;
|
||||
@@ -802,7 +802,7 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
|
||||
|
||||
/*
|
||||
{
|
||||
struct key * tmp;
|
||||
struct reiserfs_key *tmp;
|
||||
|
||||
// check next item: if it is not a directory item of the same file
|
||||
// therefore sd_mode is corrupted so we just reset it to regular file
|
||||
@@ -875,21 +875,21 @@ int rebuild_semantic_pass (struct key * key, struct key * parent, int dot_dot,
|
||||
if ((dir_format == KEY_FORMAT_2) && (entry_len % 8 != 0)) {
|
||||
/* not alighed directory of new format - delete it */
|
||||
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated properly - fixed.\n",
|
||||
(struct key *)&(deh->deh2_dir_id), namelen, name, &tmp_ih.ih_key);
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id), namelen, name, &tmp_ih.ih_key);
|
||||
reiserfs_remove_entry (fs, &entry_key);
|
||||
entry_len = name_length (name, dir_format);
|
||||
reiserfs_add_entry (fs, key, name, entry_len,
|
||||
(struct key *)&(deh->deh2_dir_id), 0);
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id), 0);
|
||||
}
|
||||
/*
|
||||
if ((dir_format == KEY_FORMAT_1) && (namelen != entry_len)) {
|
||||
// aligned entry in directory of old format - remove and insert it back
|
||||
fsck_log ("Entry %K (\"%.*s\") in the directory %K is not formated properly - deleted\n",
|
||||
(struct key *)&(deh->deh2_dir_id), namelen, name, &tmp_ih.ih_key);
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id), namelen, name, &tmp_ih.ih_key);
|
||||
reiserfs_remove_entry (fs, &entry_key);
|
||||
entry_len = name_length (name, dir_format);
|
||||
reiserfs_add_entry (fs, key, name, entry_len,
|
||||
(struct key *)&(deh->deh2_dir_id), 0);
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id), 0);
|
||||
}
|
||||
*/
|
||||
if (is_dot (name, namelen)) {
|
||||
@@ -1056,7 +1056,7 @@ void modify_item (struct item_head * ih, void * item)
|
||||
static void make_sure_lost_found_exists (reiserfs_filsys_t * fs)
|
||||
{
|
||||
int retval;
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
unsigned int gen_counter;
|
||||
__u32 objectid;
|
||||
__u64 sd_size;
|
||||
|
||||
+25
-25
@@ -5,17 +5,17 @@
|
||||
|
||||
#include "fsck.h"
|
||||
|
||||
static int do_items_have_the_same_type (struct item_head * ih, struct key * key)
|
||||
static int do_items_have_the_same_type (struct item_head * ih, struct reiserfs_key *key)
|
||||
{
|
||||
return (get_type (&ih->ih_key) == get_type (key)) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int are_items_in_the_same_node (struct path * path)
|
||||
static int are_items_in_the_same_node (struct reiserfs_path *path)
|
||||
{
|
||||
return (PATH_LAST_POSITION (path) < B_NR_ITEMS (PATH_PLAST_BUFFER (path)) - 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void cut_last_unfm_pointer (struct path * path, struct item_head * ih)
|
||||
static void cut_last_unfm_pointer (struct reiserfs_path *path, struct item_head * ih)
|
||||
{
|
||||
set_ih_free_space(ih, 0);
|
||||
if (I_UNFM_NUM (ih) == 1)
|
||||
@@ -28,7 +28,7 @@ static void cut_last_unfm_pointer (struct path * path, struct item_head * ih)
|
||||
if this is not a symlink - make it of_this_size;
|
||||
otherwise find a size and return it in symlink_size;
|
||||
*/
|
||||
static unsigned long indirect_to_direct (struct path * path, __u64 len, int symlink)
|
||||
static unsigned long indirect_to_direct (struct reiserfs_path *path, __u64 len, int symlink)
|
||||
{
|
||||
struct buffer_head * bh = PATH_PLAST_BUFFER (path);
|
||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
||||
@@ -102,10 +102,10 @@ static unsigned long indirect_to_direct (struct path * path, __u64 len, int syml
|
||||
start_key is the first undeleted item.
|
||||
return whether we are sure there is nothing else of this file
|
||||
*/
|
||||
int delete_N_items_after_key(struct key * start_key, struct si ** save_here, int skip_dir_items, int n_to_delete) {
|
||||
struct path path;
|
||||
// struct key key = *start_key;
|
||||
struct key * rkey;
|
||||
int delete_N_items_after_key(struct reiserfs_key *start_key, struct si ** save_here, int skip_dir_items, int n_to_delete) {
|
||||
struct reiserfs_path path;
|
||||
// struct reiserfs_key key = *start_key;
|
||||
struct reiserfs_key *rkey;
|
||||
int count = 0;
|
||||
|
||||
while (1) {
|
||||
@@ -172,9 +172,9 @@ int delete_N_items_after_key(struct key * start_key, struct si ** save_here, int
|
||||
int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, __u32 * blocks,
|
||||
int mark_passed_items, int * symlink)
|
||||
{
|
||||
struct path path;
|
||||
struct reiserfs_path path;
|
||||
struct item_head * ih;
|
||||
struct key * next_key, * key;
|
||||
struct reiserfs_key *next_key, * key;
|
||||
__u32 sd_first_direct_byte = 0;
|
||||
__u64 sd_size;
|
||||
unsigned int i;
|
||||
@@ -415,11 +415,11 @@ int are_file_items_correct (struct item_head * sd_ih, void * sd, __u64 * size, _
|
||||
if should_change_ih is specified then the key in ih is changed also. */
|
||||
void rewrite_file (struct item_head * ih, int should_relocate, int should_change_ih)
|
||||
{
|
||||
struct key key;
|
||||
struct reiserfs_key key;
|
||||
struct si * si;
|
||||
__u32 new_objectid = 0;
|
||||
int moved_items;
|
||||
struct key old, new;
|
||||
struct reiserfs_key old, new;
|
||||
int nothing_else = 0;
|
||||
|
||||
/* starting with the leftmost one - look for all items of file,
|
||||
@@ -520,7 +520,7 @@ static int make_file_writeable (struct buffer_head * bh, int pos)
|
||||
|
||||
/* this inserts __first__ indirect item (having k_offset == 1 and only
|
||||
one unfm pointer) into tree */
|
||||
static int create_first_item_of_file (struct item_head * ih, char * item, struct path * path, int was_in_tree)
|
||||
static int create_first_item_of_file (struct item_head * ih, char * item, struct reiserfs_path *path, int was_in_tree)
|
||||
{
|
||||
__u32 unfm_ptr;
|
||||
__u32 * ni = 0;
|
||||
@@ -599,7 +599,7 @@ static int create_first_item_of_file (struct item_head * ih, char * item, struct
|
||||
its block number. */
|
||||
/* we convert direct item that is on the path to indirect. we need a number of free block for
|
||||
unformatted node. reiserfs_new_blocknrs will start from block number returned by this function */
|
||||
static unsigned long block_to_start (struct path * path)
|
||||
static unsigned long block_to_start (struct reiserfs_path *path)
|
||||
{
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
@@ -616,10 +616,10 @@ static unsigned long block_to_start (struct path * path)
|
||||
}
|
||||
|
||||
|
||||
static void direct2indirect2 (unsigned long unfm, struct path * path)
|
||||
static void direct2indirect2 (unsigned long unfm, struct reiserfs_path *path)
|
||||
{
|
||||
struct item_head * ih;
|
||||
struct key key;
|
||||
struct reiserfs_key key;
|
||||
struct buffer_head * unbh;
|
||||
__u32 ni;
|
||||
int copied = 0;
|
||||
@@ -709,7 +709,7 @@ static void direct2indirect2 (unsigned long unfm, struct path * path)
|
||||
|
||||
|
||||
static int append_to_unformatted_node (struct item_head * comingih, struct item_head * ih, char * item,
|
||||
struct path * path, unsigned int coming_len)
|
||||
struct reiserfs_path *path, unsigned int coming_len)
|
||||
{
|
||||
struct buffer_head * bh, * unbh = NULL;
|
||||
__u64 end_of_data, free_space;
|
||||
@@ -773,7 +773,7 @@ static int append_to_unformatted_node (struct item_head * comingih, struct item_
|
||||
/* this appends file with one unformatted node pointer (since balancing
|
||||
algorithm limitation). This pointer can be 0, or new allocated block or
|
||||
pointer from indirect item that is being inserted into tree */
|
||||
int reiserfsck_append_file (struct item_head * comingih, char * item, int pos, struct path * path,
|
||||
int reiserfsck_append_file (struct item_head * comingih, char * item, int pos, struct reiserfs_path *path,
|
||||
int was_in_tree)
|
||||
{
|
||||
__u32 * ni;
|
||||
@@ -838,7 +838,7 @@ int reiserfsck_append_file (struct item_head * comingih, char * item, int pos, s
|
||||
return retval;
|
||||
}
|
||||
|
||||
long long int must_there_be_a_hole (struct item_head * comingih, struct path * path)
|
||||
long long int must_there_be_a_hole (struct item_head * comingih, struct reiserfs_path *path)
|
||||
{
|
||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
||||
|
||||
@@ -858,7 +858,7 @@ long long int must_there_be_a_hole (struct item_head * comingih, struct path * p
|
||||
}
|
||||
|
||||
|
||||
int reiserfs_append_zero_unfm_ptr (struct path * path, long long int p_count)
|
||||
int reiserfs_append_zero_unfm_ptr (struct reiserfs_path *path, long long int p_count)
|
||||
{
|
||||
__u32 * ni;
|
||||
long long int count;
|
||||
@@ -883,7 +883,7 @@ int reiserfs_append_zero_unfm_ptr (struct path * path, long long int p_count)
|
||||
|
||||
/* write direct item to unformatted node */
|
||||
/* coming item is direct */
|
||||
static int overwrite_by_direct_item (struct item_head * comingih, char * item, struct path * path)
|
||||
static int overwrite_by_direct_item (struct item_head * comingih, char * item, struct reiserfs_path *path)
|
||||
{
|
||||
__u32 unfm_ptr;
|
||||
struct buffer_head * unbh, * bh;
|
||||
@@ -984,7 +984,7 @@ void overwrite_unfm_by_unfm (unsigned long unfm_in_tree, unsigned long coming_un
|
||||
|
||||
/* put unformatted node pointers from incoming item over the in-tree ones */
|
||||
static int overwrite_by_indirect_item (struct item_head * comingih, __u32 * coming_item,
|
||||
struct path * path, int * pos_in_coming_item)
|
||||
struct reiserfs_path *path, int * pos_in_coming_item)
|
||||
{
|
||||
struct buffer_head * bh = PATH_PLAST_BUFFER (path);
|
||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
||||
@@ -1033,7 +1033,7 @@ static int overwrite_by_indirect_item (struct item_head * comingih, __u32 * comi
|
||||
|
||||
|
||||
static int reiserfsck_overwrite_file (struct item_head * comingih, char * item,
|
||||
struct path * path, int * pos_in_coming_item,
|
||||
struct reiserfs_path *path, int * pos_in_coming_item,
|
||||
int was_in_tree)
|
||||
{
|
||||
__u32 unfm_ptr;
|
||||
@@ -1079,10 +1079,10 @@ static int reiserfsck_overwrite_file (struct item_head * comingih, char * item,
|
||||
/*
|
||||
*/
|
||||
int reiserfsck_file_write (struct item_head * ih, char * item, int was_in_tree) {
|
||||
struct path path;
|
||||
struct reiserfs_path path;
|
||||
int count, pos_in_coming_item;
|
||||
long long int retval, written;
|
||||
struct key key;
|
||||
struct reiserfs_key key;
|
||||
int file_format = KEY_FORMAT_UNDEFINED;
|
||||
int relocated = 0;
|
||||
|
||||
|
||||
+5
-5
@@ -8,7 +8,7 @@
|
||||
|
||||
struct tree_balance * cur_tb = 0;
|
||||
|
||||
void reiserfsck_paste_into_item (struct path * path, const char * body, int size)
|
||||
void reiserfsck_paste_into_item (struct reiserfs_path *path, const char * body, int size)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
|
||||
@@ -22,7 +22,7 @@ void reiserfsck_paste_into_item (struct path * path, const char * body, int size
|
||||
}
|
||||
|
||||
|
||||
void reiserfsck_insert_item (struct path * path, struct item_head * ih, const char * body)
|
||||
void reiserfsck_insert_item (struct reiserfs_path *path, struct item_head * ih, const char * body)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
|
||||
@@ -55,7 +55,7 @@ static void free_unformatted_nodes (struct item_head * ih, struct buffer_head *
|
||||
}
|
||||
}
|
||||
|
||||
void reiserfsck_delete_item (struct path * path, int temporary)
|
||||
void reiserfsck_delete_item (struct reiserfs_path *path, int temporary)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
struct item_head * ih = PATH_PITEM_HEAD (path);
|
||||
@@ -72,7 +72,7 @@ void reiserfsck_delete_item (struct path * path, int temporary)
|
||||
}
|
||||
|
||||
|
||||
void reiserfsck_cut_from_item (struct path * path, int cut_size)
|
||||
void reiserfsck_cut_from_item (struct reiserfs_path *path, int cut_size)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
struct item_head * ih;
|
||||
@@ -108,7 +108,7 @@ void reiserfsck_cut_from_item (struct path * path, int cut_size)
|
||||
|
||||
/* uget_rkey is utils clone of stree.c/get_rkey */
|
||||
/*
|
||||
struct key * uget_rkey (struct path * path)
|
||||
struct reiserfs_key *uget_rkey (struct reiserfs_path *path)
|
||||
{
|
||||
int pos, offset = path->path_length;
|
||||
struct buffer_head * bh;
|
||||
|
||||
+22
-22
@@ -541,7 +541,7 @@ struct offset_v2 {
|
||||
|
||||
|
||||
/* Key of the object determines object's location in the tree, composed of 4 components */
|
||||
struct key {
|
||||
struct reiserfs_key {
|
||||
__u32 k2_dir_id; /* packing locality: by default parent directory object id */
|
||||
__u32 k2_objectid; /* object identifier */
|
||||
union {
|
||||
@@ -581,11 +581,11 @@ struct key {
|
||||
#define set_key_objectid(key,n) ((key)->k_objectid = cpu_to_le32((n)))
|
||||
*/
|
||||
|
||||
#define KEY_SIZE (sizeof(struct key))
|
||||
#define KEY_SIZE (sizeof(struct reiserfs_key))
|
||||
#define SHORT_KEY_SIZE 8
|
||||
|
||||
|
||||
// values for k_uniqueness field of the struct key
|
||||
// values for k_uniqueness field of the struct reiserfs_key
|
||||
#define V1_SD_UNIQUENESS 0
|
||||
#define V1_DIRENTRY_UNIQUENESS 500
|
||||
#define DIRENTRY_UNIQUENESS 500
|
||||
@@ -593,7 +593,7 @@ struct key {
|
||||
#define V1_INDIRECT_UNIQUENESS 0xfffffffe
|
||||
#define V1_UNKNOWN_UNIQUENESS 555
|
||||
|
||||
// values for k_type field of the struct key
|
||||
// values for k_type field of the struct reiserfs_key
|
||||
#define TYPE_STAT_DATA 0
|
||||
#define TYPE_INDIRECT 1
|
||||
#define TYPE_DIRECT 2
|
||||
@@ -623,7 +623,7 @@ struct key {
|
||||
|
||||
struct item_head
|
||||
{
|
||||
struct key ih_key; /* Everything in the tree is found by searching for it
|
||||
struct reiserfs_key ih_key; /* Everything in the tree is found by searching for it
|
||||
based on its key.*/
|
||||
|
||||
union {
|
||||
@@ -1108,7 +1108,7 @@ struct disk_child {
|
||||
equal to given key, or which is the maximal key less than the given
|
||||
key. */
|
||||
|
||||
struct path_element {
|
||||
struct reiserfs_path_element {
|
||||
struct buffer_head * pe_buffer; /* Pointer to the buffer at the path in
|
||||
the tree. */
|
||||
unsigned int pe_position; /* Position in the tree node which is placed
|
||||
@@ -1134,14 +1134,14 @@ struct path_element {
|
||||
is still valid. You'll need to read search_by_key and the comments
|
||||
in it, especially about decrement_counters_in_path(), to understand
|
||||
this structure. */
|
||||
struct path {
|
||||
struct reiserfs_path {
|
||||
unsigned int path_length; /* Length of the array above. */
|
||||
struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
|
||||
struct reiserfs_path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
|
||||
unsigned int pos_in_item;
|
||||
};
|
||||
|
||||
#define INITIALIZE_PATH(var) \
|
||||
struct path var = {ILLEGAL_PATH_ELEMENT_OFFSET, }
|
||||
#define INITIALIZE_REISERFS_PATH(var) \
|
||||
struct reiserfs_path var = {ILLEGAL_PATH_ELEMENT_OFFSET, }
|
||||
|
||||
/* Get path element by path and path position. */
|
||||
#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset))
|
||||
@@ -1312,7 +1312,7 @@ struct tree_balance
|
||||
{
|
||||
struct reiserfs_transaction_handle *transaction_handle ;
|
||||
reiserfs_filsys_t * tb_fs;
|
||||
struct path * tb_path;
|
||||
struct reiserfs_path *tb_path;
|
||||
struct buffer_head * L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */
|
||||
struct buffer_head * R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path*/
|
||||
struct buffer_head * FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */
|
||||
@@ -1480,7 +1480,7 @@ struct buffer_info {
|
||||
#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )
|
||||
|
||||
/* get key */
|
||||
#define B_N_PDELIM_KEY(bh,item_num) ( (struct key * )((bh)->b_data + BLKH_SIZE) + (item_num) )
|
||||
#define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key *)((bh)->b_data + BLKH_SIZE) + (item_num) )
|
||||
|
||||
/* get the key */
|
||||
#define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) )
|
||||
@@ -1511,18 +1511,18 @@ struct buffer_info {
|
||||
/* stree.c */
|
||||
void padd_item (char * item, int total_length, int length);
|
||||
int B_IS_IN_TREE(struct buffer_head *);
|
||||
struct key * get_rkey (struct path * p_s_chk_path, reiserfs_filsys_t *);
|
||||
struct reiserfs_key *get_rkey (struct reiserfs_path *p_s_chk_path, reiserfs_filsys_t *);
|
||||
int bin_search (void * p_v_key, void * p_v_base, int p_n_num, int p_n_width, unsigned int * p_n_pos);
|
||||
int search_by_key (reiserfs_filsys_t *, struct key *, struct path *, int);
|
||||
int search_by_entry_key (reiserfs_filsys_t *, struct key *, struct path *);
|
||||
int search_for_position_by_key (reiserfs_filsys_t *, struct key *, struct path *);
|
||||
int search_by_objectid (reiserfs_filsys_t *, struct key *, struct path *, int *);
|
||||
void decrement_counters_in_path (struct path * p_s_search_path);
|
||||
void pathrelse (struct path * p_s_search_path);
|
||||
int search_by_key (reiserfs_filsys_t *, struct reiserfs_key *, struct reiserfs_path *, int);
|
||||
int search_by_entry_key (reiserfs_filsys_t *, struct reiserfs_key *, struct reiserfs_path *);
|
||||
int search_for_position_by_key (reiserfs_filsys_t *, struct reiserfs_key *, struct reiserfs_path *);
|
||||
int search_by_objectid (reiserfs_filsys_t *, struct reiserfs_key *, struct reiserfs_path *, int *);
|
||||
void decrement_counters_in_path (struct reiserfs_path *p_s_search_path);
|
||||
void pathrelse (struct reiserfs_path *p_s_search_path);
|
||||
|
||||
|
||||
int is_left_mergeable (reiserfs_filsys_t * s, struct path * path);
|
||||
int is_right_mergeable (reiserfs_filsys_t * s, struct path * path);
|
||||
int is_left_mergeable (reiserfs_filsys_t * s, struct reiserfs_path *path);
|
||||
int is_right_mergeable (reiserfs_filsys_t * s, struct reiserfs_path *path);
|
||||
int are_items_mergeable (struct item_head * left, struct item_head * right, int bsize);
|
||||
|
||||
|
||||
@@ -1533,7 +1533,7 @@ int fix_nodes (/*struct reiserfs_transaction_handle *th,*/ int n_op_mode, struct
|
||||
/*int n_pos_in_item,*/ struct item_head * p_s_ins_ih);
|
||||
void unfix_nodes (/*struct reiserfs_transaction_handle *th,*/ struct tree_balance *);
|
||||
void free_buffers_in_tb (struct tree_balance * p_s_tb);
|
||||
void init_path (struct path *);
|
||||
void init_path (struct reiserfs_path *);
|
||||
|
||||
/* prints.c */
|
||||
/* options */
|
||||
|
||||
+35
-35
@@ -76,7 +76,7 @@ typedef struct _transaction reiserfs_trans_t;
|
||||
|
||||
/* reiserfslib.c */
|
||||
|
||||
void init_tb_struct (struct tree_balance * tb, reiserfs_filsys_t *, struct path * path, int size);
|
||||
void init_tb_struct (struct tree_balance * tb, reiserfs_filsys_t *, struct reiserfs_path *path, int size);
|
||||
|
||||
reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int * error, void * vp, int skip_check);
|
||||
reiserfs_filsys_t * reiserfs_create (char * filename, int version, unsigned long block_count,
|
||||
@@ -106,50 +106,50 @@ int spread_bitmaps (reiserfs_filsys_t *);
|
||||
int filesystem_dirty (reiserfs_filsys_t *);
|
||||
void mark_filesystem_dirty (reiserfs_filsys_t *);
|
||||
|
||||
void reiserfs_paste_into_item (reiserfs_filsys_t *, struct path * path,
|
||||
void reiserfs_paste_into_item (reiserfs_filsys_t *, struct reiserfs_path *path,
|
||||
const void * body, int size);
|
||||
void reiserfs_insert_item (reiserfs_filsys_t *, struct path * path,
|
||||
void reiserfs_insert_item (reiserfs_filsys_t *, struct reiserfs_path *path,
|
||||
struct item_head * ih, const void * body);
|
||||
|
||||
int reiserfs_locate_entry (reiserfs_filsys_t *, struct key * dir, char * name,
|
||||
struct path * path);
|
||||
int reiserfs_find_entry (reiserfs_filsys_t *, struct key * dir, char * name,
|
||||
unsigned int * min_gen_counter, struct key * key);
|
||||
int reiserfs_add_entry (reiserfs_filsys_t *, struct key * dir, char * name, int name_len,
|
||||
struct key * key, __u16 fsck_need);
|
||||
int reiserfs_locate_entry (reiserfs_filsys_t *, struct reiserfs_key *dir, char * name,
|
||||
struct reiserfs_path *path);
|
||||
int reiserfs_find_entry (reiserfs_filsys_t *, struct reiserfs_key *dir, char * name,
|
||||
unsigned int * min_gen_counter, struct reiserfs_key *key);
|
||||
int reiserfs_add_entry (reiserfs_filsys_t *, struct reiserfs_key *dir, char * name, int name_len,
|
||||
struct reiserfs_key *key, __u16 fsck_need);
|
||||
|
||||
struct key * uget_lkey (struct path * path);
|
||||
struct key * uget_rkey (struct path * path);
|
||||
int reiserfs_search_by_key_3 (reiserfs_filsys_t *, struct key * key,
|
||||
struct path * path);
|
||||
int reiserfs_search_by_key_4 (reiserfs_filsys_t *, struct key * key,
|
||||
struct path * path);
|
||||
int reiserfs_search_by_entry_key (reiserfs_filsys_t *, struct key * key,
|
||||
struct path * path);
|
||||
int usearch_by_position (reiserfs_filsys_t *, struct key * key, int version, struct path * path);
|
||||
struct key * reiserfs_next_key (struct path * path);
|
||||
struct reiserfs_key *uget_lkey (struct reiserfs_path *path);
|
||||
struct reiserfs_key *uget_rkey (struct reiserfs_path *path);
|
||||
int reiserfs_search_by_key_3 (reiserfs_filsys_t *, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path);
|
||||
int reiserfs_search_by_key_4 (reiserfs_filsys_t *, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path);
|
||||
int reiserfs_search_by_entry_key (reiserfs_filsys_t *, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path);
|
||||
int usearch_by_position (reiserfs_filsys_t *, struct reiserfs_key *key, int version, struct reiserfs_path *path);
|
||||
struct reiserfs_key *reiserfs_next_key (struct reiserfs_path *path);
|
||||
void copy_key (void * to, void * from);
|
||||
void copy_short_key (void * to, void * from);
|
||||
void copy_item_head(void * p_v_to, void * p_v_from);
|
||||
int comp_keys (const void * k1, const void * k2);
|
||||
int comp_keys_3 (const void * k1, const void * k2);
|
||||
int comp_short_keys (const void * p_s_key1, const void * p_s_key2);
|
||||
int comp_items (struct item_head * p_s_ih, struct path * p_s_path);
|
||||
int comp_items (struct item_head * p_s_ih, struct reiserfs_path *p_s_path);
|
||||
|
||||
__u32 hash_value (hashf_t func, char * name, int namelen);
|
||||
|
||||
int create_dir_sd (reiserfs_filsys_t * fs,
|
||||
struct path * path, struct key * key,
|
||||
struct reiserfs_path *path, struct reiserfs_key *key,
|
||||
void (*modify_item)(struct item_head *, void *));
|
||||
void make_sure_root_dir_exists (reiserfs_filsys_t * fs,
|
||||
void (*modyfy_item)(struct item_head *, void *),
|
||||
int ih_flags);
|
||||
|
||||
typedef void (*badblock_func_t) (reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
struct reiserfs_path *badblock_path,
|
||||
void *data);
|
||||
|
||||
void mark_badblock(reiserfs_filsys_t *fs, struct path *badblock_path, void *data);
|
||||
void mark_badblock(reiserfs_filsys_t *fs, struct reiserfs_path *badblock_path, void *data);
|
||||
int create_badblock_bitmap (reiserfs_filsys_t * fs, char * badblocks_file);
|
||||
void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet);
|
||||
void badblock_list(reiserfs_filsys_t * fs, badblock_func_t action, void *data);
|
||||
@@ -157,9 +157,9 @@ void badblock_list(reiserfs_filsys_t * fs, badblock_func_t action, void *data);
|
||||
#define reiserfs_bmap_nr(count, blk_size) ((count - 1) / (blk_size * 8) + 1)
|
||||
#define reiserfs_bmap_over(nr) (nr > ((1LL << 16) - 1))
|
||||
|
||||
extern struct key root_dir_key;
|
||||
extern struct key parent_root_dir_key;
|
||||
extern struct key lost_found_dir_key;
|
||||
extern struct reiserfs_key root_dir_key;
|
||||
extern struct reiserfs_key parent_root_dir_key;
|
||||
extern struct reiserfs_key lost_found_dir_key;
|
||||
extern __u16 root_dir_format;
|
||||
extern __u16 lost_found_dir_format;
|
||||
|
||||
@@ -206,7 +206,7 @@ reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp);
|
||||
void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm);
|
||||
|
||||
|
||||
int reiserfs_remove_entry (reiserfs_filsys_t *, struct key * key);
|
||||
int reiserfs_remove_entry (reiserfs_filsys_t *, struct reiserfs_key *key);
|
||||
|
||||
|
||||
|
||||
@@ -262,16 +262,16 @@ typedef void (*item_head_action_t) (struct item_head * ih);
|
||||
|
||||
void for_every_item (struct buffer_head * bh, item_head_action_t action,
|
||||
item_action_t * actions);
|
||||
int key_format (const struct key * key);
|
||||
unsigned long long get_offset (const struct key * key);
|
||||
int key_format (const struct reiserfs_key *key);
|
||||
unsigned long long get_offset (const struct reiserfs_key *key);
|
||||
int uniqueness2type (__u32 uniqueness);
|
||||
__u32 type2uniqueness (int type);
|
||||
int get_type (const struct key * key);
|
||||
char * key_of_what (const struct key * key);
|
||||
int type_unknown (struct key * key);
|
||||
void set_type (int format, struct key * key, int type);
|
||||
void set_offset (int format, struct key * key, loff_t offset);
|
||||
void set_type_and_offset (int format, struct key * key, loff_t offset, int type);
|
||||
int get_type (const struct reiserfs_key *key);
|
||||
char * key_of_what (const struct reiserfs_key *key);
|
||||
int type_unknown (struct reiserfs_key *key);
|
||||
void set_type (int format, struct reiserfs_key *key, int type);
|
||||
void set_offset (int format, struct reiserfs_key *key, loff_t offset);
|
||||
void set_type_and_offset (int format, struct reiserfs_key *key, loff_t offset, int type);
|
||||
|
||||
|
||||
typedef int (*check_unfm_func_t) (reiserfs_filsys_t *, __u32);
|
||||
|
||||
@@ -321,7 +321,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
if ( tb->lbytes >= pos_in_item ) {
|
||||
/* appended item will be in L[0] in whole */
|
||||
int l_n, temp_n;
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
|
||||
/* this bytes number must be appended to the last item of L[h] */
|
||||
l_n = tb->lbytes - pos_in_item;
|
||||
@@ -548,7 +548,7 @@ static int balance_leaf(/*struct reiserfs_transaction_handle *th, */
|
||||
|
||||
int n_shift, n_rem, r_zeros_number;
|
||||
const char * r_body;
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
|
||||
/* Calculate number of bytes which must be shifted from appended item */
|
||||
if ( (n_shift = tb->rbytes - tb->insert_size[0]) < 0 )
|
||||
|
||||
+17
-17
@@ -807,7 +807,7 @@ static void set_parameters (struct tree_balance * tb, int h, int lnum,
|
||||
}
|
||||
}
|
||||
|
||||
static void decrement_key (struct key * p_s_key)
|
||||
static void decrement_key (struct reiserfs_key *p_s_key)
|
||||
{
|
||||
int type;
|
||||
|
||||
@@ -853,10 +853,10 @@ int are_items_mergeable (struct item_head * left, struct item_head * right, int
|
||||
}
|
||||
|
||||
/* get left neighbor of the leaf node */
|
||||
static struct buffer_head * get_left_neighbor (reiserfs_filsys_t * s, struct path * path)
|
||||
static struct buffer_head * get_left_neighbor (reiserfs_filsys_t * s, struct reiserfs_path *path)
|
||||
{
|
||||
struct key key;
|
||||
struct path path_to_left_neighbor;
|
||||
struct reiserfs_key key;
|
||||
struct reiserfs_path path_to_left_neighbor;
|
||||
struct buffer_head * bh;
|
||||
|
||||
copy_key (&key, B_N_PKEY (PATH_PLAST_BUFFER (path), 0));
|
||||
@@ -875,12 +875,12 @@ static struct buffer_head * get_left_neighbor (reiserfs_filsys_t * s, struct pat
|
||||
}
|
||||
|
||||
|
||||
extern struct key MIN_KEY;
|
||||
static struct buffer_head * get_right_neighbor (reiserfs_filsys_t * s, struct path * path)
|
||||
extern struct reiserfs_key MIN_KEY;
|
||||
static struct buffer_head * get_right_neighbor (reiserfs_filsys_t * s, struct reiserfs_path *path)
|
||||
{
|
||||
struct key key;
|
||||
struct key * rkey;
|
||||
struct path path_to_right_neighbor;
|
||||
struct reiserfs_key key;
|
||||
struct reiserfs_key *rkey;
|
||||
struct reiserfs_path path_to_right_neighbor;
|
||||
struct buffer_head * bh;
|
||||
|
||||
rkey = get_rkey (path, s);
|
||||
@@ -902,7 +902,7 @@ static struct buffer_head * get_right_neighbor (reiserfs_filsys_t * s, struct pa
|
||||
}
|
||||
|
||||
|
||||
int is_left_mergeable (reiserfs_filsys_t * s, struct path * path)
|
||||
int is_left_mergeable (reiserfs_filsys_t * s, struct reiserfs_path *path)
|
||||
{
|
||||
struct item_head * right;
|
||||
struct buffer_head * bh;
|
||||
@@ -920,7 +920,7 @@ int is_left_mergeable (reiserfs_filsys_t * s, struct path * path)
|
||||
}
|
||||
|
||||
|
||||
int is_right_mergeable (reiserfs_filsys_t * s, struct path * path)
|
||||
int is_right_mergeable (reiserfs_filsys_t * s, struct reiserfs_path *path)
|
||||
{
|
||||
struct item_head * left;
|
||||
struct buffer_head * bh;
|
||||
@@ -1231,7 +1231,7 @@ static int is_left_neighbor_in_cache (struct tree_balance * p_s_tb,
|
||||
|
||||
|
||||
|
||||
void init_path (struct path * path)
|
||||
void init_path (struct reiserfs_path *path)
|
||||
{
|
||||
path->path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
|
||||
}
|
||||
@@ -1252,9 +1252,9 @@ static int get_far_parent (struct tree_balance * p_s_tb,
|
||||
char c_lr_par)
|
||||
{
|
||||
struct buffer_head * p_s_parent;
|
||||
struct path s_path_to_neighbor_father,
|
||||
struct reiserfs_path s_path_to_neighbor_father,
|
||||
* p_s_path = p_s_tb->tb_path;
|
||||
struct key s_lr_father_key;
|
||||
struct reiserfs_key s_lr_father_key;
|
||||
int n_counter,
|
||||
n_position = -1,
|
||||
n_first_last_position = 0,
|
||||
@@ -1341,7 +1341,7 @@ static int get_far_parent (struct tree_balance * p_s_tb,
|
||||
*/
|
||||
static int get_parents (struct tree_balance * p_s_tb, int n_h)
|
||||
{
|
||||
struct path * p_s_path = p_s_tb->tb_path;
|
||||
struct reiserfs_path * p_s_path = p_s_tb->tb_path;
|
||||
int n_position,
|
||||
n_ret_value,
|
||||
n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h);
|
||||
@@ -2048,7 +2048,7 @@ static int check_balance (int mode, struct tree_balance * tb,
|
||||
static void get_direct_parent (struct tree_balance * p_s_tb, int n_h)
|
||||
{
|
||||
struct buffer_head * p_s_bh;
|
||||
struct path * p_s_path = p_s_tb->tb_path;
|
||||
struct reiserfs_path * p_s_path = p_s_tb->tb_path;
|
||||
int n_position,
|
||||
n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h);
|
||||
|
||||
@@ -2264,7 +2264,7 @@ int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb,
|
||||
|
||||
void unfix_nodes (struct tree_balance * p_s_tb)
|
||||
{
|
||||
struct path * p_s_path = p_s_tb->tb_path;
|
||||
struct reiserfs_path *p_s_path = p_s_tb->tb_path;
|
||||
int n_counter;
|
||||
// int i, j;
|
||||
//struct buffer_head * bh;
|
||||
|
||||
@@ -107,7 +107,7 @@ static void internal_insert_childs (reiserfs_filsys_t * fs,
|
||||
struct buffer_head * cur = cur_bi->bi_bh;
|
||||
struct block_head * blkh;
|
||||
int nr;
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
struct disk_child new_dc[2];
|
||||
struct disk_child * dc;
|
||||
int i;
|
||||
@@ -173,7 +173,7 @@ static void internal_delete_pointers_items (reiserfs_filsys_t * fs,
|
||||
struct buffer_head * cur = cur_bi->bi_bh;
|
||||
int nr;
|
||||
struct block_head * blkh;
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
struct disk_child * dc;
|
||||
|
||||
if ( del_num == 0 )
|
||||
@@ -241,7 +241,7 @@ static void internal_copy_pointers_items (reiserfs_filsys_t * fs,
|
||||
int nr_dest, nr_src;
|
||||
int dest_order, src_order;
|
||||
struct block_head * blkh;
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
struct disk_child * dc;
|
||||
|
||||
nr_src = B_NR_ITEMS (src);
|
||||
@@ -331,7 +331,7 @@ static void internal_insert_key (reiserfs_filsys_t * fs,
|
||||
struct buffer_head * dest = dest_bi->bi_bh;
|
||||
int nr;
|
||||
struct block_head * blkh;
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
|
||||
blkh = B_BLK_HEAD(dest);
|
||||
nr = get_blkh_nr_items (blkh);
|
||||
|
||||
+12
-12
@@ -865,7 +865,7 @@ typedef union {
|
||||
__u64 linear;
|
||||
} __attribute__ ((__packed__)) offset_v2_esafe_overlay;
|
||||
|
||||
static inline __u64 get_key_offset_v2 (const struct key *key)
|
||||
static inline __u64 get_key_offset_v2 (const struct reiserfs_key *key)
|
||||
{
|
||||
offset_v2_esafe_overlay tmp =
|
||||
*(offset_v2_esafe_overlay *) (&(key->u.k2_offset_v2));
|
||||
@@ -873,7 +873,7 @@ static inline __u64 get_key_offset_v2 (const struct key *key)
|
||||
return tmp.offset_v2.k_offset;
|
||||
}
|
||||
|
||||
static inline __u32 get_key_type_v2 (const struct key *key)
|
||||
static inline __u32 get_key_type_v2 (const struct reiserfs_key *key)
|
||||
{
|
||||
offset_v2_esafe_overlay tmp =
|
||||
*(offset_v2_esafe_overlay *) (&(key->u.k2_offset_v2));
|
||||
@@ -881,7 +881,7 @@ static inline __u32 get_key_type_v2 (const struct key *key)
|
||||
return tmp.offset_v2.k_type;
|
||||
}
|
||||
|
||||
static inline void set_key_offset_v2 (struct key *key, __u64 offset)
|
||||
static inline void set_key_offset_v2 (struct reiserfs_key *key, __u64 offset)
|
||||
{
|
||||
offset_v2_esafe_overlay *tmp =
|
||||
(offset_v2_esafe_overlay *)(&(key->u.k2_offset_v2));
|
||||
@@ -890,7 +890,7 @@ static inline void set_key_offset_v2 (struct key *key, __u64 offset)
|
||||
tmp->linear = cpu_to_le64(tmp->linear);
|
||||
}
|
||||
|
||||
static inline void set_key_type_v2 (struct key *key, __u32 type)
|
||||
static inline void set_key_type_v2 (struct reiserfs_key *key, __u32 type)
|
||||
{
|
||||
offset_v2_esafe_overlay *tmp =
|
||||
(offset_v2_esafe_overlay *)(&(key->u.k2_offset_v2));
|
||||
@@ -913,7 +913,7 @@ static inline int is_key_format_1 (int type) {
|
||||
indirect) or == 0 (dir items and stat data) */
|
||||
|
||||
/* */
|
||||
int key_format (const struct key * key)
|
||||
int key_format (const struct reiserfs_key *key)
|
||||
{
|
||||
int type;
|
||||
|
||||
@@ -926,7 +926,7 @@ int key_format (const struct key * key)
|
||||
}
|
||||
|
||||
|
||||
unsigned long long get_offset (const struct key * key) {
|
||||
unsigned long long get_offset (const struct reiserfs_key *key) {
|
||||
if (key_format (key) == KEY_FORMAT_1)
|
||||
return get_key_offset_v1 (key);
|
||||
|
||||
@@ -958,7 +958,7 @@ __u32 type2uniqueness (int type)
|
||||
}
|
||||
|
||||
|
||||
int get_type (const struct key * key)
|
||||
int get_type (const struct reiserfs_key *key)
|
||||
{
|
||||
int type_v2 = get_key_type_v2 (key);
|
||||
|
||||
@@ -969,7 +969,7 @@ int get_type (const struct key * key)
|
||||
}
|
||||
|
||||
|
||||
char * key_of_what (const struct key * key)
|
||||
char * key_of_what (const struct reiserfs_key *key)
|
||||
{
|
||||
switch (get_type (key)) {
|
||||
case TYPE_STAT_DATA: return "SD";
|
||||
@@ -981,7 +981,7 @@ char * key_of_what (const struct key * key)
|
||||
}
|
||||
|
||||
|
||||
int type_unknown (struct key * key)
|
||||
int type_unknown (struct reiserfs_key *key)
|
||||
{
|
||||
int type = get_type (key);
|
||||
|
||||
@@ -1000,7 +1000,7 @@ int type_unknown (struct key * key)
|
||||
|
||||
// this sets key format as well as type of item key belongs to
|
||||
//
|
||||
void set_type (int format, struct key * key, int type)
|
||||
void set_type (int format, struct reiserfs_key *key, int type)
|
||||
{
|
||||
if (format == KEY_FORMAT_1)
|
||||
set_key_uniqueness (key, type2uniqueness (type));
|
||||
@@ -1010,7 +1010,7 @@ void set_type (int format, struct key * key, int type)
|
||||
|
||||
|
||||
//
|
||||
void set_offset (int format, struct key * key, loff_t offset)
|
||||
void set_offset (int format, struct reiserfs_key *key, loff_t offset)
|
||||
{
|
||||
if (format == KEY_FORMAT_1)
|
||||
set_key_offset_v1 (key, offset);
|
||||
@@ -1020,7 +1020,7 @@ void set_offset (int format, struct key * key, loff_t offset)
|
||||
}
|
||||
|
||||
|
||||
void set_type_and_offset (int format, struct key * key, loff_t offset, int type)
|
||||
void set_type_and_offset (int format, struct reiserfs_key *key, loff_t offset, int type)
|
||||
{
|
||||
set_type (format, key, type);
|
||||
set_offset (format, key, offset);
|
||||
|
||||
@@ -65,11 +65,11 @@ static int print_short_key (FILE * stream,
|
||||
const struct printf_info *info,
|
||||
const void *const *args)
|
||||
{
|
||||
const struct key * key;
|
||||
const struct reiserfs_key *key;
|
||||
char * buffer;
|
||||
int len;
|
||||
|
||||
key = *((const struct key **)(args[0]));
|
||||
key = *((const struct reiserfs_key **)(args[0]));
|
||||
len = asprintf (&buffer, "[%u %u]", get_key_dirid (key),
|
||||
get_key_objectid (key));
|
||||
FPRINTF;
|
||||
@@ -81,11 +81,11 @@ static int print_key (FILE * stream,
|
||||
const struct printf_info *info,
|
||||
const void *const *args)
|
||||
{
|
||||
const struct key * key;
|
||||
const struct reiserfs_key *key;
|
||||
char * buffer;
|
||||
int len;
|
||||
|
||||
key = *((const struct key **)(args[0]));
|
||||
key = *((const struct reiserfs_key **)(args[0]));
|
||||
len = asprintf (&buffer, "[%u %u 0x%Lx %s (%d)]",
|
||||
get_key_dirid (key), get_key_objectid (key),
|
||||
(unsigned long long)get_offset (key), key_of_what (key), get_type (key));
|
||||
@@ -257,7 +257,7 @@ void print_virtual_node (struct virtual_node * vn)
|
||||
}
|
||||
|
||||
|
||||
void print_path (struct tree_balance * tb, struct path * path)
|
||||
void print_path (struct tree_balance * tb, struct reiserfs_path *path)
|
||||
{
|
||||
int offset = path->path_length;
|
||||
struct buffer_head * bh;
|
||||
@@ -306,7 +306,7 @@ void print_directory_item (FILE * fp, reiserfs_filsys_t * fs,
|
||||
name = name_in_entry (deh, i);
|
||||
reiserfs_warning (fp, "%3d: \"%-25.*s\"(%3d)%20K%12d%5d, loc %u, state %x %s\n",
|
||||
i, namelen, name, namelen,
|
||||
(struct key *)&(deh->deh2_dir_id),
|
||||
(struct reiserfs_key *)&(deh->deh2_dir_id),
|
||||
GET_HASH_VALUE (get_deh_offset (deh)),
|
||||
GET_GENERATION_NUMBER (get_deh_offset (deh)),
|
||||
get_deh_location (deh), get_deh_state (deh),
|
||||
@@ -451,7 +451,7 @@ void reiserfs_print_item (FILE * fp, struct buffer_head * bh,
|
||||
dc_size)...*/
|
||||
static int print_internal (FILE * fp, struct buffer_head * bh, int first, int last)
|
||||
{
|
||||
struct key * key;
|
||||
struct reiserfs_key *key;
|
||||
struct disk_child * dc;
|
||||
int i;
|
||||
int from, to;
|
||||
|
||||
+48
-48
@@ -9,10 +9,10 @@
|
||||
#include <linux/kdev_t.h>
|
||||
#include <time.h>
|
||||
|
||||
struct key root_dir_key = {0, 0, {{0, 0},}};
|
||||
struct key parent_root_dir_key = {0, 0, {{0, 0},}};
|
||||
struct key lost_found_dir_key = {0, 0, {{0, 0}, }};
|
||||
struct key badblock_key = {BADBLOCK_DIRID, BADBLOCK_OBJID, {{0, 0},}};
|
||||
struct reiserfs_key root_dir_key = {0, 0, {{0, 0},}};
|
||||
struct reiserfs_key parent_root_dir_key = {0, 0, {{0, 0},}};
|
||||
struct reiserfs_key lost_found_dir_key = {0, 0, {{0, 0}, }};
|
||||
struct reiserfs_key badblock_key = {BADBLOCK_DIRID, BADBLOCK_OBJID, {{0, 0},}};
|
||||
|
||||
__u16 root_dir_format = 0;
|
||||
__u16 lost_found_dir_format = 0;
|
||||
@@ -440,12 +440,12 @@ int reiserfs_free_block (reiserfs_filsys_t * fs, unsigned long block)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reiserfs_search_by_key_x (reiserfs_filsys_t * fs, struct key * key,
|
||||
struct path * path, int key_length)
|
||||
static int reiserfs_search_by_key_x (reiserfs_filsys_t * fs, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path, int key_length)
|
||||
{
|
||||
struct buffer_head * bh;
|
||||
unsigned long block;
|
||||
struct path_element * curr;
|
||||
struct reiserfs_path_element * curr;
|
||||
int retval;
|
||||
|
||||
|
||||
@@ -488,15 +488,15 @@ static int reiserfs_search_by_key_x (reiserfs_filsys_t * fs, struct key * key,
|
||||
}
|
||||
|
||||
|
||||
int reiserfs_search_by_key_3 (reiserfs_filsys_t * fs, struct key * key,
|
||||
struct path * path)
|
||||
int reiserfs_search_by_key_3 (reiserfs_filsys_t * fs, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path)
|
||||
{
|
||||
return reiserfs_search_by_key_x (fs, key, path, 3);
|
||||
}
|
||||
|
||||
|
||||
int reiserfs_search_by_key_4 (reiserfs_filsys_t * fs, struct key * key,
|
||||
struct path * path)
|
||||
int reiserfs_search_by_key_4 (reiserfs_filsys_t * fs, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path)
|
||||
{
|
||||
return reiserfs_search_by_key_x (fs, key, path, 4);
|
||||
}
|
||||
@@ -504,12 +504,12 @@ int reiserfs_search_by_key_4 (reiserfs_filsys_t * fs, struct key * key,
|
||||
|
||||
/* key is key of byte in the regular file. This searches in tree
|
||||
through items and in the found item as well */
|
||||
int usearch_by_position (reiserfs_filsys_t * s, struct key * key,
|
||||
int version, struct path * path)
|
||||
int usearch_by_position (reiserfs_filsys_t * s, struct reiserfs_key *key,
|
||||
int version, struct reiserfs_path *path)
|
||||
{
|
||||
struct buffer_head * bh;
|
||||
struct item_head * ih;
|
||||
struct key * next_key;
|
||||
struct reiserfs_key *next_key;
|
||||
|
||||
if (reiserfs_search_by_key_3 (s, key, path) == ITEM_FOUND) {
|
||||
ih = get_ih (path);
|
||||
@@ -601,7 +601,7 @@ static int comp_dir_entries (const void * p1, const void * p2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct key * uget_lkey (struct path * path)
|
||||
struct reiserfs_key *uget_lkey (struct reiserfs_path *path)
|
||||
{
|
||||
int pos, offset = path->path_length;
|
||||
struct buffer_head * bh;
|
||||
@@ -637,7 +637,7 @@ struct key * uget_lkey (struct path * path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct key * uget_rkey (struct path * path)
|
||||
struct reiserfs_key *uget_rkey (struct reiserfs_path *path)
|
||||
{
|
||||
int pos, offset = path->path_length;
|
||||
struct buffer_head * bh;
|
||||
@@ -671,7 +671,7 @@ struct key * uget_rkey (struct path * path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct key * reiserfs_next_key (struct path * path) {
|
||||
struct reiserfs_key *reiserfs_next_key (struct reiserfs_path *path) {
|
||||
if (get_item_pos (path) < B_NR_ITEMS (get_bh (path)) - 1)
|
||||
return B_N_PKEY (get_bh (path), get_item_pos (path) + 1);
|
||||
|
||||
@@ -680,13 +680,13 @@ struct key * reiserfs_next_key (struct path * path) {
|
||||
|
||||
|
||||
/* NOTE: this only should be used to look for keys who exists */
|
||||
int reiserfs_search_by_entry_key (reiserfs_filsys_t * fs, struct key * key,
|
||||
struct path * path)
|
||||
int reiserfs_search_by_entry_key (reiserfs_filsys_t * fs, struct reiserfs_key *key,
|
||||
struct reiserfs_path *path)
|
||||
{
|
||||
struct buffer_head * bh;
|
||||
int item_pos;
|
||||
struct item_head * ih;
|
||||
struct key tmpkey;
|
||||
struct reiserfs_key tmpkey;
|
||||
__u32 offset;
|
||||
|
||||
if (reiserfs_search_by_key_4 (fs, key, path) == ITEM_FOUND) {
|
||||
@@ -740,7 +740,7 @@ int reiserfs_search_by_entry_key (reiserfs_filsys_t * fs, struct key * key,
|
||||
key);
|
||||
} else {
|
||||
/* next item is in right neighboring node */
|
||||
struct key * next_key = uget_rkey (path);
|
||||
struct reiserfs_key *next_key = uget_rkey (path);
|
||||
|
||||
if (next_key == 0 || not_of_one_file (next_key, key)) {
|
||||
/* there are no items of that directory */
|
||||
@@ -777,7 +777,7 @@ int reiserfs_search_by_entry_key (reiserfs_filsys_t * fs, struct key * key,
|
||||
|
||||
|
||||
void init_tb_struct (struct tree_balance * tb, reiserfs_filsys_t * fs,
|
||||
struct path * path, int size)
|
||||
struct reiserfs_path *path, int size)
|
||||
{
|
||||
memset (tb, '\0', sizeof(struct tree_balance));
|
||||
tb->tb_fs = fs;
|
||||
@@ -789,9 +789,9 @@ void init_tb_struct (struct tree_balance * tb, reiserfs_filsys_t * fs,
|
||||
}
|
||||
|
||||
|
||||
int reiserfs_remove_entry (reiserfs_filsys_t * fs, struct key * key)
|
||||
int reiserfs_remove_entry (reiserfs_filsys_t * fs, struct reiserfs_key *key)
|
||||
{
|
||||
struct path path;
|
||||
struct reiserfs_path path;
|
||||
struct tree_balance tb;
|
||||
struct item_head * ih;
|
||||
struct reiserfs_de_head * deh;
|
||||
@@ -824,7 +824,7 @@ int reiserfs_remove_entry (reiserfs_filsys_t * fs, struct key * key)
|
||||
|
||||
|
||||
|
||||
void reiserfs_paste_into_item (reiserfs_filsys_t * fs, struct path * path,
|
||||
void reiserfs_paste_into_item (reiserfs_filsys_t * fs, struct reiserfs_path *path,
|
||||
const void * body, int size)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
@@ -838,7 +838,7 @@ void reiserfs_paste_into_item (reiserfs_filsys_t * fs, struct path * path,
|
||||
}
|
||||
|
||||
|
||||
void reiserfs_insert_item (reiserfs_filsys_t * fs, struct path * path,
|
||||
void reiserfs_insert_item (reiserfs_filsys_t * fs, struct reiserfs_path *path,
|
||||
struct item_head * ih, const void * body)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
@@ -868,14 +868,14 @@ __u32 hash_value (hashf_t func, char * name, int namelen)
|
||||
|
||||
/* if name is found in a directory - return 1 and set path to the name,
|
||||
otherwise return 0 and pathrelse path */
|
||||
int reiserfs_locate_entry (reiserfs_filsys_t * fs, struct key * dir, char * name,
|
||||
struct path * path)
|
||||
int reiserfs_locate_entry (reiserfs_filsys_t * fs, struct reiserfs_key *dir, char * name,
|
||||
struct reiserfs_path *path)
|
||||
{
|
||||
struct key entry_key;
|
||||
struct reiserfs_key entry_key;
|
||||
struct item_head * ih;
|
||||
struct reiserfs_de_head * deh;
|
||||
int i, retval;
|
||||
struct key * rdkey;
|
||||
struct reiserfs_key *rdkey;
|
||||
|
||||
set_key_dirid (&entry_key, get_key_dirid (dir));
|
||||
set_key_objectid (&entry_key, get_key_objectid (dir));
|
||||
@@ -927,16 +927,16 @@ int reiserfs_locate_entry (reiserfs_filsys_t * fs, struct key * dir, char * name
|
||||
found. Stores key found in the entry in 'key'. Returns minimal not used
|
||||
generation counter in 'min_gen_counter'. dies if found object is not a
|
||||
directory. */
|
||||
int reiserfs_find_entry (reiserfs_filsys_t * fs, struct key * dir, char * name,
|
||||
unsigned int * min_gen_counter, struct key * key)
|
||||
int reiserfs_find_entry (reiserfs_filsys_t * fs, struct reiserfs_key *dir, char * name,
|
||||
unsigned int * min_gen_counter, struct reiserfs_key *key)
|
||||
{
|
||||
struct key entry_key;
|
||||
struct reiserfs_key entry_key;
|
||||
int retval;
|
||||
int i;
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
struct item_head * ih;
|
||||
struct reiserfs_de_head * deh;
|
||||
struct key * rdkey;
|
||||
struct reiserfs_key *rdkey;
|
||||
__u32 hash;
|
||||
|
||||
|
||||
@@ -975,7 +975,7 @@ int reiserfs_find_entry (reiserfs_filsys_t * fs, struct key * dir, char * name,
|
||||
(!memcmp (name_in_entry (deh, i), name, strlen (name)))) {
|
||||
/* entry found in the directory */
|
||||
if (key) {
|
||||
memset (key, 0, sizeof (struct key));
|
||||
memset (key, 0, sizeof (struct reiserfs_key));
|
||||
set_key_dirid (key, get_deh_dirid (deh));
|
||||
set_key_objectid (key, get_deh_objectid (deh));
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ int reiserfs_find_entry (reiserfs_filsys_t * fs, struct key * dir, char * name,
|
||||
|
||||
|
||||
/* compose directory entry: dir entry head and name itself */
|
||||
char * make_entry (char * entry, char * name, struct key * key, __u32 offset)
|
||||
char * make_entry (char * entry, char * name, struct reiserfs_key *key, __u32 offset)
|
||||
{
|
||||
struct reiserfs_de_head * deh;
|
||||
__u16 state;
|
||||
@@ -1041,13 +1041,13 @@ char * make_entry (char * entry, char * name, struct key * key, __u32 offset)
|
||||
|
||||
/* add new name into a directory. If it exists in a directory - do
|
||||
nothing */
|
||||
int reiserfs_add_entry (reiserfs_filsys_t * fs, struct key * dir, char * name, int name_len,
|
||||
struct key * key, __u16 fsck_need)
|
||||
int reiserfs_add_entry (reiserfs_filsys_t * fs, struct reiserfs_key *dir, char * name, int name_len,
|
||||
struct reiserfs_key *key, __u16 fsck_need)
|
||||
{
|
||||
struct item_head entry_ih = {{0,}, };
|
||||
char * entry;
|
||||
int retval;
|
||||
INITIALIZE_PATH(path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
unsigned int gen_counter;
|
||||
int item_len;
|
||||
__u32 hash;
|
||||
@@ -1130,7 +1130,7 @@ void copy_item_head(void * p_v_to, void * p_v_from)
|
||||
|
||||
/* inserts new or old stat data of a directory (unreachable, nlinks == 0) */
|
||||
int create_dir_sd (reiserfs_filsys_t * fs,
|
||||
struct path * path, struct key * key,
|
||||
struct reiserfs_path *path, struct reiserfs_key *key,
|
||||
void (*modify_item)(struct item_head *, void *))
|
||||
{
|
||||
struct item_head ih;
|
||||
@@ -1176,7 +1176,7 @@ void make_sure_root_dir_exists (reiserfs_filsys_t * fs,
|
||||
void (*modify_item)(struct item_head *, void *),
|
||||
int ih_flags)
|
||||
{
|
||||
INITIALIZE_PATH (path);
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
|
||||
|
||||
/* is there root's stat data */
|
||||
@@ -1308,9 +1308,9 @@ int create_badblock_bitmap (reiserfs_filsys_t * fs, char * badblocks_file) {
|
||||
}
|
||||
|
||||
void badblock_list(reiserfs_filsys_t * fs, badblock_func_t action, void *data) {
|
||||
struct path badblock_path;
|
||||
struct key rd_key = badblock_key;
|
||||
struct key *key;
|
||||
struct reiserfs_path badblock_path;
|
||||
struct reiserfs_key rd_key = badblock_key;
|
||||
struct reiserfs_key *key;
|
||||
|
||||
badblock_path.path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
|
||||
set_type_and_offset (KEY_FORMAT_2, &badblock_key, 1, TYPE_INDIRECT);
|
||||
@@ -1355,7 +1355,7 @@ void badblock_list(reiserfs_filsys_t * fs, badblock_func_t action, void *data) {
|
||||
}
|
||||
|
||||
static void callback_badblock_rm(reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
struct reiserfs_path *badblock_path,
|
||||
void *data)
|
||||
{
|
||||
struct tree_balance tb;
|
||||
@@ -1374,7 +1374,7 @@ static void callback_badblock_rm(reiserfs_filsys_t *fs,
|
||||
}
|
||||
|
||||
void mark_badblock(reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
struct reiserfs_path *badblock_path,
|
||||
void *data)
|
||||
{
|
||||
struct item_head *tmp_ih;
|
||||
@@ -1397,7 +1397,7 @@ void mark_badblock(reiserfs_filsys_t *fs,
|
||||
|
||||
void add_badblock_list (reiserfs_filsys_t * fs, int replace) {
|
||||
struct tree_balance tb;
|
||||
struct path badblock_path;
|
||||
struct reiserfs_path badblock_path;
|
||||
struct item_head badblock_ih;
|
||||
__u32 ni;
|
||||
|
||||
|
||||
+16
-16
@@ -75,8 +75,8 @@ int comp_short_keys (const void * k1, const void * k2)
|
||||
int comp_keys_3 (const void * p1, const void * p2)
|
||||
{
|
||||
int retval;
|
||||
const struct key * k1 = p1;
|
||||
const struct key * k2 = p2;
|
||||
const struct reiserfs_key *k1 = p1;
|
||||
const struct reiserfs_key *k2 = p2;
|
||||
loff_t off1, off2;
|
||||
|
||||
retval = comp_short_keys (k1, k2);
|
||||
@@ -103,8 +103,8 @@ int comp_keys_3 (const void * p1, const void * p2)
|
||||
int comp_keys (const void * p1, const void * p2)
|
||||
{
|
||||
int retval;
|
||||
const struct key * k1 = p1;
|
||||
const struct key * k2 = p2;
|
||||
const struct reiserfs_key *k1 = p1;
|
||||
const struct reiserfs_key *k2 = p2;
|
||||
__u32 u1, u2;
|
||||
|
||||
retval = comp_keys_3 (k1, k2);
|
||||
@@ -156,7 +156,7 @@ int bin_search (
|
||||
int n_rbound, n_lbound, n_j;
|
||||
|
||||
for ( n_j = ((n_rbound = p_n_num - 1) + (n_lbound = 0))/2; n_lbound <= n_rbound; n_j = (n_rbound + n_lbound)/2 )
|
||||
switch( COMP_KEYS((struct key *)((char * )p_v_base + n_j * p_n_width), p_v_key) ) {
|
||||
switch( COMP_KEYS((struct reiserfs_key *)((char * )p_v_base + n_j * p_n_width), p_v_key) ) {
|
||||
case -1: n_lbound = n_j + 1; continue;
|
||||
case 1: n_rbound = n_j - 1; continue;
|
||||
case 0: *p_n_pos = n_j; return ITEM_FOUND; /* Key found in the array. */
|
||||
@@ -169,10 +169,10 @@ int bin_search (
|
||||
}
|
||||
|
||||
/* Minimal possible key. It is never in the tree. */
|
||||
struct key MIN_KEY = {0, 0, {{0, 0},}};
|
||||
struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}};
|
||||
|
||||
/* Maximal possible key. It is never in the tree. */
|
||||
struct key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
|
||||
struct reiserfs_key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
|
||||
|
||||
|
||||
/* Get delimiting key of the buffer by looking for it in the buffers in the
|
||||
@@ -181,7 +181,7 @@ struct key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
|
||||
there is no delimiting key in the tree (buffer is first or last buffer in
|
||||
tree), and in this case we return a special key, either MIN_KEY or
|
||||
MAX_KEY. */
|
||||
struct key * get_lkey (struct path * p_s_chk_path,
|
||||
struct reiserfs_key *get_lkey (struct reiserfs_path *p_s_chk_path,
|
||||
reiserfs_filsys_t * fs)
|
||||
{
|
||||
struct reiserfs_super_block * sb;
|
||||
@@ -215,7 +215,7 @@ struct key * get_lkey (struct path * p_s_chk_path,
|
||||
|
||||
|
||||
/* Get delimiting key of the buffer at the path and its right neighbor. */
|
||||
struct key * get_rkey (struct path * p_s_chk_path,
|
||||
struct reiserfs_key *get_rkey (struct reiserfs_path *p_s_chk_path,
|
||||
reiserfs_filsys_t * fs)
|
||||
{
|
||||
struct reiserfs_super_block * sb;
|
||||
@@ -256,8 +256,8 @@ struct key * get_rkey (struct path * p_s_chk_path,
|
||||
may be absent, and in this case get_lkey and get_rkey return a special key
|
||||
which is MIN_KEY or MAX_KEY. */
|
||||
static inline int key_in_buffer (
|
||||
struct path * p_s_chk_path, /* Path which should be checked. */
|
||||
struct key * p_s_key, /* Key which should be checked. */
|
||||
struct reiserfs_path * p_s_chk_path, /* Path which should be checked. */
|
||||
struct reiserfs_key * p_s_key, /* Key which should be checked. */
|
||||
reiserfs_filsys_t * fs /* Super block pointer. */
|
||||
) {
|
||||
|
||||
@@ -269,7 +269,7 @@ static inline int key_in_buffer (
|
||||
}
|
||||
|
||||
/* Release all buffers in the path. */
|
||||
void pathrelse (struct path * p_s_search_path)
|
||||
void pathrelse (struct reiserfs_path *p_s_search_path)
|
||||
{
|
||||
int n_path_offset = p_s_search_path->path_length;
|
||||
|
||||
@@ -303,8 +303,8 @@ void pathrelse (struct path * p_s_search_path)
|
||||
correctness of the top of the path but need not be checked for the
|
||||
correctness of the bottom of the path */
|
||||
int search_by_key (reiserfs_filsys_t * fs,
|
||||
struct key * p_s_key, /* Key to search */
|
||||
struct path * p_s_search_path,/* This structure was
|
||||
struct reiserfs_key *p_s_key, /* Key to search */
|
||||
struct reiserfs_path *p_s_search_path,/* This structure was
|
||||
allocated and
|
||||
initialized by the
|
||||
calling
|
||||
@@ -318,7 +318,7 @@ int search_by_key (reiserfs_filsys_t * fs,
|
||||
expected_level,
|
||||
n_block_size = fs->fs_blocksize;
|
||||
struct buffer_head * p_s_bh;
|
||||
struct path_element * p_s_last_element;
|
||||
struct reiserfs_path_element * p_s_last_element;
|
||||
int n_retval;
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ int search_by_key (reiserfs_filsys_t * fs,
|
||||
|
||||
|
||||
int bin_search_in_dir_item (struct item_head * ih, struct reiserfs_de_head * deh,
|
||||
struct key * key, int * pos_in_item)
|
||||
struct reiserfs_key *key, int * pos_in_item)
|
||||
{
|
||||
int rbound, lbound, j;
|
||||
|
||||
|
||||
+2
-2
@@ -272,7 +272,7 @@ static void set_time_last_checked(char *str)
|
||||
}
|
||||
|
||||
static void callback_new_badblocks(reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
struct reiserfs_path *badblock_path,
|
||||
void *data)
|
||||
{
|
||||
struct item_head *tmp_ih;
|
||||
@@ -297,7 +297,7 @@ static void callback_new_badblocks(reiserfs_filsys_t *fs,
|
||||
}
|
||||
|
||||
static void callback_clear_badblocks(reiserfs_filsys_t *fs,
|
||||
struct path *badblock_path,
|
||||
struct reiserfs_path *badblock_path,
|
||||
void *data)
|
||||
{
|
||||
struct item_head *tmp_ih;
|
||||
|
||||
Reference in new issue
Block a user