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:
Jeff Mahoney committed 2013-08-26 17:12:09 -04:00
1 parent a465518a51
commit b23d40f723
25 files changed
+339 -339

No files matched your search

+10 -10
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;