reiserfsprogs: convert reiserfs_filsys_t from structure to pointer-to-structure

This makes it more consistent with e2fsprogs.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
Jeff Mahoney committed 2013-08-26 19:02:20 -04:00
1 parent 81aeadf510
commit 97fa944851
37 files changed
+393 -393

No files matched your search

+12 -12
View File
@@ -11,7 +11,7 @@ extern struct reiserfs_fsstat g_stat_info;
int do_one_ih_corrupt(struct item_head *ih, unsigned int nr_bytes); int do_one_ih_corrupt(struct item_head *ih, unsigned int nr_bytes);
int do_one_ih_random_corrupt(struct item_head *ih); int do_one_ih_random_corrupt(struct item_head *ih);
void do_one_corruption_in_one_block(reiserfs_filsys_t *fs, void do_one_corruption_in_one_block(reiserfs_filsys_t fs,
struct buffer_head *bh, struct buffer_head *bh,
char *corruption_command); char *corruption_command);
int corrupt_block_header(struct block_head *blkh, unsigned int offset, int corrupt_block_header(struct block_head *blkh, unsigned int offset,
@@ -93,7 +93,7 @@ static void edit_journal_params(struct journal_params *jp)
} }
/* this allows to edit all super block fields */ /* this allows to edit all super block fields */
static void edit_super_block(reiserfs_filsys_t *fs) static void edit_super_block(reiserfs_filsys_t fs)
{ {
char *str; char *str;
size_t n; size_t n;
@@ -236,7 +236,7 @@ static void corrupt_clobber_hash(char *name, struct item_head *ih,
start from offset start from offset
*/ */
void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline) void do_corrupt_one_block(reiserfs_filsys_t fs, char *fline)
{ {
struct buffer_head *bh; struct buffer_head *bh;
char *line = NULL; char *line = NULL;
@@ -341,7 +341,7 @@ void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline)
return; return;
} }
void do_one_corruption_in_one_block(reiserfs_filsys_t *fs, void do_one_corruption_in_one_block(reiserfs_filsys_t fs,
struct buffer_head *bh, struct buffer_head *bh,
char *corruption_command) char *corruption_command)
{ {
@@ -766,7 +766,7 @@ static void do_one_blkh_random_corrupt(struct buffer_head *bh)
} }
void do_leaves_corruption(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr) void do_leaves_corruption(reiserfs_filsys_t fs, unsigned long nr_leaves_cr)
{ {
struct buffer_head *bh; struct buffer_head *bh;
unsigned long nr_leaves = 0; unsigned long nr_leaves = 0;
@@ -853,7 +853,7 @@ void do_one_block_random_corrupt(struct buffer_head *bh)
} }
void do_bitmap_corruption(reiserfs_filsys_t *fs) void do_bitmap_corruption(reiserfs_filsys_t fs)
{ {
unsigned long first = fs->fs_super_bh->b_blocknr + 1; unsigned long first = fs->fs_super_bh->b_blocknr + 1;
@@ -889,7 +889,7 @@ void do_bitmap_corruption(reiserfs_filsys_t *fs)
} }
/* corrupt the random number of item headers in random number of leaves */ /* corrupt the random number of item headers in random number of leaves */
static void do_ih_random_corrupt(reiserfs_filsys_t *fs, static void do_ih_random_corrupt(reiserfs_filsys_t fs,
unsigned long nr_leaves_cr) unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
@@ -1003,7 +1003,7 @@ static void do_one_item_random_corrupt(struct buffer_head *bh,
} }
/* corrupt the random number of directory items in random number of leaves */ /* corrupt the random number of directory items in random number of leaves */
static void do_dir_random_corrupt(reiserfs_filsys_t *fs, static void do_dir_random_corrupt(reiserfs_filsys_t fs,
unsigned long nr_leaves_cr) unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
@@ -1089,7 +1089,7 @@ static void do_dir_random_corrupt(reiserfs_filsys_t *fs,
} }
/* corrupt the random number of stat data items in random number of leaves */ /* corrupt the random number of stat data items in random number of leaves */
static void do_sd_random_corrupt(reiserfs_filsys_t *fs, static void do_sd_random_corrupt(reiserfs_filsys_t fs,
unsigned long nr_leaves_cr) unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
@@ -1175,7 +1175,7 @@ static void do_sd_random_corrupt(reiserfs_filsys_t *fs,
} }
/* corrupt the random number of indierct items in random number of leaves */ /* corrupt the random number of indierct items in random number of leaves */
static void do_ind_random_corrupt(reiserfs_filsys_t *fs, static void do_ind_random_corrupt(reiserfs_filsys_t fs,
unsigned long nr_leaves_cr) unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
@@ -1273,7 +1273,7 @@ static void do_ind_random_corrupt(reiserfs_filsys_t *fs,
corrupted corrupted
*/ */
static void what_to_corrupt(reiserfs_filsys_t *fs, char *corruption_command) static void what_to_corrupt(reiserfs_filsys_t fs, char *corruption_command)
{ {
unsigned long nr_leaves_cr; unsigned long nr_leaves_cr;
char code; char code;
@@ -1339,7 +1339,7 @@ static void what_to_corrupt(reiserfs_filsys_t *fs, char *corruption_command)
} }
} }
void do_fs_random_corrupt(reiserfs_filsys_t *fs) void do_fs_random_corrupt(reiserfs_filsys_t fs)
{ {
char *line = NULL; char *line = NULL;
size_t n = 0; size_t n = 0;
+12 -12
View File
@@ -5,7 +5,7 @@
#include "debugreiserfs.h" #include "debugreiserfs.h"
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
#define print_usage_and_exit() {\ #define print_usage_and_exit() {\
fprintf (stderr, "Usage: %s [options] device\n\n\ fprintf (stderr, "Usage: %s [options] device\n\n\
@@ -67,7 +67,7 @@ struct reiserfs_fsstat {
} g_stat_info; } g_stat_info;
#endif #endif
static void print_disk_tree(reiserfs_filsys_t *fs, unsigned long block_nr) static void print_disk_tree(reiserfs_filsys_t fs, unsigned long block_nr)
{ {
struct buffer_head *bh; struct buffer_head *bh;
int i, j, count; int i, j, count;
@@ -132,7 +132,7 @@ static void print_disk_tree(reiserfs_filsys_t *fs, unsigned long block_nr)
level++; level++;
} }
static void print_disk_blocks(reiserfs_filsys_t *fs) static void print_disk_blocks(reiserfs_filsys_t fs)
{ {
int type; int type;
unsigned long done = 0, total; unsigned long done = 0, total;
@@ -171,8 +171,8 @@ static void print_disk_blocks(reiserfs_filsys_t *fs)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
void pack_one_block(reiserfs_filsys_t *fs, unsigned long block); void pack_one_block(reiserfs_filsys_t fs, unsigned long block);
static void print_one_block(reiserfs_filsys_t *fs, unsigned long block) static void print_one_block(reiserfs_filsys_t fs, unsigned long block)
{ {
struct buffer_head *bh; struct buffer_head *bh;
@@ -427,9 +427,9 @@ static char *parse_options(struct debugreiserfs_data *data,
return argv[optind]; return argv[optind];
} }
void pack_partition(reiserfs_filsys_t *fs); void pack_partition(reiserfs_filsys_t fs);
static void do_pack(reiserfs_filsys_t *fs) static void do_pack(reiserfs_filsys_t fs)
{ {
if (certain_block(fs)) if (certain_block(fs))
pack_one_block(fs, certain_block(fs)); pack_one_block(fs, certain_block(fs));
@@ -452,7 +452,7 @@ static int comp (const void * vp1, const void * vp2)
} }
*/ */
static void init_bitmap(reiserfs_filsys_t *fs) static void init_bitmap(reiserfs_filsys_t fs)
{ {
FILE *fp; FILE *fp;
unsigned long block_count; unsigned long block_count;
@@ -508,7 +508,7 @@ static void init_bitmap(reiserfs_filsys_t *fs)
} }
/* FIXME: statistics does not work */ /* FIXME: statistics does not work */
static void do_dump_tree(reiserfs_filsys_t *fs) static void do_dump_tree(reiserfs_filsys_t fs)
{ {
if (certain_block(fs)) { if (certain_block(fs)) {
print_one_block(fs, certain_block(fs)); print_one_block(fs, certain_block(fs));
@@ -565,7 +565,7 @@ static void do_dump_tree(reiserfs_filsys_t *fs)
} }
} }
static void callback_badblock_print(reiserfs_filsys_t *fs, static void callback_badblock_print(reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, struct reiserfs_path *badblock_path,
void *data) void *data)
{ {
@@ -610,7 +610,7 @@ static int str2int(char *str, int *res)
return 1; return 1;
} }
static void do_corrupt_blocks(reiserfs_filsys_t *fs) static void do_corrupt_blocks(reiserfs_filsys_t fs)
{ {
char *line; char *line;
FILE *fd; FILE *fd;
@@ -647,7 +647,7 @@ static void do_corrupt_blocks(reiserfs_filsys_t *fs)
return; return;
} }
static void debugreiserfs_zero_reiserfs(reiserfs_filsys_t *fs) static void debugreiserfs_zero_reiserfs(reiserfs_filsys_t fs)
{ {
unsigned long done, total, i; unsigned long done, total, i;
struct buffer_head *bh; struct buffer_head *bh;
+10 -10
View File
@@ -17,7 +17,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
extern reiserfs_filsys_t *fs; extern reiserfs_filsys_t fs;
/* /*
* modes * modes
@@ -238,27 +238,27 @@ struct debugreiserfs_data {
#define be_quiet(fs) (data(fs)->options & BE_QUIET) #define be_quiet(fs) (data(fs)->options & BE_QUIET)
/* stat.c */ /* stat.c */
void do_stat(reiserfs_filsys_t *fs); void do_stat(reiserfs_filsys_t fs);
/* corruption.c */ /* corruption.c */
void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline); void do_corrupt_one_block(reiserfs_filsys_t fs, char *fline);
void do_leaves_corruption(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr); void do_leaves_corruption(reiserfs_filsys_t fs, unsigned long nr_leaves_cr);
void do_bitmap_corruption(reiserfs_filsys_t *fs); void do_bitmap_corruption(reiserfs_filsys_t fs);
void do_fs_random_corrupt(reiserfs_filsys_t *fs); void do_fs_random_corrupt(reiserfs_filsys_t fs);
/* recover.c */ /* recover.c */
void do_recover(reiserfs_filsys_t *fs); void do_recover(reiserfs_filsys_t fs);
/* scan.c */ /* scan.c */
void do_scan(reiserfs_filsys_t *fs); void do_scan(reiserfs_filsys_t fs);
/* journal.c */ /* journal.c */
void scan_journal(reiserfs_filsys_t *fs); void scan_journal(reiserfs_filsys_t fs);
/* unpack.c */ /* unpack.c */
extern int do_unpack(char *host, char *j_filename, char *filename, int verbose); extern int do_unpack(char *host, char *j_filename, char *filename, int verbose);
void print_map(reiserfs_filsys_t *fs); void print_map(reiserfs_filsys_t fs);
struct saved_item { struct saved_item {
struct item_head si_ih; struct item_head si_ih;
+11 -11
View File
@@ -184,7 +184,7 @@ static void pack_indirect(struct packed_item *pi, struct buffer_head *bh,
maybe gencounter (16) maybe gencounter (16)
maybe deh_state (16) maybe deh_state (16)
*/ */
static void pack_direntry(reiserfs_filsys_t *fs, struct packed_item *pi, static void pack_direntry(reiserfs_filsys_t fs, struct packed_item *pi,
struct buffer_head *bh, struct item_head *ih) struct buffer_head *bh, struct item_head *ih)
{ {
int i; int i;
@@ -315,7 +315,7 @@ static void pack_stat_data(struct packed_item *pi, struct buffer_head *bh,
} }
} }
static void pack_full_block(reiserfs_filsys_t *fs, struct buffer_head *bh) static void pack_full_block(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
__u16 magic; __u16 magic;
__u32 block; __u32 block;
@@ -338,7 +338,7 @@ static void pack_full_block(reiserfs_filsys_t *fs, struct buffer_head *bh)
/* unformatted node pointer is considered bad when it points either to blocks /* unformatted node pointer is considered bad when it points either to blocks
of journal, bitmap blocks, super block or is transparently out of range of of journal, bitmap blocks, super block or is transparently out of range of
disk block numbers */ disk block numbers */
static int check_unfm_ptr(reiserfs_filsys_t *fs, __u32 block) static int check_unfm_ptr(reiserfs_filsys_t fs, __u32 block)
{ {
if (block >= SB_BLOCK_COUNT(fs)) if (block >= SB_BLOCK_COUNT(fs))
return 1; return 1;
@@ -351,7 +351,7 @@ static int check_unfm_ptr(reiserfs_filsys_t *fs, __u32 block)
#endif #endif
/* we only pack leaves which do not have any corruptions */ /* we only pack leaves which do not have any corruptions */
static int can_pack_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh) static int can_pack_leaf(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
int i; int i;
struct item_head *ih; struct item_head *ih;
@@ -369,7 +369,7 @@ static int can_pack_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh)
/* pack leaf only if all its items are correct: keys are correct, /* pack leaf only if all its items are correct: keys are correct,
direntries are hashed properly and hash function is defined, direntries are hashed properly and hash function is defined,
indirect items are correct, stat data ?, */ indirect items are correct, stat data ?, */
static void pack_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh) static void pack_leaf(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
int i; int i;
struct item_head *ih; struct item_head *ih;
@@ -493,13 +493,13 @@ static void pack_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh)
return; return;
} }
static int can_pack_internal(reiserfs_filsys_t *fs, struct buffer_head *bh) static int can_pack_internal(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
return 0; return 0;
} }
/* pack internal node as a full block */ /* pack internal node as a full block */
static void pack_internal(reiserfs_filsys_t *fs, struct buffer_head *bh) static void pack_internal(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
internals++; internals++;
if (!can_pack_internal(fs, bh)) { if (!can_pack_internal(fs, bh)) {
@@ -511,7 +511,7 @@ static void pack_internal(reiserfs_filsys_t *fs, struct buffer_head *bh)
} }
/* packed blocks are marked free in the bitmap*/ /* packed blocks are marked free in the bitmap*/
static void send_block(reiserfs_filsys_t *fs, struct buffer_head *bh, static void send_block(reiserfs_filsys_t fs, struct buffer_head *bh,
int send_unknown) int send_unknown)
{ {
int type; int type;
@@ -546,7 +546,7 @@ static void send_block(reiserfs_filsys_t *fs, struct buffer_head *bh,
} }
/* super block, journal, bitmaps */ /* super block, journal, bitmaps */
static void pack_frozen_data(reiserfs_filsys_t *fs) static void pack_frozen_data(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
unsigned long block; unsigned long block;
@@ -638,7 +638,7 @@ static void pack_frozen_data(reiserfs_filsys_t *fs)
} }
/* pack all "not data blocks" and correct leaf */ /* pack all "not data blocks" and correct leaf */
void pack_partition(reiserfs_filsys_t *fs) void pack_partition(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
__u32 magic32; __u32 magic32;
@@ -699,7 +699,7 @@ void pack_partition(reiserfs_filsys_t *fs)
(double)sent_bytes / had_to_be_sent); (double)sent_bytes / had_to_be_sent);
} }
void pack_one_block(reiserfs_filsys_t *fs, unsigned long block) void pack_one_block(reiserfs_filsys_t fs, unsigned long block)
{ {
__u32 magic32; __u32 magic32;
__u16 magic16; __u16 magic16;
+3 -3
View File
@@ -233,7 +233,7 @@ static void read_map (FILE * fp)
free (buf); free (buf);
} }
void do_recover (reiserfs_filsys_t *fs) void do_recover (reiserfs_filsys_t fs)
{ {
FILE * fp; FILE * fp;
@@ -276,7 +276,7 @@ static long int get_answer(long int max)
return result; return result;
} }
static void recover_items(FILE * fp, reiserfs_filsys_t *fs, FILE * target_file) static void recover_items(FILE * fp, reiserfs_filsys_t fs, FILE * target_file)
{ {
struct buffer_head *bh, *bh_pointed; struct buffer_head *bh, *bh_pointed;
struct item_head *ih; struct item_head *ih;
@@ -409,7 +409,7 @@ static void recover_items(FILE * fp, reiserfs_filsys_t *fs, FILE * target_file)
free(map); free(map);
} }
void do_recover(reiserfs_filsys_t *fs) void do_recover(reiserfs_filsys_t fs)
{ {
FILE *fp, *recovery; FILE *fp, *recovery;
+6 -6
View File
@@ -581,7 +581,7 @@ static void map_one_item(struct saved_item *item)
} }
// flush map which is in variable map // flush map which is in variable map
static void flush_map(reiserfs_filsys_t *fs, static void flush_map(reiserfs_filsys_t fs,
struct reiserfs_key *dir, struct reiserfs_key *dir,
char *name, struct reiserfs_key *key) char *name, struct reiserfs_key *key)
{ {
@@ -718,7 +718,7 @@ static void make_file_map (const void *nodep, VISIT value, int level)
} }
*/ */
static void print_items(FILE * fp, reiserfs_filsys_t *fs) static void print_items(FILE * fp, reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct item_head *ih; struct item_head *ih;
@@ -737,7 +737,7 @@ static void print_items(FILE * fp, reiserfs_filsys_t *fs)
} }
} }
void print_map(reiserfs_filsys_t *fs) void print_map(reiserfs_filsys_t fs)
{ {
FILE *fp; FILE *fp;
@@ -845,7 +845,7 @@ static void make_map(const void *nodep, VISIT value, int level)
} }
/* store map if it is a regular file */ /* store map if it is a regular file */
static void locate_file(reiserfs_filsys_t *fs, struct reiserfs_key *key) static void locate_file(reiserfs_filsys_t fs, struct reiserfs_key *key)
{ {
INITIALIZE_REISERFS_PATH(path); INITIALIZE_REISERFS_PATH(path);
struct reiserfs_key *next_key; struct reiserfs_key *next_key;
@@ -880,7 +880,7 @@ static void locate_file(reiserfs_filsys_t *fs, struct reiserfs_key *key)
} }
/* read stdin and look for specified name in the specified directory */ /* read stdin and look for specified name in the specified directory */
static void look_for_name(reiserfs_filsys_t *fs) static void look_for_name(reiserfs_filsys_t fs)
{ {
INITIALIZE_REISERFS_PATH(path); INITIALIZE_REISERFS_PATH(path);
char *name, *objectid, *dirid; char *name, *objectid, *dirid;
@@ -998,7 +998,7 @@ static void scan_for_key(struct buffer_head *bh, struct reiserfs_key *key)
} }
#endif #endif
void do_scan(reiserfs_filsys_t *fs) void do_scan(reiserfs_filsys_t fs)
{ {
unsigned long i; unsigned long i;
struct buffer_head *bh; struct buffer_head *bh;
+2 -2
View File
@@ -105,7 +105,7 @@ static int is_unique_item(struct obstack *ostack, void **tree, void *ih)
return 1; return 1;
} }
static void stat1_the_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh) static void stat1_the_leaf(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
int i, i_num; int i, i_num;
struct item_head *ih; struct item_head *ih;
@@ -152,7 +152,7 @@ static void stat2_the_leaf (struct buffer_head * bh)
} }
*/ */
void do_stat(reiserfs_filsys_t *fs) void do_stat(reiserfs_filsys_t fs)
{ {
unsigned long i; unsigned long i;
unsigned long done, total; unsigned long done, total;
+24 -24
View File
@@ -111,7 +111,7 @@ static reiserfs_bitmap_t *source_bitmap;
static int tree_scanning_failed = 0; static int tree_scanning_failed = 0;
/* 1 if block is not marked as used in the bitmap */ /* 1 if block is not marked as used in the bitmap */
static int is_block_free(reiserfs_filsys_t *fs, unsigned long block) static int is_block_free(reiserfs_filsys_t fs, unsigned long block)
{ {
return !reiserfs_bitmap_test_bit(source_bitmap, block); return !reiserfs_bitmap_test_bit(source_bitmap, block);
} }
@@ -132,7 +132,7 @@ static int did_we_meet_it(unsigned long block)
return reiserfs_bitmap_test_bit(control_bitmap, block); return reiserfs_bitmap_test_bit(control_bitmap, block);
} }
static void init_control_bitmap(reiserfs_filsys_t *fs) static void init_control_bitmap(reiserfs_filsys_t fs)
{ {
unsigned int i; unsigned int i;
unsigned long block; unsigned long block;
@@ -197,7 +197,7 @@ static void init_control_bitmap(reiserfs_filsys_t *fs)
/* if we managed to complete tree scanning and if control bitmap and/or proper /* if we managed to complete tree scanning and if control bitmap and/or proper
amount of free blocks mismatch with bitmap on disk and super block's amount of free blocks mismatch with bitmap on disk and super block's
s_free_blocks - we can fix that */ s_free_blocks - we can fix that */
static void handle_bitmaps(reiserfs_filsys_t *fs) static void handle_bitmaps(reiserfs_filsys_t fs)
{ {
int problem = 0; int problem = 0;
@@ -271,7 +271,7 @@ static void handle_bitmaps(reiserfs_filsys_t *fs)
return; return;
} }
static int auto_handle_bitmaps(reiserfs_filsys_t *fs) static int auto_handle_bitmaps(reiserfs_filsys_t fs)
{ {
unsigned long i; unsigned long i;
@@ -288,7 +288,7 @@ static int auto_handle_bitmaps(reiserfs_filsys_t *fs)
} }
/* is this block legal to be pointed to by some place of the tree? */ /* is this block legal to be pointed to by some place of the tree? */
static int bad_block_number(reiserfs_filsys_t *fs, unsigned long block) static int bad_block_number(reiserfs_filsys_t fs, unsigned long block)
{ {
if (block >= get_sb_block_count(fs->fs_ondisk_sb) || if (block >= get_sb_block_count(fs->fs_ondisk_sb) ||
not_data_block(fs, block)) { not_data_block(fs, block)) {
@@ -317,7 +317,7 @@ static int bad_block_number(reiserfs_filsys_t *fs, unsigned long block)
return 0; return 0;
} }
static int got_already(reiserfs_filsys_t *fs, unsigned long block) static int got_already(reiserfs_filsys_t fs, unsigned long block)
{ {
if (did_we_meet_it(block)) { if (did_we_meet_it(block)) {
/* block is in tree at least twice */ /* block is in tree at least twice */
@@ -328,7 +328,7 @@ static int got_already(reiserfs_filsys_t *fs, unsigned long block)
} }
/* 1 if it does not look like reasonable stat data */ /* 1 if it does not look like reasonable stat data */
static int bad_stat_data(reiserfs_filsys_t *fs, static int bad_stat_data(reiserfs_filsys_t fs,
struct buffer_head *bh, struct item_head *ih) struct buffer_head *bh, struct item_head *ih)
{ {
unsigned long objectid; unsigned long objectid;
@@ -381,13 +381,13 @@ static int bad_stat_data(reiserfs_filsys_t *fs,
} }
/* it looks like we can check item length only */ /* it looks like we can check item length only */
static int bad_direct_item(reiserfs_filsys_t *fs, static int bad_direct_item(reiserfs_filsys_t fs,
struct buffer_head *bh, struct item_head *ih) struct buffer_head *bh, struct item_head *ih)
{ {
return 0; return 0;
} }
inline void handle_one_pointer(reiserfs_filsys_t *fs, inline void handle_one_pointer(reiserfs_filsys_t fs,
struct buffer_head *bh, __le32 * item, struct buffer_head *bh, __le32 * item,
int offset) int offset)
{ {
@@ -400,7 +400,7 @@ inline void handle_one_pointer(reiserfs_filsys_t *fs,
} }
} }
static int bad_badblocks_item(reiserfs_filsys_t *fs, struct buffer_head *bh, static int bad_badblocks_item(reiserfs_filsys_t fs, struct buffer_head *bh,
struct item_head *ih) struct item_head *ih)
{ {
__u32 i; __u32 i;
@@ -475,7 +475,7 @@ static int bad_badblocks_item(reiserfs_filsys_t *fs, struct buffer_head *bh,
/* for each unformatted node pointer: make sure it points to data area and /* for each unformatted node pointer: make sure it points to data area and
that it is not in the tree yet */ that it is not in the tree yet */
static int bad_indirect_item(reiserfs_filsys_t *fs, struct buffer_head *bh, static int bad_indirect_item(reiserfs_filsys_t fs, struct buffer_head *bh,
struct item_head *ih) struct item_head *ih)
{ {
__le32 *ind = (__le32 *) ih_item_body(bh, ih); __le32 *ind = (__le32 *) ih_item_body(bh, ih);
@@ -541,7 +541,7 @@ static int bad_indirect_item(reiserfs_filsys_t *fs, struct buffer_head *bh,
} }
/* FIXME: this was is_bad_directory from pass0.c */ /* FIXME: this was is_bad_directory from pass0.c */
static int bad_directory_item(reiserfs_filsys_t *fs, static int bad_directory_item(reiserfs_filsys_t fs,
struct buffer_head *bh, struct item_head *ih) struct buffer_head *bh, struct item_head *ih)
{ {
char *name, *prev_name; char *name, *prev_name;
@@ -644,7 +644,7 @@ static int bad_directory_item(reiserfs_filsys_t *fs,
return 0; return 0;
} }
static int bad_item(reiserfs_filsys_t *fs, struct buffer_head *bh, int num) static int bad_item(reiserfs_filsys_t fs, struct buffer_head *bh, int num)
{ {
struct item_head *ih; struct item_head *ih;
int format; int format;
@@ -752,7 +752,7 @@ error:
} }
/* 1 if i-th and (i-1)-th items can not be neighbors in a leaf */ /* 1 if i-th and (i-1)-th items can not be neighbors in a leaf */
int bad_pair(reiserfs_filsys_t *fs, struct buffer_head *bh, int pos) int bad_pair(reiserfs_filsys_t fs, struct buffer_head *bh, int pos)
{ {
struct item_head *ih; struct item_head *ih;
@@ -831,7 +831,7 @@ int bad_pair(reiserfs_filsys_t *fs, struct buffer_head *bh, int pos)
} }
/* 1 if block head or any of items is bad */ /* 1 if block head or any of items is bad */
static int bad_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh) static int bad_leaf(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
int i; int i;
@@ -857,7 +857,7 @@ static int bad_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh)
} }
/* 1 if bh does not look like internal node */ /* 1 if bh does not look like internal node */
static int bad_internal(reiserfs_filsys_t *fs, struct buffer_head *bh) static int bad_internal(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
int i; int i;
@@ -895,7 +895,7 @@ static int bad_internal(reiserfs_filsys_t *fs, struct buffer_head *bh)
} }
/* h == 0 for root level. block head's level == 1 for leaf level */ /* h == 0 for root level. block head's level == 1 for leaf level */
static inline int h_to_level(reiserfs_filsys_t *fs, int h) static inline int h_to_level(reiserfs_filsys_t fs, int h)
{ {
return get_sb_tree_height(fs->fs_ondisk_sb) - h - 1; return get_sb_tree_height(fs->fs_ondisk_sb) - h - 1;
} }
@@ -968,7 +968,7 @@ int leaf_fix_key_oid(struct buffer_head *bh, int pos, __u32 oid)
#endif #endif
/* bh must be formatted node. blk_level must be tree_height - h + 1 */ /* bh must be formatted node. blk_level must be tree_height - h + 1 */
static int bad_node(reiserfs_filsys_t *fs, struct buffer_head **path, int h) static int bad_node(reiserfs_filsys_t fs, struct buffer_head **path, int h)
{ {
struct buffer_head **pbh = &path[h]; struct buffer_head **pbh = &path[h];
@@ -1049,7 +1049,7 @@ static struct reiserfs_key *rkey(struct buffer_head **path, int h)
} }
/* are all delimiting keys correct */ /* are all delimiting keys correct */
static int bad_path(reiserfs_filsys_t *fs, struct buffer_head **path, int h1) static int bad_path(reiserfs_filsys_t fs, struct buffer_head **path, int h1)
{ {
int h = 0; int h = 0;
struct reiserfs_key *dk; struct reiserfs_key *dk;
@@ -1132,7 +1132,7 @@ static int bad_path(reiserfs_filsys_t *fs, struct buffer_head **path, int h1)
return 0; return 0;
} }
static void before_check_fs_tree(reiserfs_filsys_t *fs) static void before_check_fs_tree(reiserfs_filsys_t fs)
{ {
init_control_bitmap(fs); init_control_bitmap(fs);
@@ -1143,7 +1143,7 @@ static void before_check_fs_tree(reiserfs_filsys_t *fs)
proper_id_map(fs) = id_map_init(); proper_id_map(fs) = id_map_init();
} }
static void after_check_fs_tree(reiserfs_filsys_t *fs) static void after_check_fs_tree(reiserfs_filsys_t fs)
{ {
if (fsck_mode(fs) == FSCK_FIX_FIXABLE) { if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
reiserfs_flush_to_ondisk_bitmap(fs->fs_bitmap2, fs); reiserfs_flush_to_ondisk_bitmap(fs->fs_bitmap2, fs);
@@ -1159,7 +1159,7 @@ static void after_check_fs_tree(reiserfs_filsys_t *fs)
} }
/* pass internal tree of filesystem */ /* pass internal tree of filesystem */
void check_fs_tree(reiserfs_filsys_t *fs) void check_fs_tree(reiserfs_filsys_t fs)
{ {
before_check_fs_tree(fs); before_check_fs_tree(fs);
@@ -1183,7 +1183,7 @@ void check_fs_tree(reiserfs_filsys_t *fs)
after_check_fs_tree(fs); after_check_fs_tree(fs);
} }
static int clean_attributes_handler(reiserfs_filsys_t *fs, static int clean_attributes_handler(reiserfs_filsys_t fs,
struct buffer_head **path, int h) struct buffer_head **path, int h)
{ {
struct buffer_head *bh = path[h]; struct buffer_head *bh = path[h];
@@ -1211,7 +1211,7 @@ static int clean_attributes_handler(reiserfs_filsys_t *fs,
return 0; return 0;
} }
void do_clean_attributes(reiserfs_filsys_t *fs) void do_clean_attributes(reiserfs_filsys_t fs)
{ {
pass_through_tree(fs, clean_attributes_handler, NULL, -1); pass_through_tree(fs, clean_attributes_handler, NULL, -1);
set_sb_v2_flag(fs->fs_ondisk_sb, reiserfs_attrs_cleared); set_sb_v2_flag(fs->fs_ondisk_sb, reiserfs_attrs_cleared);
+30 -30
View File
@@ -21,7 +21,7 @@
#include "../version.h" #include "../version.h"
/* main.c */ /* main.c */
extern reiserfs_filsys_t *fs; extern reiserfs_filsys_t fs;
int main(int argc, char *argv[]); int main(int argc, char *argv[]);
/* Exit codes. */ /* Exit codes. */
@@ -67,10 +67,10 @@ int main(int argc, char *argv[]);
/* pass0.c */ /* pass0.c */
extern reiserfs_bitmap_t *leaves_bitmap; extern reiserfs_bitmap_t *leaves_bitmap;
void pass_0(reiserfs_filsys_t *); void pass_0(reiserfs_filsys_t );
void load_pass_0_result(FILE *, reiserfs_filsys_t *); void load_pass_0_result(FILE *, reiserfs_filsys_t );
int leaf_structure_check(reiserfs_filsys_t *fs, struct buffer_head *bh); int leaf_structure_check(reiserfs_filsys_t fs, struct buffer_head *bh);
int is_used_leaf(unsigned long block); int is_used_leaf(unsigned long block);
int is_good_unformatted(unsigned long block); int is_good_unformatted(unsigned long block);
@@ -84,7 +84,7 @@ void register_uninsertable(unsigned long block);
void register_saved_item(void); void register_saved_item(void);
int still_bad_unfm_ptr_1(unsigned long block); int still_bad_unfm_ptr_1(unsigned long block);
int still_bad_unfm_ptr_2(unsigned long block); int still_bad_unfm_ptr_2(unsigned long block);
void make_alloc_bitmap(reiserfs_filsys_t *); void make_alloc_bitmap(reiserfs_filsys_t );
void delete_aux_bitmaps(); void delete_aux_bitmaps();
void set_aux_bitmaps(reiserfs_bitmap_t *leaves, reiserfs_bitmap_t *good, void set_aux_bitmaps(reiserfs_bitmap_t *leaves, reiserfs_bitmap_t *good,
@@ -100,8 +100,8 @@ extern reiserfs_bitmap_t *bad_unfm_in_tree_once_bitmap;
#define mark_bad_unfm_in_tree_once(block) __mark (bad_unfm_in_tree_once, block) #define mark_bad_unfm_in_tree_once(block) __mark (bad_unfm_in_tree_once, block)
/* pass1.c */ /* pass1.c */
void pass_1(reiserfs_filsys_t *); void pass_1(reiserfs_filsys_t );
void load_pass_1_result(FILE *, reiserfs_filsys_t *); void load_pass_1_result(FILE *, reiserfs_filsys_t );
struct buffer_head *make_buffer(int dev, unsigned long blocknr, int size, struct buffer_head *make_buffer(int dev, unsigned long blocknr, int size,
char *data); char *data);
void build_the_tree(void); void build_the_tree(void);
@@ -115,8 +115,8 @@ int tree_is_empty(void);
void make_single_leaf_tree(struct buffer_head *bh); void make_single_leaf_tree(struct buffer_head *bh);
/* pass2.c */ /* pass2.c */
void pass_2(reiserfs_filsys_t *); void pass_2(reiserfs_filsys_t );
void load_pass_2_result(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 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, void save_item(struct si **head, struct item_head *ih, char *item,
__u32 blocknr); __u32 blocknr);
@@ -161,9 +161,9 @@ void rewrite_file(struct item_head *ih, int should_relocate,
#define RELOCATED -3 #define RELOCATED -3
#define LOOP_FOUND -4 #define LOOP_FOUND -4
void load_semantic_result(FILE *, reiserfs_filsys_t *); void load_semantic_result(FILE *, reiserfs_filsys_t );
void pass_3_semantic(reiserfs_filsys_t *); void pass_3_semantic(reiserfs_filsys_t );
void semantic_check(void); void semantic_check(void);
int check_semantic_tree(struct reiserfs_key *key, struct reiserfs_key *parent, int check_semantic_tree(struct reiserfs_key *key, struct reiserfs_key *parent,
int is_dot_dot, int lost_found, int is_dot_dot, int lost_found,
@@ -174,7 +174,7 @@ int not_a_regfile(void *sd);
int fix_obviously_wrong_sd_mode(struct reiserfs_path *path); int fix_obviously_wrong_sd_mode(struct reiserfs_path *path);
int is_dot_dot(char *name, int namelen); int is_dot_dot(char *name, int namelen);
int is_dot(char *name, int namelen); int is_dot(char *name, int namelen);
/*void create_dir_sd (reiserfs_filsys_t *fs, /*void create_dir_sd (reiserfs_filsys_t fs,
struct reiserfs_path *path, struct reiserfs_key *key);*/ struct reiserfs_path *path, struct reiserfs_key *key);*/
int rebuild_check_regular_file(struct reiserfs_path *path, void *sd, int rebuild_check_regular_file(struct reiserfs_path *path, void *sd,
struct item_head *new_ih); struct item_head *new_ih);
@@ -182,9 +182,9 @@ int rebuild_semantic_pass(struct reiserfs_key *key, struct reiserfs_key *parent,
int is_dot_dot, struct item_head *new_ih); int is_dot_dot, struct item_head *new_ih);
/* lost+found.c */ /* lost+found.c */
void pass_3a_look_for_lost(reiserfs_filsys_t *); void pass_3a_look_for_lost(reiserfs_filsys_t );
void load_lost_found_result(reiserfs_filsys_t *); void load_lost_found_result(reiserfs_filsys_t );
/* pass4.c */ /* pass4.c */
void pass_4_check_unaccessed_items(void); void pass_4_check_unaccessed_items(void);
@@ -201,10 +201,10 @@ int is_bad_directory(struct item_head *ih, char *item, int dev, int blocksize);
//extern int bad_block_number (struct super_block * s, blocknr_t block); //extern int bad_block_number (struct super_block * s, blocknr_t block);
/* check_tree.c */ /* check_tree.c */
void check_fs_tree(reiserfs_filsys_t *); void check_fs_tree(reiserfs_filsys_t );
void do_clean_attributes(reiserfs_filsys_t *fs); void do_clean_attributes(reiserfs_filsys_t fs);
int bad_pair(reiserfs_filsys_t *, struct buffer_head *bh, int i); int bad_pair(reiserfs_filsys_t , struct buffer_head *bh, int i);
int bad_leaf_2(reiserfs_filsys_t *, struct buffer_head *bh); int bad_leaf_2(reiserfs_filsys_t , struct buffer_head *bh);
#if 0 #if 0
extern int should_be_relocated(struct reiserfs_key *key); extern int should_be_relocated(struct reiserfs_key *key);
@@ -227,17 +227,17 @@ void reiserfsck_cut_from_item(struct reiserfs_path *path, int cut_size);
comp3_function_t comp_func, int version); comp3_function_t comp_func, int version);
int usearch_by_entry_key (struct super_block * s, struct reiserfs_key *key, struct reiserfs_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_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); typedef int do_on_full_path_t(reiserfs_filsys_t , struct buffer_head **, int);
void pass_through_tree(reiserfs_filsys_t *, do_after_read_t, do_on_full_path_t, void pass_through_tree(reiserfs_filsys_t , do_after_read_t, do_on_full_path_t,
int depth); int depth);
/* bitmap.c */ /* bitmap.c */
int reiserfsck_reiserfs_new_blocknrs(reiserfs_filsys_t *fs, int reiserfsck_reiserfs_new_blocknrs(reiserfs_filsys_t fs,
unsigned long *pblocknrs, unsigned long *pblocknrs,
unsigned long start_from, unsigned long start_from,
int amount_needed); int amount_needed);
int reiserfsck_reiserfs_free_block(reiserfs_filsys_t *fs, unsigned long block); int reiserfsck_reiserfs_free_block(reiserfs_filsys_t fs, unsigned long block);
struct buffer_head *reiserfsck_get_new_buffer(unsigned long start); struct buffer_head *reiserfsck_get_new_buffer(unsigned long start);
int is_block_used(unsigned long block); int is_block_used(unsigned long block);
void mark_block_used(unsigned long block, int check_hardware); void mark_block_used(unsigned long block, int check_hardware);
@@ -254,10 +254,10 @@ void id_map_free(id_map_t *);
int id_map_test(id_map_t *map, __u32 id); int id_map_test(id_map_t *map, __u32 id);
int id_map_mark(id_map_t *map, __u32 id); int id_map_mark(id_map_t *map, __u32 id);
__u32 id_map_alloc(id_map_t *map); __u32 id_map_alloc(id_map_t *map);
void id_map_flush(struct id_map *map, reiserfs_filsys_t *fs); void id_map_flush(struct id_map *map, reiserfs_filsys_t fs);
/* FIXME: Needs to be implemented /* FIXME: Needs to be implemented
void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t *fs); void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t fs);
void reiserfs_objectid_map_save (FILE * fp, struct id_map * id_map); void reiserfs_objectid_map_save (FILE * fp, struct id_map * id_map);
struct id_map * reiserfs_objectid_map_load (FILE * fp); struct id_map * reiserfs_objectid_map_load (FILE * fp);
@@ -463,12 +463,12 @@ struct fsck_data {
/* name of file where we store rollback data */ /* name of file where we store rollback data */
#define state_rollback_file(fs) fsck_data(fs)->rebuild.rollback_file #define state_rollback_file(fs) fsck_data(fs)->rebuild.rollback_file
int fsck_user_confirmed(reiserfs_filsys_t *fs, char *q, char *a, int fsck_user_confirmed(reiserfs_filsys_t fs, char *q, char *a,
int default_answer); int default_answer);
void stage_report(int, reiserfs_filsys_t *); void stage_report(int, reiserfs_filsys_t );
/*pass1: rebuild super block*/ /*pass1: rebuild super block*/
void rebuild_sb(reiserfs_filsys_t *fs, char *filename, struct fsck_data *data); void rebuild_sb(reiserfs_filsys_t fs, char *filename, struct fsck_data *data);
#define fsck_log(fmt, list...) \ #define fsck_log(fmt, list...) \
{\ {\
@@ -485,8 +485,8 @@ fflush (fsck_progress_file(fs));\
#define FATAL 1 #define FATAL 1
#define FIXABLE 2 #define FIXABLE 2
void one_more_corruption(reiserfs_filsys_t *fs, int kind); void one_more_corruption(reiserfs_filsys_t fs, int kind);
void one_less_corruption(reiserfs_filsys_t *fs, int kind); void one_less_corruption(reiserfs_filsys_t fs, int kind);
/* /*
#define one_more_corruption(fs,kind) fsck_check_stat (fs)->kind##_corruptions++ #define one_more_corruption(fs,kind) fsck_check_stat (fs)->kind##_corruptions++
+2 -2
View File
@@ -5,7 +5,7 @@
#include "fsck.h" #include "fsck.h"
int fsck_user_confirmed(reiserfs_filsys_t *fs, char *q, char *a, int fsck_user_confirmed(reiserfs_filsys_t fs, char *q, char *a,
int default_answer) int default_answer)
{ {
if (!fsck_interactive(fs)) if (!fsck_interactive(fs))
@@ -14,7 +14,7 @@ int fsck_user_confirmed(reiserfs_filsys_t *fs, char *q, char *a,
return user_confirmed(fsck_progress_file(fs), q, a); return user_confirmed(fsck_progress_file(fs), q, a);
} }
void stage_report(int pass, reiserfs_filsys_t *fs) void stage_report(int pass, reiserfs_filsys_t fs)
{ {
switch (pass) { switch (pass) {
case 0: case 0:
+5 -5
View File
@@ -11,7 +11,7 @@ void print_name(char *name, int len);
void modify_item(struct item_head *ih, void *item); void modify_item(struct item_head *ih, void *item);
/* fixme: search_by_key is not needed after any add_entry */ /* fixme: search_by_key is not needed after any add_entry */
static __u64 _look_for_lost(reiserfs_filsys_t *fs, int link_lost_dirs) static __u64 _look_for_lost(reiserfs_filsys_t fs, int link_lost_dirs)
{ {
struct reiserfs_key key, prev_key, *rdkey; struct reiserfs_key key, prev_key, *rdkey;
INITIALIZE_REISERFS_PATH(path); INITIALIZE_REISERFS_PATH(path);
@@ -285,7 +285,7 @@ cont:
} }
static void save_lost_found_result(reiserfs_filsys_t *fs) static void save_lost_found_result(reiserfs_filsys_t fs)
{ {
FILE *file; FILE *file;
int retval; int retval;
@@ -310,7 +310,7 @@ static void save_lost_found_result(reiserfs_filsys_t *fs)
/* we have nothing to load from a state file, but we have to fetch /* we have nothing to load from a state file, but we have to fetch
on-disk bitmap, copy it to allocable bitmap, and fetch objectid on-disk bitmap, copy it to allocable bitmap, and fetch objectid
map */ map */
void load_lost_found_result(reiserfs_filsys_t *fs) void load_lost_found_result(reiserfs_filsys_t fs)
{ {
fsck_new_bitmap(fs) = fsck_new_bitmap(fs) =
reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb)); reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb));
@@ -330,7 +330,7 @@ void load_lost_found_result(reiserfs_filsys_t *fs)
*/ */
} }
static void after_lost_found(reiserfs_filsys_t *fs) static void after_lost_found(reiserfs_filsys_t fs)
{ {
/* update super block: objectid map, fsck state */ /* update super block: objectid map, fsck state */
set_sb_fs_state(fs->fs_ondisk_sb, LOST_FOUND_DONE); set_sb_fs_state(fs->fs_ondisk_sb, LOST_FOUND_DONE);
@@ -362,7 +362,7 @@ static void after_lost_found(reiserfs_filsys_t *fs)
exit(EXIT_OK); exit(EXIT_OK);
} }
void pass_3a_look_for_lost(reiserfs_filsys_t *fs) void pass_3a_look_for_lost(reiserfs_filsys_t fs)
{ {
INITIALIZE_REISERFS_PATH(path); INITIALIZE_REISERFS_PATH(path);
struct item_head *ih; struct item_head *ih;
+14 -14
View File
@@ -14,7 +14,7 @@ extern int screen_width;
extern int screen_savebuffer_len; extern int screen_savebuffer_len;
extern char *screen_savebuffer; extern char *screen_savebuffer;
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
static char *badblocks_file; static char *badblocks_file;
#define print_usage_and_exit() { \ #define print_usage_and_exit() { \
@@ -508,7 +508,7 @@ static void register_timer(void)
alarm(1); alarm(1);
} }
static void reset_super_block(reiserfs_filsys_t *fs) static void reset_super_block(reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
struct reiserfs_journal_header *jh; struct reiserfs_journal_header *jh;
@@ -627,7 +627,7 @@ static void reset_super_block(reiserfs_filsys_t *fs)
#define START_FROM_PASS_4 6 #define START_FROM_PASS_4 6
/* this decides where to start from */ /* this decides where to start from */
static int where_to_start_from(reiserfs_filsys_t *fs) static int where_to_start_from(reiserfs_filsys_t fs)
{ {
int ret; int ret;
FILE *fp = NULL; FILE *fp = NULL;
@@ -714,7 +714,7 @@ static int where_to_start_from(reiserfs_filsys_t *fs)
return START_FROM_THE_BEGINNING; return START_FROM_THE_BEGINNING;
} }
static void reiserfs_update_interval_fields(reiserfs_filsys_t *fs) static void reiserfs_update_interval_fields(reiserfs_filsys_t fs)
{ {
/* Not supported on v3.5 */ /* Not supported on v3.5 */
if (get_sb_version(fs->fs_ondisk_sb) == REISERFS_FORMAT_3_5) if (get_sb_version(fs->fs_ondisk_sb) == REISERFS_FORMAT_3_5)
@@ -731,7 +731,7 @@ static void reiserfs_update_interval_fields(reiserfs_filsys_t *fs)
DEFAULT_CHECK_INTERVAL); DEFAULT_CHECK_INTERVAL);
} }
static void mark_filesystem_consistent(reiserfs_filsys_t *fs) static void mark_filesystem_consistent(reiserfs_filsys_t fs)
{ {
if (!is_opened_rw(fs)) if (!is_opened_rw(fs))
return; return;
@@ -759,7 +759,7 @@ static void mark_filesystem_consistent(reiserfs_filsys_t *fs)
mark_buffer_dirty(fs->fs_super_bh); mark_buffer_dirty(fs->fs_super_bh);
} }
static void reiserfsck_replay_journal(reiserfs_filsys_t *fs) static void reiserfsck_replay_journal(reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *on_place_sb; struct reiserfs_super_block *on_place_sb;
int sb_size = reiserfs_super_block_size(fs->fs_ondisk_sb); int sb_size = reiserfs_super_block_size(fs->fs_ondisk_sb);
@@ -797,7 +797,7 @@ static void reiserfsck_replay_journal(reiserfs_filsys_t *fs)
fs->fs_ondisk_sb = on_place_sb; fs->fs_ondisk_sb = on_place_sb;
} }
static int the_end(reiserfs_filsys_t *fs) static int the_end(reiserfs_filsys_t fs)
{ {
int ret = EXIT_FIXED; int ret = EXIT_FIXED;
@@ -834,7 +834,7 @@ static int the_end(reiserfs_filsys_t *fs)
} }
/* check umounted or read-only mounted filesystems only */ /* check umounted or read-only mounted filesystems only */
static void prepare_fs_for_check(reiserfs_filsys_t *fs) static void prepare_fs_for_check(reiserfs_filsys_t fs)
{ {
/* The method could be called from auto_check already. */ /* The method could be called from auto_check already. */
if (fs->fs_flags == O_RDWR) if (fs->fs_flags == O_RDWR)
@@ -890,7 +890,7 @@ static void prepare_fs_for_check(reiserfs_filsys_t *fs)
} }
} }
static void rebuild_tree(reiserfs_filsys_t *fs) static void rebuild_tree(reiserfs_filsys_t fs)
{ {
time_t t; time_t t;
int ret; int ret;
@@ -951,7 +951,7 @@ static void rebuild_tree(reiserfs_filsys_t *fs)
exit(ret); exit(ret);
} }
static void clean_attributes(reiserfs_filsys_t *fs) static void clean_attributes(reiserfs_filsys_t fs)
{ {
time_t t; time_t t;
@@ -997,7 +997,7 @@ static void clean_attributes(reiserfs_filsys_t *fs)
} }
static int reiserfs_check_auto_state(reiserfs_filsys_t *fs) static int reiserfs_check_auto_state(reiserfs_filsys_t fs)
{ {
time_t now = time(NULL); time_t now = time(NULL);
time_t lastcheck = get_sb_v2_lastcheck(fs->fs_ondisk_sb); time_t lastcheck = get_sb_v2_lastcheck(fs->fs_ondisk_sb);
@@ -1038,7 +1038,7 @@ static int reiserfs_check_auto_state(reiserfs_filsys_t *fs)
return 0; return 0;
} }
static int auto_check(reiserfs_filsys_t *fs) static int auto_check(reiserfs_filsys_t fs)
{ {
__u16 state; __u16 state;
int retval = 0; int retval = 0;
@@ -1137,7 +1137,7 @@ error:
} }
/* check umounted or read-only mounted filesystems only */ /* check umounted or read-only mounted filesystems only */
static void check_fs(reiserfs_filsys_t *fs) static void check_fs(reiserfs_filsys_t fs)
{ {
int retval = EXIT_OK; int retval = EXIT_OK;
time_t t; time_t t;
@@ -1285,7 +1285,7 @@ static int open_devices_for_rollback(char *file_name, struct fsck_data *data)
return 0; return 0;
} }
static void fsck_rollback(reiserfs_filsys_t *fs) static void fsck_rollback(reiserfs_filsys_t fs)
{ {
time_t t; time_t t;
+16 -16
View File
@@ -40,7 +40,7 @@ static int correct_direct_item_offset(__u64 offset, int format)
} }
/* bitmaps which are built on pass 0 and are used on pass 1 */ /* bitmaps which are built on pass 0 and are used on pass 1 */
static void make_aux_bitmaps(reiserfs_filsys_t *fs) static void make_aux_bitmaps(reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
@@ -171,7 +171,7 @@ static int correct_key_format(struct item_head *ih, int symlink)
#if 0 #if 0
/* fixme: we might try all available hashes */ /* fixme: we might try all available hashes */
static int prob_name(reiserfs_filsys_t *fs, static int prob_name(reiserfs_filsys_t fs,
char **name, int max_len, __u32 deh_offset) char **name, int max_len, __u32 deh_offset)
{ {
int start; /* */ int start; /* */
@@ -190,7 +190,7 @@ static int prob_name(reiserfs_filsys_t *fs,
} }
#endif #endif
static void hash_hits_init(reiserfs_filsys_t *fs) static void hash_hits_init(reiserfs_filsys_t fs)
{ {
fsck_data(fs)->rebuild.hash_amount = known_hashes(); fsck_data(fs)->rebuild.hash_amount = known_hashes();
fsck_data(fs)->rebuild.hash_hits = fsck_data(fs)->rebuild.hash_hits =
@@ -198,7 +198,7 @@ static void hash_hits_init(reiserfs_filsys_t *fs)
return; return;
} }
static void add_hash_hit(reiserfs_filsys_t *fs, int hash_code) static void add_hash_hit(reiserfs_filsys_t fs, int hash_code)
{ {
fsck_data(fs)->rebuild.hash_hits[hash_code]++; fsck_data(fs)->rebuild.hash_hits[hash_code]++;
} }
@@ -226,7 +226,7 @@ static int try_to_get_name_length(struct item_head *ih,
#undef DEBUG_VERIFY_DENTRY #undef DEBUG_VERIFY_DENTRY
/* check directory item and try to recover something */ /* check directory item and try to recover something */
static int verify_directory_item(reiserfs_filsys_t *fs, struct buffer_head *bh, static int verify_directory_item(reiserfs_filsys_t fs, struct buffer_head *bh,
int item_num) int item_num)
{ {
struct item_head *ih; struct item_head *ih;
@@ -612,7 +612,7 @@ static int is_wrong_short_key(struct reiserfs_key *key)
} }
/* 1 if some of fields in the block head of bh look bad */ /* 1 if some of fields in the block head of bh look bad */
int leaf_structure_check(reiserfs_filsys_t *fs, struct buffer_head *bh) int leaf_structure_check(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
struct block_head *blkh; struct block_head *blkh;
int free_space, counted; int free_space, counted;
@@ -671,7 +671,7 @@ int leaf_structure_check(reiserfs_filsys_t *fs, struct buffer_head *bh)
/* FIXME: we can improve fixing of broken keys: we can ssfe direct items which /* FIXME: we can improve fixing of broken keys: we can ssfe direct items which
go after stat data and have broken keys */ go after stat data and have broken keys */
static void pass0_correct_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh) static void pass0_correct_leaf(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
int file_format = KEY_FORMAT_UNDEFINED; int file_format = KEY_FORMAT_UNDEFINED;
struct item_head *ih; struct item_head *ih;
@@ -1837,12 +1837,12 @@ int is_leaf_bad(struct buffer_head *bh)
return bad; return bad;
} }
static int is_to_be_read(reiserfs_filsys_t *fs, unsigned long block) static int is_to_be_read(reiserfs_filsys_t fs, unsigned long block)
{ {
return reiserfs_bitmap_test_bit(fsck_source_bitmap(fs), block); return reiserfs_bitmap_test_bit(fsck_source_bitmap(fs), block);
} }
static void do_pass_0(reiserfs_filsys_t *fs) static void do_pass_0(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
unsigned long i; unsigned long i;
@@ -2028,7 +2028,7 @@ void make_allocable(unsigned long block)
reiserfs_bitmap_clear_bit(fsck_allocable_bitmap(fs), block); reiserfs_bitmap_clear_bit(fsck_allocable_bitmap(fs), block);
} }
static void choose_hash_function(reiserfs_filsys_t *fs) static void choose_hash_function(reiserfs_filsys_t fs)
{ {
unsigned long max; unsigned long max;
unsigned int hash_code; unsigned int hash_code;
@@ -2078,7 +2078,7 @@ static void choose_hash_function(reiserfs_filsys_t *fs)
/* create bitmap of blocks the tree is to be built off */ /* create bitmap of blocks the tree is to be built off */
/* debugreiserfs and pass0 should share this code -s should show /* debugreiserfs and pass0 should share this code -s should show
the same as we could recover - test: zero first 32M */ the same as we could recover - test: zero first 32M */
static void init_source_bitmap(reiserfs_filsys_t *fs) static void init_source_bitmap(reiserfs_filsys_t fs)
{ {
FILE *fp; FILE *fp;
unsigned long block_count = get_sb_block_count(fs->fs_ondisk_sb); unsigned long block_count = get_sb_block_count(fs->fs_ondisk_sb);
@@ -2214,7 +2214,7 @@ static void init_source_bitmap(reiserfs_filsys_t *fs)
} }
static void before_pass_0(reiserfs_filsys_t *fs) static void before_pass_0(reiserfs_filsys_t fs)
{ {
/* bitmap of blocks to be read */ /* bitmap of blocks to be read */
init_source_bitmap(fs); init_source_bitmap(fs);
@@ -2229,7 +2229,7 @@ static void before_pass_0(reiserfs_filsys_t *fs)
hash_hits_init(fs); hash_hits_init(fs);
} }
static void save_pass_0_result(reiserfs_filsys_t *fs) static void save_pass_0_result(reiserfs_filsys_t fs)
{ {
FILE *file; FILE *file;
int retval; int retval;
@@ -2255,7 +2255,7 @@ static void save_pass_0_result(reiserfs_filsys_t *fs)
/* file 'fp' must contain 3 bitmaps saved during last pass 0: bitmap /* file 'fp' must contain 3 bitmaps saved during last pass 0: bitmap
of leaves, bitmaps of good and bad unfms*/ of leaves, bitmaps of good and bad unfms*/
void load_pass_0_result(FILE * fp, reiserfs_filsys_t *fs) void load_pass_0_result(FILE * fp, reiserfs_filsys_t fs)
{ {
leaves_bitmap = reiserfs_bitmap_load(fp); leaves_bitmap = reiserfs_bitmap_load(fp);
good_unfm_bitmap = reiserfs_bitmap_load(fp); good_unfm_bitmap = reiserfs_bitmap_load(fp);
@@ -2274,7 +2274,7 @@ void load_pass_0_result(FILE * fp, reiserfs_filsys_t *fs)
reiserfs_bitmap_ones(bad_unfm_bitmap)); reiserfs_bitmap_ones(bad_unfm_bitmap));
} }
static void after_pass_0(reiserfs_filsys_t *fs) static void after_pass_0(reiserfs_filsys_t fs)
{ {
time_t t; time_t t;
@@ -2317,7 +2317,7 @@ static void after_pass_0(reiserfs_filsys_t *fs)
exit(0); exit(0);
} }
void pass_0(reiserfs_filsys_t *fs) void pass_0(reiserfs_filsys_t fs)
{ {
if (get_reiserfs_format(fs->fs_ondisk_sb) != fs->fs_format || if (get_reiserfs_format(fs->fs_ondisk_sb) != fs->fs_format ||
get_reiserfs_format(fs->fs_ondisk_sb) == REISERFS_FORMAT_UNKNOWN) { get_reiserfs_format(fs->fs_ondisk_sb) == REISERFS_FORMAT_UNKNOWN) {
+9 -9
View File
@@ -340,7 +340,7 @@ out:
3. what we should do with directory entries hashed by another hash? 3. what we should do with directory entries hashed by another hash?
they are deleted for now they are deleted for now
*/ */
static void pass1_correct_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh) static void pass1_correct_leaf(reiserfs_filsys_t fs, struct buffer_head *bh)
{ {
unsigned int i, j; unsigned int i, j;
struct item_head *ih; struct item_head *ih;
@@ -483,7 +483,7 @@ struct si *remove_saved_item(struct si *si)
/* fsck starts creating of this bitmap on pass 1. It will then become /* fsck starts creating of this bitmap on pass 1. It will then become
on-disk bitmap */ on-disk bitmap */
static void init_new_bitmap(reiserfs_filsys_t *fs) static void init_new_bitmap(reiserfs_filsys_t fs)
{ {
unsigned int i; unsigned int i;
unsigned long block; unsigned long block;
@@ -553,7 +553,7 @@ static void init_new_bitmap(reiserfs_filsys_t *fs)
/* this makes a map of blocks which can be allocated when fsck will /* this makes a map of blocks which can be allocated when fsck will
continue */ continue */
static void find_allocable_blocks(reiserfs_filsys_t *fs) static void find_allocable_blocks(reiserfs_filsys_t fs)
{ {
unsigned long i; unsigned long i;
@@ -596,7 +596,7 @@ static void find_allocable_blocks(reiserfs_filsys_t *fs)
fs->block_deallocator = reiserfsck_reiserfs_free_block; fs->block_deallocator = reiserfsck_reiserfs_free_block;
} }
static void before_pass_1(reiserfs_filsys_t *fs) static void before_pass_1(reiserfs_filsys_t fs)
{ {
/* this will become an on-disk bitmap */ /* this will become an on-disk bitmap */
init_new_bitmap(fs); init_new_bitmap(fs);
@@ -617,7 +617,7 @@ static void before_pass_1(reiserfs_filsys_t *fs)
/* pass 1 does not deal with objectid */ /* pass 1 does not deal with objectid */
} }
static void save_pass_1_result(reiserfs_filsys_t *fs) static void save_pass_1_result(reiserfs_filsys_t fs)
{ {
FILE *file; FILE *file;
int retval; int retval;
@@ -645,7 +645,7 @@ static void save_pass_1_result(reiserfs_filsys_t *fs)
state_dump_file(fs)); state_dump_file(fs));
} }
void load_pass_1_result(FILE * fp, reiserfs_filsys_t *fs) void load_pass_1_result(FILE * fp, reiserfs_filsys_t fs)
{ {
fsck_new_bitmap(fs) = fsck_new_bitmap(fs) =
reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb)); reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb));
@@ -676,7 +676,7 @@ void load_pass_1_result(FILE * fp, reiserfs_filsys_t *fs)
/* reads blocks marked in leaves_bitmap and tries to insert them into /* reads blocks marked in leaves_bitmap and tries to insert them into
tree */ tree */
static void do_pass_1(reiserfs_filsys_t *fs) static void do_pass_1(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
unsigned long i; unsigned long i;
@@ -775,7 +775,7 @@ static void do_pass_1(reiserfs_filsys_t *fs)
} }
static void after_pass_1(reiserfs_filsys_t *fs) static void after_pass_1(reiserfs_filsys_t fs)
{ {
time_t t; time_t t;
@@ -822,7 +822,7 @@ static void after_pass_1(reiserfs_filsys_t *fs)
exit(0); exit(0);
} }
void pass_1(reiserfs_filsys_t *fs) void pass_1(reiserfs_filsys_t fs)
{ {
fsck_progress("\nPass 1 (will try to insert %lu leaves):\n", fsck_progress("\nPass 1 (will try to insert %lu leaves):\n",
reiserfs_bitmap_ones(fsck_source_bitmap(fs))); reiserfs_bitmap_ones(fsck_source_bitmap(fs)));
+6 -6
View File
@@ -432,12 +432,12 @@ static void put_not_stat_data_items(struct buffer_head *bh)
} }
} }
static void before_pass_2(reiserfs_filsys_t *fs) static void before_pass_2(reiserfs_filsys_t fs)
{ {
/* anything specific for pass 2 ? */ /* anything specific for pass 2 ? */
} }
static void save_pass_2_result(reiserfs_filsys_t *fs) static void save_pass_2_result(reiserfs_filsys_t fs)
{ {
FILE *file; FILE *file;
int retval; int retval;
@@ -461,7 +461,7 @@ static void save_pass_2_result(reiserfs_filsys_t *fs)
/* we have nothing to load from a state file, but we have to fetch /* we have nothing to load from a state file, but we have to fetch
on-disk bitmap, copy it to allocable bitmap, and fetch objectid on-disk bitmap, copy it to allocable bitmap, and fetch objectid
map */ map */
void load_pass_2_result(reiserfs_filsys_t *fs) void load_pass_2_result(reiserfs_filsys_t fs)
{ {
fsck_new_bitmap(fs) = fsck_new_bitmap(fs) =
reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb)); reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb));
@@ -483,7 +483,7 @@ void load_pass_2_result(reiserfs_filsys_t *fs)
/* uninsertable blocks are marked by 0s in uninsertable_leaf_bitmap /* uninsertable blocks are marked by 0s in uninsertable_leaf_bitmap
during the pass 1. They must be not in the tree */ during the pass 1. They must be not in the tree */
static void do_pass_2(reiserfs_filsys_t *fs) static void do_pass_2(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
@@ -552,7 +552,7 @@ cont:
fsck_progress("\n"); fsck_progress("\n");
} }
static void after_pass_2(reiserfs_filsys_t *fs) static void after_pass_2(reiserfs_filsys_t fs)
{ {
time_t t; time_t t;
@@ -620,7 +620,7 @@ static void after_pass_2(reiserfs_filsys_t *fs)
exit(0); exit(0);
} }
void pass_2(reiserfs_filsys_t *fs) void pass_2(reiserfs_filsys_t fs)
{ {
if (fsck_log_file(fs) != stderr) if (fsck_log_file(fs) != stderr)
fsck_log("####### Pass 2 #######\n"); fsck_log("####### Pass 2 #######\n");
+6 -6
View File
@@ -1129,7 +1129,7 @@ void modify_item(struct item_head *ih, void *item)
} }
/* mkreiserfs should have created this */ /* mkreiserfs should have created this */
static void make_sure_lost_found_exists(reiserfs_filsys_t *fs) static void make_sure_lost_found_exists(reiserfs_filsys_t fs)
{ {
int retval; int retval;
INITIALIZE_REISERFS_PATH(path); INITIALIZE_REISERFS_PATH(path);
@@ -1226,7 +1226,7 @@ static void make_sure_lost_found_exists(reiserfs_filsys_t *fs)
/* Result of the rebuild pass will be saved in the state file which is needed to start /* Result of the rebuild pass will be saved in the state file which is needed to start
* fsck again from the next pass. */ * fsck again from the next pass. */
static void save_rebuild_semantic_result(reiserfs_filsys_t *fs) static void save_rebuild_semantic_result(reiserfs_filsys_t fs)
{ {
FILE *file; FILE *file;
int retval; int retval;
@@ -1251,7 +1251,7 @@ static void save_rebuild_semantic_result(reiserfs_filsys_t *fs)
/* we have nothing to load from a state file, but we have to fetch /* we have nothing to load from a state file, but we have to fetch
on-disk bitmap, copy it to allocable bitmap, and fetch objectid on-disk bitmap, copy it to allocable bitmap, and fetch objectid
map */ map */
void load_semantic_result(FILE * file, reiserfs_filsys_t *fs) void load_semantic_result(FILE * file, reiserfs_filsys_t fs)
{ {
fsck_new_bitmap(fs) = fsck_new_bitmap(fs) =
reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb)); reiserfs_create_bitmap(get_sb_block_count(fs->fs_ondisk_sb));
@@ -1272,12 +1272,12 @@ void load_semantic_result(FILE * file, reiserfs_filsys_t *fs)
*/ */
} }
static void before_pass_3(reiserfs_filsys_t *fs) static void before_pass_3(reiserfs_filsys_t fs)
{ {
semantic_id_map(fs) = id_map_init(); semantic_id_map(fs) = id_map_init();
} }
static void after_pass_3(reiserfs_filsys_t *fs) static void after_pass_3(reiserfs_filsys_t fs)
{ {
/* update super block: objectid map, fsck state */ /* update super block: objectid map, fsck state */
set_sb_fs_state(fs->fs_ondisk_sb, SEMANTIC_DONE); set_sb_fs_state(fs->fs_ondisk_sb, SEMANTIC_DONE);
@@ -1310,7 +1310,7 @@ static void after_pass_3(reiserfs_filsys_t *fs)
} }
/* this is part of rebuild tree */ /* this is part of rebuild tree */
void pass_3_semantic(reiserfs_filsys_t *fs) void pass_3_semantic(reiserfs_filsys_t fs)
{ {
before_pass_3(fs); before_pass_3(fs);
+2 -2
View File
@@ -38,7 +38,7 @@ static int what_fs_version(void)
return exit_code; \ return exit_code; \
} }
int check_sb (reiserfs_filsys_t *fs) { int check_sb (reiserfs_filsys_t fs) {
int magic = 0, version = 0; int magic = 0, version = 0;
if (!is_blocksize_correct (fs->fs_blocksize)) if (!is_blocksize_correct (fs->fs_blocksize))
@@ -168,7 +168,7 @@ int check_sb (reiserfs_filsys_t *fs) {
} }
*/ */
void rebuild_sb(reiserfs_filsys_t *fs, char *filename, struct fsck_data *data) void rebuild_sb(reiserfs_filsys_t fs, char *filename, struct fsck_data *data)
{ {
int version = 0; int version = 0;
struct reiserfs_super_block *ondisk_sb = NULL; struct reiserfs_super_block *ondisk_sb = NULL;
+2 -2
View File
@@ -86,7 +86,7 @@ void mark_block_uninsertable(unsigned long block)
} }
/* FIXME: should be able to work around no disk space */ /* FIXME: should be able to work around no disk space */
int reiserfsck_reiserfs_new_blocknrs(reiserfs_filsys_t *fs, int reiserfsck_reiserfs_new_blocknrs(reiserfs_filsys_t fs,
unsigned long *free_blocknrs, unsigned long *free_blocknrs,
unsigned long start, int amount_needed) unsigned long start, int amount_needed)
{ {
@@ -119,7 +119,7 @@ struct buffer_head *reiserfsck_get_new_buffer(unsigned long start)
} }
/* free block in new bitmap */ /* free block in new bitmap */
int reiserfsck_reiserfs_free_block(reiserfs_filsys_t *fs, unsigned long block) int reiserfsck_reiserfs_free_block(reiserfs_filsys_t fs, unsigned long block)
{ {
mark_block_free(block); mark_block_free(block);
+2 -2
View File
@@ -1397,7 +1397,7 @@ check_again:
return get_bytes_number(ih, fs->fs_blocksize); return get_bytes_number(ih, fs->fs_blocksize);
} }
void one_more_corruption(reiserfs_filsys_t *fs, int kind) void one_more_corruption(reiserfs_filsys_t fs, int kind)
{ {
if (kind == FATAL) if (kind == FATAL)
fsck_check_stat(fs)->fatal_corruptions++; fsck_check_stat(fs)->fatal_corruptions++;
@@ -1405,7 +1405,7 @@ void one_more_corruption(reiserfs_filsys_t *fs, int kind)
fsck_check_stat(fs)->fixable_corruptions++; fsck_check_stat(fs)->fixable_corruptions++;
} }
void one_less_corruption(reiserfs_filsys_t *fs, int kind) void one_less_corruption(reiserfs_filsys_t fs, int kind)
{ {
if (kind == FATAL) if (kind == FATAL)
fsck_check_stat(fs)->fatal_corruptions--; fsck_check_stat(fs)->fatal_corruptions--;
+2 -2
View File
@@ -209,7 +209,7 @@ start_again:
} }
} }
void id_map_flush(struct id_map *map, reiserfs_filsys_t *fs) void id_map_flush(struct id_map *map, reiserfs_filsys_t fs)
{ {
int size, max, i; int size, max, i;
__u32 id, prev_id; __u32 id, prev_id;
@@ -283,7 +283,7 @@ void id_map_flush(struct id_map *map, reiserfs_filsys_t *fs)
/* FIXME: these 3 methods must be implemented also. /* FIXME: these 3 methods must be implemented also.
void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t *fs) void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t fs)
{ {
int sb_size; int sb_size;
__le32 * sb_objectid_map; __le32 * sb_objectid_map;
+1 -1
View File
@@ -194,7 +194,7 @@ static void erase(void)
fflush(stdout); fflush(stdout);
} }
void pass_through_tree(reiserfs_filsys_t *fs, do_after_read_t action1, void pass_through_tree(reiserfs_filsys_t fs, do_after_read_t action1,
do_on_full_path_t action2, int depth) do_on_full_path_t action2, int depth)
{ {
struct buffer_head *path[MAX_HEIGHT] = { 0, }; struct buffer_head *path[MAX_HEIGHT] = { 0, };
+18 -18
View File
@@ -496,7 +496,7 @@ struct reiserfs_journal_header {
(unsigned long long)((8192 > journal_max_size (block_of_super_block,blocksize)) ? \ (unsigned long long)((8192 > journal_max_size (block_of_super_block,blocksize)) ? \
journal_max_size (block_of_super_block,blocksize) : 8192) journal_max_size (block_of_super_block,blocksize) : 8192)
int reiserfs_replay_journal(reiserfs_filsys_t *fs); int reiserfs_replay_journal(reiserfs_filsys_t fs);
//#define JOURNAL_DEFAULT_SIZE 8192 number of blocks in the journal //#define JOURNAL_DEFAULT_SIZE 8192 number of blocks in the journal
//#define JOURNAL_DEFAULT_SIZE_FOR_BS_1024 8125 number of blocks in the journal for block size 1KB //#define JOURNAL_DEFAULT_SIZE_FOR_BS_1024 8125 number of blocks in the journal for block size 1KB
@@ -1213,7 +1213,7 @@ struct virtual_node {
/* someday somebody will prefix every field in this struct with tb_ */ /* someday somebody will prefix every field in this struct with tb_ */
struct tree_balance { struct tree_balance {
struct reiserfs_transaction_handle *transaction_handle; struct reiserfs_transaction_handle *transaction_handle;
reiserfs_filsys_t *tb_fs; reiserfs_filsys_t tb_fs;
struct reiserfs_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 *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 *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */
@@ -1305,7 +1305,7 @@ struct tree_balance {
/* used in do_balance for passing parent of node information that has been /* used in do_balance for passing parent of node information that has been
gotten from tb struct */ gotten from tb struct */
struct buffer_info { struct buffer_info {
reiserfs_filsys_t *bi_fs; reiserfs_filsys_t bi_fs;
struct buffer_head * bi_bh; struct buffer_head * bi_bh;
struct buffer_head * bi_parent; struct buffer_head * bi_parent;
int bi_position; int bi_position;
@@ -1412,18 +1412,18 @@ struct buffer_info {
void padd_item (char * item, int total_length, int length); void padd_item (char * item, int total_length, int length);
int B_IS_IN_TREE(struct buffer_head *); int B_IS_IN_TREE(struct buffer_head *);
const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path, const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path,
const reiserfs_filsys_t *); const 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 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 reiserfs_key *, struct reiserfs_path *, int); 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_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_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 *); 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 decrement_counters_in_path (struct reiserfs_path *p_s_search_path);
void pathrelse (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 reiserfs_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 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); int are_items_mergeable (struct item_head * left, struct item_head * right, int bsize);
@@ -1445,8 +1445,8 @@ void init_path (struct reiserfs_path *);
void print_tb (int mode, int item_pos, int pos_in_item, struct tree_balance * tb, char * mes); void print_tb (int mode, int item_pos, int pos_in_item, struct tree_balance * tb, char * mes);
void print_bmap (FILE * fp, reiserfs_filsys_t *fs, int silent); void print_bmap (FILE * fp, reiserfs_filsys_t fs, int silent);
void print_objectid_map (FILE * fp, reiserfs_filsys_t *fs); void print_objectid_map (FILE * fp, reiserfs_filsys_t fs);
@@ -1468,8 +1468,8 @@ void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
void leaf_paste_entries (struct buffer_head * bh, int item_num, int before, int new_entry_count, void leaf_paste_entries (struct buffer_head * bh, int item_num, int before, int new_entry_count,
struct reiserfs_de_head * new_dehs, const char * records, struct reiserfs_de_head * new_dehs, const char * records,
int paste_size); int paste_size);
void delete_item (reiserfs_filsys_t *, struct buffer_head * bh, int item_num); void delete_item (reiserfs_filsys_t , struct buffer_head * bh, int item_num);
void cut_entry (reiserfs_filsys_t *, struct buffer_head * bh, void cut_entry (reiserfs_filsys_t , struct buffer_head * bh,
int item_num, int entry_num, int del_count); int item_num, int entry_num, int del_count);
@@ -1483,7 +1483,7 @@ void do_balance (struct tree_balance * tb,
void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh); void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh);
int get_left_neighbor_position (struct tree_balance * tb, int h); int get_left_neighbor_position (struct tree_balance * tb, int h);
int get_right_neighbor_position (struct tree_balance * tb, int h); int get_right_neighbor_position (struct tree_balance * tb, int h);
void replace_key (reiserfs_filsys_t *, struct buffer_head *, int, struct buffer_head *, int); void replace_key (reiserfs_filsys_t , struct buffer_head *, int, struct buffer_head *, int);
void replace_lkey (struct tree_balance *, int, struct item_head *); void replace_lkey (struct tree_balance *, int, struct item_head *);
void replace_rkey (struct tree_balance *, int, struct item_head *); void replace_rkey (struct tree_balance *, int, struct item_head *);
void make_empty_node (struct buffer_info *); void make_empty_node (struct buffer_info *);
@@ -1504,9 +1504,9 @@ __u32 r5_hash (const char *msg, int len);
/* node_format.c */ /* node_format.c */
extern unsigned int get_journal_old_start_must (reiserfs_filsys_t *fs); extern unsigned int get_journal_old_start_must (reiserfs_filsys_t fs);
extern unsigned int get_journal_new_start_must (reiserfs_filsys_t *fs); extern unsigned int get_journal_new_start_must (reiserfs_filsys_t fs);
extern unsigned int get_journal_start_must (reiserfs_filsys_t *fs); extern unsigned int get_journal_start_must (reiserfs_filsys_t fs);
/*extern hashf_t hashes [];*/ /*extern hashf_t hashes [];*/
static inline void buffer_info_init_left(struct tree_balance *tb, static inline void buffer_info_init_left(struct tree_balance *tb,
+76 -76
View File
@@ -9,7 +9,7 @@
#define BADBLOCK_DIRID 1 #define BADBLOCK_DIRID 1
#define BADBLOCK_OBJID (__u32)-1 #define BADBLOCK_OBJID (__u32)-1
typedef struct reiserfs_filsys reiserfs_filsys_t; typedef struct reiserfs_filsys * reiserfs_filsys_t;
#include "reiserfs_fs.h" #include "reiserfs_fs.h"
@@ -53,10 +53,10 @@ struct reiserfs_filsys {
int fs_dirt; int fs_dirt;
int fs_flags; int fs_flags;
void *fs_vp; void *fs_vp;
int (*block_allocator) (reiserfs_filsys_t *fs, int (*block_allocator) (reiserfs_filsys_t fs,
unsigned long *free_blocknrs, unsigned long *free_blocknrs,
unsigned long start, int amount_needed); unsigned long start, int amount_needed);
int (*block_deallocator) (reiserfs_filsys_t *fs, unsigned long block); int (*block_deallocator) (reiserfs_filsys_t fs, unsigned long block);
}; };
struct _transaction { struct _transaction {
@@ -72,25 +72,25 @@ typedef struct _transaction reiserfs_trans_t;
/* reiserfslib.c */ /* reiserfslib.c */
void init_tb_struct(struct tree_balance *tb, reiserfs_filsys_t *, void init_tb_struct(struct tree_balance *tb, reiserfs_filsys_t ,
struct reiserfs_path *path, int size); struct reiserfs_path *path, int size);
reiserfs_filsys_t *reiserfs_open(const char *filename, int flags, int *error, reiserfs_filsys_t reiserfs_open(const char *filename, int flags, int *error,
void *vp, int skip_check); void *vp, int skip_check);
reiserfs_filsys_t *reiserfs_create(char *filename, int version, reiserfs_filsys_t reiserfs_create(char *filename, int version,
unsigned long block_count, int block_size, unsigned long block_count, int block_size,
int default_journal, int new_format); int default_journal, int new_format);
void reiserfs_flush(reiserfs_filsys_t *); void reiserfs_flush(reiserfs_filsys_t );
void reiserfs_free(reiserfs_filsys_t *); void reiserfs_free(reiserfs_filsys_t );
void reiserfs_close(reiserfs_filsys_t *); void reiserfs_close(reiserfs_filsys_t );
void reiserfs_reopen(reiserfs_filsys_t *, int flags); void reiserfs_reopen(reiserfs_filsys_t , int flags);
int is_opened_rw(reiserfs_filsys_t *fs); int is_opened_rw(reiserfs_filsys_t fs);
/* /*
void reiserfs_read_bitmap_blocks (reiserfs_filsys_t *); void reiserfs_read_bitmap_blocks (reiserfs_filsys_t );
void reiserfs_free_bitmap_blocks (reiserfs_filsys_t *); void reiserfs_free_bitmap_blocks (reiserfs_filsys_t );
*/ */
int no_reiserfs_found(reiserfs_filsys_t *); int no_reiserfs_found(reiserfs_filsys_t );
int block_size_ok(int blocksize, int force); int block_size_ok(int blocksize, int force);
int is_block_count_correct(unsigned long block_of_super_block, int is_block_count_correct(unsigned long block_of_super_block,
unsigned int block_size, unsigned long block_count, unsigned int block_size, unsigned long block_count,
@@ -99,37 +99,37 @@ int is_block_count_correct(unsigned long block_of_super_block,
unsigned long get_size_of_journal_or_reserved_area(struct reiserfs_super_block unsigned long get_size_of_journal_or_reserved_area(struct reiserfs_super_block
*sb); *sb);
int reiserfs_new_blocknrs(reiserfs_filsys_t *, int reiserfs_new_blocknrs(reiserfs_filsys_t ,
unsigned long *free_blocknrs, unsigned long start, unsigned long *free_blocknrs, unsigned long start,
int amount_needed); int amount_needed);
int reiserfs_free_block(reiserfs_filsys_t *, unsigned long block); int reiserfs_free_block(reiserfs_filsys_t , unsigned long block);
int spread_bitmaps(reiserfs_filsys_t *); int spread_bitmaps(reiserfs_filsys_t );
int filesystem_dirty(reiserfs_filsys_t *); int filesystem_dirty(reiserfs_filsys_t );
void mark_filesystem_dirty(reiserfs_filsys_t *); void mark_filesystem_dirty(reiserfs_filsys_t );
void reiserfs_paste_into_item(reiserfs_filsys_t *, struct reiserfs_path *path, void reiserfs_paste_into_item(reiserfs_filsys_t , struct reiserfs_path *path,
const void *body, int size); const void *body, int size);
void reiserfs_insert_item(reiserfs_filsys_t *, struct reiserfs_path *path, void reiserfs_insert_item(reiserfs_filsys_t , struct reiserfs_path *path,
struct item_head *ih, const void *body); struct item_head *ih, const void *body);
int reiserfs_locate_entry(reiserfs_filsys_t *, struct reiserfs_key *dir, int reiserfs_locate_entry(reiserfs_filsys_t , struct reiserfs_key *dir,
char *name, struct reiserfs_path *path); char *name, struct reiserfs_path *path);
int reiserfs_find_entry(reiserfs_filsys_t *, struct reiserfs_key *dir, int reiserfs_find_entry(reiserfs_filsys_t , struct reiserfs_key *dir,
char *name, unsigned int *min_gen_counter, char *name, unsigned int *min_gen_counter,
struct reiserfs_key *key); struct reiserfs_key *key);
int reiserfs_add_entry(reiserfs_filsys_t *, struct reiserfs_key *dir, int reiserfs_add_entry(reiserfs_filsys_t , struct reiserfs_key *dir,
char *name, int name_len, struct reiserfs_key *key, char *name, int name_len, struct reiserfs_key *key,
__u16 fsck_need); __u16 fsck_need);
struct reiserfs_key *uget_lkey(struct reiserfs_path *path); struct reiserfs_key *uget_lkey(struct reiserfs_path *path);
struct reiserfs_key *uget_rkey(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, int reiserfs_search_by_key_3(reiserfs_filsys_t , struct reiserfs_key *key,
struct reiserfs_path *path); struct reiserfs_path *path);
int reiserfs_search_by_key_4(reiserfs_filsys_t *, struct reiserfs_key *key, int reiserfs_search_by_key_4(reiserfs_filsys_t , struct reiserfs_key *key,
struct reiserfs_path *path); struct reiserfs_path *path);
int reiserfs_search_by_entry_key(reiserfs_filsys_t *, struct reiserfs_key *key, int reiserfs_search_by_entry_key(reiserfs_filsys_t , struct reiserfs_key *key,
struct reiserfs_path *path); struct reiserfs_path *path);
int reiserfs_search_by_position(reiserfs_filsys_t *, struct reiserfs_key *key, int reiserfs_search_by_position(reiserfs_filsys_t , struct reiserfs_key *key,
int version, struct reiserfs_path *path); int version, struct reiserfs_path *path);
struct reiserfs_key *reiserfs_next_key(struct reiserfs_path *path); struct reiserfs_key *reiserfs_next_key(struct reiserfs_path *path);
void copy_key(void *to, const void *from); void copy_key(void *to, const void *from);
@@ -141,22 +141,22 @@ 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); __u32 hash_value(hashf_t func, char *name, int namelen);
int create_dir_sd(reiserfs_filsys_t *fs, int create_dir_sd(reiserfs_filsys_t fs,
struct reiserfs_path *path, struct reiserfs_key *key, struct reiserfs_path *path, struct reiserfs_key *key,
void (*modify_item) (struct item_head *, void *)); void (*modify_item) (struct item_head *, void *));
void make_sure_root_dir_exists(reiserfs_filsys_t *fs, void make_sure_root_dir_exists(reiserfs_filsys_t fs,
void (*modyfy_item) (struct item_head *, void *), void (*modyfy_item) (struct item_head *, void *),
int ih_flags); int ih_flags);
typedef void (*badblock_func_t) (reiserfs_filsys_t *fs, typedef void (*badblock_func_t) (reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, struct reiserfs_path *badblock_path,
void *data); void *data);
void mark_badblock(reiserfs_filsys_t *fs, struct reiserfs_path *badblock_path, void mark_badblock(reiserfs_filsys_t fs, struct reiserfs_path *badblock_path,
void *data); void *data);
int create_badblock_bitmap(reiserfs_filsys_t *fs, char *badblocks_file); 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 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); void badblock_list(reiserfs_filsys_t fs, badblock_func_t action, void *data);
#define reiserfs_fs_bmap_nr(fs) reiserfs_bmap_nr(get_sb_block_count(fs->fs_ondisk_sb), fs->fs_blocksize) #define reiserfs_fs_bmap_nr(fs) reiserfs_bmap_nr(get_sb_block_count(fs->fs_ondisk_sb), fs->fs_blocksize)
#define reiserfs_bmap_nr(count, blk_size) ((count - 1) / (blk_size * 8) + 1) #define reiserfs_bmap_nr(count, blk_size) ((count - 1) / (blk_size * 8) + 1)
#define reiserfs_bmap_over(nr) (nr > ((1LL << 16) - 1)) #define reiserfs_bmap_over(nr) (nr > ((1LL << 16) - 1))
@@ -168,13 +168,13 @@ extern __u16 root_dir_format;
extern __u16 lost_found_dir_format; extern __u16 lost_found_dir_format;
/* bitmap.c */ /* bitmap.c */
int reiserfs_open_ondisk_bitmap(reiserfs_filsys_t *); int reiserfs_open_ondisk_bitmap(reiserfs_filsys_t );
int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t *); int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t );
void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t *); void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t );
void reiserfs_close_ondisk_bitmap(reiserfs_filsys_t *); void reiserfs_close_ondisk_bitmap(reiserfs_filsys_t );
int reiserfs_flush_to_ondisk_bitmap(reiserfs_bitmap_t *bm, int reiserfs_flush_to_ondisk_bitmap(reiserfs_bitmap_t *bm,
reiserfs_filsys_t *fs); reiserfs_filsys_t fs);
unsigned int reiserfs_calc_bmap_nr(reiserfs_filsys_t *fs, unsigned int blocks); unsigned int reiserfs_calc_bmap_nr(reiserfs_filsys_t fs, unsigned int blocks);
reiserfs_bitmap_t *reiserfs_create_bitmap(unsigned int bit_count); reiserfs_bitmap_t *reiserfs_create_bitmap(unsigned int bit_count);
int reiserfs_expand_bitmap(reiserfs_bitmap_t *bm, unsigned int bit_count); int reiserfs_expand_bitmap(reiserfs_bitmap_t *bm, unsigned int bit_count);
@@ -191,8 +191,8 @@ void reiserfs_bitmap_clear_bit(reiserfs_bitmap_t *bm, unsigned int bit_number);
int reiserfs_bitmap_test_bit(reiserfs_bitmap_t *bm, unsigned int bit_number); int reiserfs_bitmap_test_bit(reiserfs_bitmap_t *bm, unsigned int bit_number);
int reiserfs_bitmap_find_zero_bit(reiserfs_bitmap_t *bm, unsigned long *start); int reiserfs_bitmap_find_zero_bit(reiserfs_bitmap_t *bm, unsigned long *start);
/*int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t *bm, reiserfs_filsys_t *);*/ /*int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t *bm, reiserfs_filsys_t );*/
/*int reiserfs_flush_bitmap (reiserfs_bitmap_t *bm, reiserfs_filsys_t *);*/ /*int reiserfs_flush_bitmap (reiserfs_bitmap_t *bm, reiserfs_filsys_t );*/
void reiserfs_bitmap_zero(reiserfs_bitmap_t *bm); void reiserfs_bitmap_zero(reiserfs_bitmap_t *bm);
void reiserfs_bitmap_fill(reiserfs_bitmap_t *bm); void reiserfs_bitmap_fill(reiserfs_bitmap_t *bm);
unsigned int reiserfs_bitmap_ones(reiserfs_bitmap_t *bm); unsigned int reiserfs_bitmap_ones(reiserfs_bitmap_t *bm);
@@ -211,7 +211,7 @@ int is_stage_magic_correct(FILE * fp);
reiserfs_bitmap_t *reiserfs_bitmap_load(FILE * fp); reiserfs_bitmap_t *reiserfs_bitmap_load(FILE * fp);
void reiserfs_bitmap_invert(reiserfs_bitmap_t *bm); void reiserfs_bitmap_invert(reiserfs_bitmap_t *bm);
int reiserfs_remove_entry(reiserfs_filsys_t *, struct reiserfs_key *key); int reiserfs_remove_entry(reiserfs_filsys_t , struct reiserfs_key *key);
/* node_formats.c */ /* node_formats.c */
@@ -240,13 +240,13 @@ int is_a_leaf(char *buf, int blocksize);
int leaf_item_number_estimate(struct buffer_head *bh); int leaf_item_number_estimate(struct buffer_head *bh);
char *which_block(int code); char *which_block(int code);
int get_journal_size(reiserfs_filsys_t *); int get_journal_size(reiserfs_filsys_t );
int not_data_block(reiserfs_filsys_t *, unsigned long block); int not_data_block(reiserfs_filsys_t , unsigned long block);
int not_journalable(reiserfs_filsys_t *, unsigned long block); int not_journalable(reiserfs_filsys_t , unsigned long block);
int block_of_bitmap(reiserfs_filsys_t *, unsigned long block); int block_of_bitmap(reiserfs_filsys_t , unsigned long block);
int block_of_journal(reiserfs_filsys_t *, unsigned long block); int block_of_journal(reiserfs_filsys_t , unsigned long block);
int is_tree_node(struct buffer_head *bh, int level); int is_tree_node(struct buffer_head *bh, int level);
int is_properly_hashed(reiserfs_filsys_t *, int is_properly_hashed(reiserfs_filsys_t ,
char *name, int namelen, __u32 offset); char *name, int namelen, __u32 offset);
int dir_entry_bad_location(struct reiserfs_de_head *deh, int dir_entry_bad_location(struct reiserfs_de_head *deh,
struct item_head *ih, int first); struct item_head *ih, int first);
@@ -257,7 +257,7 @@ void make_empty_dir_item_v1(char *body, __u32 dirid, __u32 objid,
__u32 par_dirid, __u32 par_objid); __u32 par_dirid, __u32 par_objid);
void make_empty_dir_item(char *body, __u32 dirid, __u32 objid, void make_empty_dir_item(char *body, __u32 dirid, __u32 objid,
__u32 par_dirid, __u32 par_objid); __u32 par_dirid, __u32 par_objid);
int reiserfs_is_fs_consistent(reiserfs_filsys_t *fs); int reiserfs_is_fs_consistent(reiserfs_filsys_t fs);
typedef void (*item_action_t) (struct buffer_head * bh, struct item_head * ih); typedef void (*item_action_t) (struct buffer_head * bh, struct item_head * ih);
typedef void (*item_head_action_t) (struct item_head * ih); typedef void (*item_head_action_t) (struct item_head * ih);
@@ -276,8 +276,8 @@ 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, void set_type_and_offset(int format, struct reiserfs_key *key, loff_t offset,
int type); int type);
typedef int (*check_unfm_func_t) (reiserfs_filsys_t *, __u32); typedef int (*check_unfm_func_t) (reiserfs_filsys_t , __u32);
int is_it_bad_item(reiserfs_filsys_t *, struct item_head *, char *, int is_it_bad_item(reiserfs_filsys_t , struct item_head *, char *,
check_unfm_func_t, int bad_dir); check_unfm_func_t, int bad_dir);
#define hash_func_is_unknown(fs) ((fs)->fs_hash_function == NULL) #define hash_func_is_unknown(fs) ((fs)->fs_hash_function == NULL)
@@ -328,36 +328,36 @@ void get_set_sd_field(int field, struct item_head *ih, void *sd,
#define get_sd_first_direct_byte(ih,sd,pfdb) get_set_sd_field (GET_SD_FIRST_DIRECT_BYTE, ih, sd, pfdb, 0/*get*/) #define get_sd_first_direct_byte(ih,sd,pfdb) get_set_sd_field (GET_SD_FIRST_DIRECT_BYTE, ih, sd, pfdb, 0/*get*/)
#define set_sd_first_direct_byte(ih,sd,pfdb) get_set_sd_field (GET_SD_FIRST_DIRECT_BYTE, ih, sd, pfdb, 1/*set*/) #define set_sd_first_direct_byte(ih,sd,pfdb) get_set_sd_field (GET_SD_FIRST_DIRECT_BYTE, ih, sd, pfdb, 1/*set*/)
int is_objectid_used(reiserfs_filsys_t *fs, __u32 objectid); int is_objectid_used(reiserfs_filsys_t fs, __u32 objectid);
void mark_objectid_used(reiserfs_filsys_t *fs, __u32 objectid); void mark_objectid_used(reiserfs_filsys_t fs, __u32 objectid);
/* journal.c */ /* journal.c */
int get_boundary_transactions(reiserfs_filsys_t *, reiserfs_trans_t *, int get_boundary_transactions(reiserfs_filsys_t , reiserfs_trans_t *,
reiserfs_trans_t *); reiserfs_trans_t *);
int next_transaction(reiserfs_filsys_t *, reiserfs_trans_t *, reiserfs_trans_t); int next_transaction(reiserfs_filsys_t , reiserfs_trans_t *, reiserfs_trans_t);
int replay_one_transaction(reiserfs_filsys_t *, reiserfs_trans_t *); int replay_one_transaction(reiserfs_filsys_t , reiserfs_trans_t *);
typedef void (*action_on_trans_t) (reiserfs_filsys_t *, reiserfs_trans_t *); typedef void (*action_on_trans_t) (reiserfs_filsys_t , reiserfs_trans_t *);
void for_each_transaction(reiserfs_filsys_t *, action_on_trans_t); void for_each_transaction(reiserfs_filsys_t , action_on_trans_t);
typedef void (*action_on_block_t) (reiserfs_filsys_t *, reiserfs_trans_t *, typedef void (*action_on_block_t) (reiserfs_filsys_t , reiserfs_trans_t *,
unsigned int index, unsigned int index,
unsigned long in_journal, unsigned long in_journal,
unsigned long in_place); unsigned long in_place);
void for_each_block(reiserfs_filsys_t *fs, reiserfs_trans_t *trans, void for_each_block(reiserfs_filsys_t fs, reiserfs_trans_t *trans,
action_on_block_t action); action_on_block_t action);
int reiserfs_open_journal(reiserfs_filsys_t *, char *, int flags); int reiserfs_open_journal(reiserfs_filsys_t , char *, int flags);
int reiserfs_journal_params_check(reiserfs_filsys_t *fs); int reiserfs_journal_params_check(reiserfs_filsys_t fs);
int reiserfs_create_journal(reiserfs_filsys_t *fs, char *j_filename, int reiserfs_create_journal(reiserfs_filsys_t fs, char *j_filename,
unsigned long offset, unsigned long len, unsigned long offset, unsigned long len,
int transaction_max_size, int force); int transaction_max_size, int force);
int reiserfs_journal_opened(reiserfs_filsys_t *); int reiserfs_journal_opened(reiserfs_filsys_t );
void reiserfs_flush_journal(reiserfs_filsys_t *fs); void reiserfs_flush_journal(reiserfs_filsys_t fs);
void reiserfs_free_journal(reiserfs_filsys_t *fs); void reiserfs_free_journal(reiserfs_filsys_t fs);
void reiserfs_close_journal(reiserfs_filsys_t *); void reiserfs_close_journal(reiserfs_filsys_t );
void reiserfs_reopen_journal(reiserfs_filsys_t *fs, int flag); void reiserfs_reopen_journal(reiserfs_filsys_t fs, int flag);
__u32 advise_journal_max_trans_age(void); __u32 advise_journal_max_trans_age(void);
__u32 advise_journal_max_commit_age(void); __u32 advise_journal_max_commit_age(void);
__u32 advise_journal_max_batch(unsigned long journal_trans_max); __u32 advise_journal_max_batch(unsigned long journal_trans_max);
@@ -366,17 +366,17 @@ __u32 advise_journal_max_trans_len(__u32 desired, __u32 journal_size,
/* prints.c */ /* prints.c */
void print_indirect_item(FILE * fp, struct buffer_head *bh, int item_num); void print_indirect_item(FILE * fp, struct buffer_head *bh, int item_num);
void print_block(FILE * fp, reiserfs_filsys_t *, struct buffer_head *bh, ...); //int print_mode, int first, int last); void print_block(FILE * fp, reiserfs_filsys_t , struct buffer_head *bh, ...); //int print_mode, int first, int last);
int print_super_block(FILE * fp, reiserfs_filsys_t *, char *file_name, int print_super_block(FILE * fp, reiserfs_filsys_t , char *file_name,
struct buffer_head *bh, int short_print); struct buffer_head *bh, int short_print);
void print_journal(reiserfs_filsys_t *); void print_journal(reiserfs_filsys_t );
void print_journal_header(reiserfs_filsys_t *fs); void print_journal_header(reiserfs_filsys_t fs);
void reiserfs_warning(FILE * fp, const char *fmt, ...); void reiserfs_warning(FILE * fp, const char *fmt, ...);
char ftypelet(mode_t mode); char ftypelet(mode_t mode);
void reiserfs_print_item(FILE * fp, struct buffer_head *bh, void reiserfs_print_item(FILE * fp, struct buffer_head *bh,
struct item_head *ih); struct item_head *ih);
void print_filesystem_state(FILE * fp, reiserfs_filsys_t *fs); void print_filesystem_state(FILE * fp, reiserfs_filsys_t fs);
void print_one_transaction(reiserfs_filsys_t *fs, reiserfs_trans_t *trans); void print_one_transaction(reiserfs_filsys_t fs, reiserfs_trans_t *trans);
void print_journal_params(FILE * fp, struct journal_params *jp); void print_journal_params(FILE * fp, struct journal_params *jp);
char *get_reiserfs_version(__u16 version); char *get_reiserfs_version(__u16 version);
int can_we_format_it(char *device_name, int force); int can_we_format_it(char *device_name, int force);
+6 -6
View File
@@ -105,7 +105,7 @@ enum mkfs_mode {
static int mode; static int mode;
/* form super block (old one) */ /* form super block (old one) */
static void make_super_block(reiserfs_filsys_t *fs) static void make_super_block(reiserfs_filsys_t fs)
{ {
set_sb_umount_state(fs->fs_ondisk_sb, FS_CLEANLY_UMOUNTED); set_sb_umount_state(fs->fs_ondisk_sb, FS_CLEANLY_UMOUNTED);
set_sb_tree_height(fs->fs_ondisk_sb, 2); set_sb_tree_height(fs->fs_ondisk_sb, 2);
@@ -166,7 +166,7 @@ static void invalidate_other_formats(int dev)
brelse(bh); brelse(bh);
} }
static void zero_journal(reiserfs_filsys_t *fs) static void zero_journal(reiserfs_filsys_t fs)
{ {
unsigned long start, len, done; unsigned long start, len, done;
struct buffer_head *bh; struct buffer_head *bh;
@@ -197,7 +197,7 @@ static void zero_journal(reiserfs_filsys_t *fs)
/* this only sets few first bits in bitmap block. Fills not initialized fields /* this only sets few first bits in bitmap block. Fills not initialized fields
of super block (root block and bitmap block numbers) */ of super block (root block and bitmap block numbers) */
static void make_bitmap(reiserfs_filsys_t *fs) static void make_bitmap(reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *sb = fs->fs_ondisk_sb; struct reiserfs_super_block *sb = fs->fs_ondisk_sb;
unsigned int i; unsigned int i;
@@ -279,7 +279,7 @@ static void set_root_dir_nlink(struct item_head *ih, void *sd)
/* form the root block of the tree (the block head, the item head, the /* form the root block of the tree (the block head, the item head, the
root directory) */ root directory) */
static void make_root_block(reiserfs_filsys_t *fs) static void make_root_block(reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
struct buffer_head *bh; struct buffer_head *bh;
@@ -302,7 +302,7 @@ static void make_root_block(reiserfs_filsys_t *fs)
mark_objectid_used(fs, REISERFS_ROOT_OBJECTID); mark_objectid_used(fs, REISERFS_ROOT_OBJECTID);
} }
static void report(reiserfs_filsys_t *fs, char *j_filename) static void report(reiserfs_filsys_t fs, char *j_filename)
{ {
// print_block (stdout, fs, fs->fs_super_bh); // print_block (stdout, fs, fs->fs_super_bh);
struct reiserfs_super_block *sb = struct reiserfs_super_block *sb =
@@ -545,7 +545,7 @@ static int select_format(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
int force = 0; int force = 0;
char *device_name = NULL; char *device_name = NULL;
char *jdevice_name = NULL; char *jdevice_name = NULL;
+6 -6
View File
@@ -231,7 +231,7 @@ int reiserfs_bitmap_find_zero_bit(reiserfs_bitmap_t *bm, unsigned long *first)
/* read every bitmap block and copy their content into bitmap 'bm' */ /* read every bitmap block and copy their content into bitmap 'bm' */
static int reiserfs_fetch_ondisk_bitmap(reiserfs_bitmap_t *bm, static int reiserfs_fetch_ondisk_bitmap(reiserfs_bitmap_t *bm,
reiserfs_filsys_t *fs) reiserfs_filsys_t fs)
{ {
unsigned int last_byte_unused_bits; unsigned int last_byte_unused_bits;
unsigned long block, to_copy; unsigned long block, to_copy;
@@ -318,7 +318,7 @@ static int reiserfs_fetch_ondisk_bitmap(reiserfs_bitmap_t *bm,
/* copy bitmap 'bm' to buffers which hold on-disk bitmap if bitmap was ever /* copy bitmap 'bm' to buffers which hold on-disk bitmap if bitmap was ever
changed and return 1. Otherwise - return 0 */ changed and return 1. Otherwise - return 0 */
int reiserfs_flush_to_ondisk_bitmap(reiserfs_bitmap_t *bm, int reiserfs_flush_to_ondisk_bitmap(reiserfs_bitmap_t *bm,
reiserfs_filsys_t *fs) reiserfs_filsys_t fs)
{ {
unsigned int last_byte_unused_bits, i; unsigned int last_byte_unused_bits, i;
unsigned long to_copy, copied, block; unsigned long to_copy, copied, block;
@@ -688,7 +688,7 @@ void reiserfs_bitmap_invert(reiserfs_bitmap_t *bm)
/*reiserfs_warning (stderr, "done\n"); */ /*reiserfs_warning (stderr, "done\n"); */
} }
void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t *fs) void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t fs)
{ {
if (fs->fs_bitmap2) { if (fs->fs_bitmap2) {
reiserfs_delete_bitmap(fs->fs_bitmap2); reiserfs_delete_bitmap(fs->fs_bitmap2);
@@ -697,7 +697,7 @@ void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t *fs)
} }
/* read bitmap blocks */ /* read bitmap blocks */
int reiserfs_open_ondisk_bitmap(reiserfs_filsys_t *fs) int reiserfs_open_ondisk_bitmap(reiserfs_filsys_t fs)
{ {
unsigned int blocks = get_sb_block_count(fs->fs_ondisk_sb); unsigned int blocks = get_sb_block_count(fs->fs_ondisk_sb);
unsigned int bmap_nr = reiserfs_bmap_nr(blocks, fs->fs_blocksize); unsigned int bmap_nr = reiserfs_bmap_nr(blocks, fs->fs_blocksize);
@@ -731,7 +731,7 @@ int reiserfs_open_ondisk_bitmap(reiserfs_filsys_t *fs)
return reiserfs_fetch_ondisk_bitmap(fs->fs_bitmap2, fs); return reiserfs_fetch_ondisk_bitmap(fs->fs_bitmap2, fs);
} }
int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t *fs) int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t fs)
{ {
if (fs->fs_bitmap2) if (fs->fs_bitmap2)
reiserfs_panic("bitmap is initiaized already"); reiserfs_panic("bitmap is initiaized already");
@@ -744,7 +744,7 @@ int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t *fs)
return 1; return 1;
} }
void reiserfs_close_ondisk_bitmap(reiserfs_filsys_t *fs) void reiserfs_close_ondisk_bitmap(reiserfs_filsys_t fs)
{ {
if (!fs->fs_bitmap2) if (!fs->fs_bitmap2)
return; return;
+1 -1
View File
@@ -1420,7 +1420,7 @@ struct buffer_head *get_FEB(struct tree_balance *tb)
} }
/* Replace n_dest'th key in buffer dest by n_src'th key of buffer src.*/ /* Replace n_dest'th key in buffer dest by n_src'th key of buffer src.*/
void replace_key(reiserfs_filsys_t *fs, void replace_key(reiserfs_filsys_t fs,
struct buffer_head *dest, int n_dest, struct buffer_head *dest, int n_dest,
struct buffer_head *src, int n_src) struct buffer_head *src, int n_src)
{ {
+7 -7
View File
@@ -904,7 +904,7 @@ int are_items_mergeable(struct item_head *left, struct item_head *right,
} }
/* get left neighbor of the leaf node */ /* get left neighbor of the leaf node */
static struct buffer_head *get_left_neighbor(reiserfs_filsys_t *s, static struct buffer_head *get_left_neighbor(reiserfs_filsys_t s,
struct reiserfs_path *path) struct reiserfs_path *path)
{ {
struct reiserfs_key key; struct reiserfs_key key;
@@ -926,7 +926,7 @@ static struct buffer_head *get_left_neighbor(reiserfs_filsys_t *s,
return bh; return bh;
} }
static struct buffer_head *get_right_neighbor(reiserfs_filsys_t *s, static struct buffer_head *get_right_neighbor(reiserfs_filsys_t s,
struct reiserfs_path *path) struct reiserfs_path *path)
{ {
struct reiserfs_key key; struct reiserfs_key key;
@@ -953,7 +953,7 @@ static struct buffer_head *get_right_neighbor(reiserfs_filsys_t *s,
return bh; return bh;
} }
int is_left_mergeable(reiserfs_filsys_t *s, struct reiserfs_path *path) int is_left_mergeable(reiserfs_filsys_t s, struct reiserfs_path *path)
{ {
struct item_head *right; struct item_head *right;
struct buffer_head *bh; struct buffer_head *bh;
@@ -972,7 +972,7 @@ int is_left_mergeable(reiserfs_filsys_t *s, struct reiserfs_path *path)
return retval; return retval;
} }
int is_right_mergeable(reiserfs_filsys_t *s, struct reiserfs_path *path) int is_right_mergeable(reiserfs_filsys_t s, struct reiserfs_path *path)
{ {
struct item_head *left; struct item_head *left;
struct buffer_head *bh; struct buffer_head *bh;
@@ -1152,7 +1152,7 @@ static int get_empty_nodes(struct tree_balance *p_s_tb, int n_h)
unsigned long *p_n_blocknr, a_n_blocknrs[MAX_AMOUNT_NEEDED] = { 0, }; unsigned long *p_n_blocknr, a_n_blocknrs[MAX_AMOUNT_NEEDED] = { 0, };
int n_counter, n_number_of_freeblk, n_amount_needed, /* number of needed empty blocks */ int n_counter, n_number_of_freeblk, n_amount_needed, /* number of needed empty blocks */
n_repeat; n_repeat;
reiserfs_filsys_t *fs = p_s_tb->tb_fs; reiserfs_filsys_t fs = p_s_tb->tb_fs;
if (n_h == 0 && p_s_tb->insert_size[n_h] == 0x7fff) if (n_h == 0 && p_s_tb->insert_size[n_h] == 0x7fff)
return CARRY_ON; return CARRY_ON;
@@ -1267,7 +1267,7 @@ static int get_rfree(struct tree_balance *tb, int h)
static int is_left_neighbor_in_cache(struct tree_balance *p_s_tb, int n_h) static int is_left_neighbor_in_cache(struct tree_balance *p_s_tb, int n_h)
{ {
struct buffer_head *p_s_father; struct buffer_head *p_s_father;
reiserfs_filsys_t *fs = p_s_tb->tb_fs; reiserfs_filsys_t fs = p_s_tb->tb_fs;
unsigned long n_left_neighbor_blocknr; unsigned long n_left_neighbor_blocknr;
int n_left_neighbor_position; int n_left_neighbor_position;
@@ -2245,7 +2245,7 @@ static int get_neighbors(struct tree_balance *p_s_tb, int n_h)
int n_child_position, int n_child_position,
n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1); n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1);
unsigned long n_son_number; unsigned long n_son_number;
reiserfs_filsys_t *fs = p_s_tb->tb_fs; reiserfs_filsys_t fs = p_s_tb->tb_fs;
struct buffer_head *p_s_bh; struct buffer_head *p_s_bh;
/*struct virtual_node * vn = p_s_tb->tb_vn; */ /*struct virtual_node * vn = p_s_tb->tb_vn; */
+20 -20
View File
@@ -19,7 +19,7 @@ static int does_desc_match_commit(struct buffer_head *d_bh,
/* d_bh is descriptor, return number of block where commit block of this /* d_bh is descriptor, return number of block where commit block of this
transaction is to be */ transaction is to be */
static unsigned long commit_expected(reiserfs_filsys_t *fs, static unsigned long commit_expected(reiserfs_filsys_t fs,
struct buffer_head *d_bh) struct buffer_head *d_bh)
{ {
unsigned long offset; unsigned long offset;
@@ -35,7 +35,7 @@ static unsigned long commit_expected(reiserfs_filsys_t *fs,
/* d_bh contains journal descriptor, returns number of block where descriptor /* d_bh contains journal descriptor, returns number of block where descriptor
block of next transaction should be */ block of next transaction should be */
static unsigned long next_desc_expected(reiserfs_filsys_t *fs, static unsigned long next_desc_expected(reiserfs_filsys_t fs,
struct buffer_head *d_bh) struct buffer_head *d_bh)
{ {
unsigned long offset; unsigned long offset;
@@ -50,7 +50,7 @@ static unsigned long next_desc_expected(reiserfs_filsys_t *fs,
} }
/* common checks for validness of a transaction */ /* common checks for validness of a transaction */
static int transaction_check_content(reiserfs_filsys_t *fs, static int transaction_check_content(reiserfs_filsys_t fs,
reiserfs_trans_t *trans) reiserfs_trans_t *trans)
{ {
struct buffer_head *d_bh, *c_bh; struct buffer_head *d_bh, *c_bh;
@@ -102,7 +102,7 @@ error_desc_brelse:
} }
/* common checks for validness of a transaction */ /* common checks for validness of a transaction */
static int transaction_check_desc(reiserfs_filsys_t *fs, static int transaction_check_desc(reiserfs_filsys_t fs,
struct buffer_head *d_bh) struct buffer_head *d_bh)
{ {
struct buffer_head *c_bh; struct buffer_head *c_bh;
@@ -127,7 +127,7 @@ static int transaction_check_desc(reiserfs_filsys_t *fs,
/* read the journal and find the oldest and newest transactions, return number /* read the journal and find the oldest and newest transactions, return number
of transactions found */ of transactions found */
int get_boundary_transactions(reiserfs_filsys_t *fs, int get_boundary_transactions(reiserfs_filsys_t fs,
reiserfs_trans_t *oldest, reiserfs_trans_t *oldest,
reiserfs_trans_t *newest) reiserfs_trans_t *newest)
{ {
@@ -196,7 +196,7 @@ int get_boundary_transactions(reiserfs_filsys_t *fs,
/* trans is a valid transaction. Look for valid transaction with smallest /* trans is a valid transaction. Look for valid transaction with smallest
trans id which is greater than the id of the current one */ trans id which is greater than the id of the current one */
int next_transaction(reiserfs_filsys_t *fs, reiserfs_trans_t *trans, int next_transaction(reiserfs_filsys_t fs, reiserfs_trans_t *trans,
reiserfs_trans_t break_trans) reiserfs_trans_t break_trans)
{ {
struct buffer_head *d_bh, *next_d_bh; struct buffer_head *d_bh, *next_d_bh;
@@ -251,7 +251,7 @@ int next_transaction(reiserfs_filsys_t *fs, reiserfs_trans_t *trans,
return found; return found;
} }
static void read_journal_write_in_place(reiserfs_filsys_t *fs, static void read_journal_write_in_place(reiserfs_filsys_t fs,
reiserfs_trans_t *trans, reiserfs_trans_t *trans,
unsigned int index, unsigned int index,
unsigned long in_journal, unsigned long in_journal,
@@ -286,7 +286,7 @@ static void read_journal_write_in_place(reiserfs_filsys_t *fs,
} }
/* go through all blocks of transaction and call 'action' each of them */ /* go through all blocks of transaction and call 'action' each of them */
void for_each_block(reiserfs_filsys_t *fs, reiserfs_trans_t *trans, void for_each_block(reiserfs_filsys_t fs, reiserfs_trans_t *trans,
action_on_block_t action) action_on_block_t action)
{ {
struct buffer_head *d_bh, *c_bh; struct buffer_head *d_bh, *c_bh;
@@ -338,14 +338,14 @@ void for_each_block(reiserfs_filsys_t *fs, reiserfs_trans_t *trans,
} }
/* transaction is supposed to be valid */ /* transaction is supposed to be valid */
int replay_one_transaction(reiserfs_filsys_t *fs, reiserfs_trans_t *trans) int replay_one_transaction(reiserfs_filsys_t fs, reiserfs_trans_t *trans)
{ {
for_each_block(fs, trans, read_journal_write_in_place); for_each_block(fs, trans, read_journal_write_in_place);
fsync(fs->fs_dev); fsync(fs->fs_dev);
return 0; return 0;
} }
void for_each_transaction(reiserfs_filsys_t *fs, action_on_trans_t action) void for_each_transaction(reiserfs_filsys_t fs, action_on_trans_t action)
{ {
reiserfs_trans_t oldest, newest; reiserfs_trans_t oldest, newest;
int ret = 0; int ret = 0;
@@ -419,7 +419,7 @@ __u32 advise_journal_max_trans_age(void)
return JOURNAL_MAX_TRANS_AGE; return JOURNAL_MAX_TRANS_AGE;
} }
int reiserfs_journal_params_check(reiserfs_filsys_t *fs) int reiserfs_journal_params_check(reiserfs_filsys_t fs)
{ {
struct reiserfs_journal_header *j_head; struct reiserfs_journal_header *j_head;
struct reiserfs_super_block *sb = fs->fs_ondisk_sb; struct reiserfs_super_block *sb = fs->fs_ondisk_sb;
@@ -471,7 +471,7 @@ int reiserfs_journal_params_check(reiserfs_filsys_t *fs)
/* read journal header and make sure that it matches with the filesystem /* read journal header and make sure that it matches with the filesystem
opened */ opened */
int reiserfs_open_journal(reiserfs_filsys_t *fs, char *j_filename, int flags) int reiserfs_open_journal(reiserfs_filsys_t fs, char *j_filename, int flags)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
__u64 count; __u64 count;
@@ -551,7 +551,7 @@ int reiserfs_open_journal(reiserfs_filsys_t *fs, char *j_filename, int flags)
/* initialize super block's journal related fields and journal header fields. /* initialize super block's journal related fields and journal header fields.
* If len is 0 - make journal of default size */ * If len is 0 - make journal of default size */
int reiserfs_create_journal(reiserfs_filsys_t *fs, char *j_device, /* journal device name */ int reiserfs_create_journal(reiserfs_filsys_t fs, char *j_device, /* journal device name */
unsigned long offset, /* journal offset on the j_device */ unsigned long offset, /* journal offset on the j_device */
unsigned long len, /* including journal header */ unsigned long len, /* including journal header */
int transaction_max_size, int force) int transaction_max_size, int force)
@@ -744,7 +744,7 @@ int reiserfs_create_journal(reiserfs_filsys_t *fs, char *j_device, /* journal de
/* brelse journal header, flush all dirty buffers, close device, open, read /* brelse journal header, flush all dirty buffers, close device, open, read
journal header */ journal header */
void reiserfs_reopen_journal(reiserfs_filsys_t *fs, int flag) void reiserfs_reopen_journal(reiserfs_filsys_t fs, int flag)
{ {
unsigned long jh_block; unsigned long jh_block;
@@ -772,19 +772,19 @@ void reiserfs_reopen_journal(reiserfs_filsys_t *fs, int flag)
die("reiserfs_reopen_journal: reading journal header failed"); die("reiserfs_reopen_journal: reading journal header failed");
} }
int reiserfs_journal_opened(reiserfs_filsys_t *fs) int reiserfs_journal_opened(reiserfs_filsys_t fs)
{ {
return fs->fs_jh_bh ? 1 : 0; return fs->fs_jh_bh ? 1 : 0;
} }
void reiserfs_flush_journal(reiserfs_filsys_t *fs) void reiserfs_flush_journal(reiserfs_filsys_t fs)
{ {
if (!reiserfs_journal_opened(fs)) if (!reiserfs_journal_opened(fs))
return; return;
flush_buffers(fs->fs_journal_dev); flush_buffers(fs->fs_journal_dev);
} }
void reiserfs_free_journal(reiserfs_filsys_t *fs) void reiserfs_free_journal(reiserfs_filsys_t fs)
{ {
if (!reiserfs_journal_opened(fs)) if (!reiserfs_journal_opened(fs))
return; return;
@@ -794,7 +794,7 @@ void reiserfs_free_journal(reiserfs_filsys_t *fs)
fs->fs_j_file_name = NULL; fs->fs_j_file_name = NULL;
} }
void reiserfs_close_journal(reiserfs_filsys_t *fs) void reiserfs_close_journal(reiserfs_filsys_t fs)
{ {
reiserfs_flush_journal(fs); reiserfs_flush_journal(fs);
reiserfs_free_journal(fs); reiserfs_free_journal(fs);
@@ -802,7 +802,7 @@ void reiserfs_close_journal(reiserfs_filsys_t *fs)
} }
/* update journal header */ /* update journal header */
static void update_journal_header(reiserfs_filsys_t *fs, static void update_journal_header(reiserfs_filsys_t fs,
struct buffer_head *bh_jh, struct buffer_head *bh_jh,
reiserfs_trans_t *trans) reiserfs_trans_t *trans)
{ {
@@ -820,7 +820,7 @@ static void update_journal_header(reiserfs_filsys_t *fs,
} }
/* fixme: what should be done when not all transactions can be replayed in proper order? */ /* fixme: what should be done when not all transactions can be replayed in proper order? */
int reiserfs_replay_journal(reiserfs_filsys_t *fs) int reiserfs_replay_journal(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct reiserfs_journal_header *j_head; struct reiserfs_journal_header *j_head;
+2 -2
View File
@@ -1150,7 +1150,7 @@ void leaf_paste_entries(struct buffer_head *bh,
/* wrappers for operations on one separated node */ /* wrappers for operations on one separated node */
void delete_item(reiserfs_filsys_t *fs, struct buffer_head *bh, int item_num) void delete_item(reiserfs_filsys_t fs, struct buffer_head *bh, int item_num)
{ {
struct buffer_info bi; struct buffer_info bi;
@@ -1160,7 +1160,7 @@ void delete_item(reiserfs_filsys_t *fs, struct buffer_head *bh, int item_num)
leaf_delete_items_entirely(&bi, item_num, 1); leaf_delete_items_entirely(&bi, item_num, 1);
} }
void cut_entry(reiserfs_filsys_t *fs, struct buffer_head *bh, void cut_entry(reiserfs_filsys_t fs, struct buffer_head *bh,
int item_num, int entry_num, int del_count) int item_num, int entry_num, int del_count)
{ {
struct buffer_info bi; struct buffer_info bi;
+14 -14
View File
@@ -344,7 +344,7 @@ char *which_block(int code)
} }
/** */ /** */
int block_of_journal(reiserfs_filsys_t *fs, unsigned long block) int block_of_journal(reiserfs_filsys_t fs, unsigned long block)
{ {
if (!is_reiserfs_jr_magic_string(fs->fs_ondisk_sb)) { if (!is_reiserfs_jr_magic_string(fs->fs_ondisk_sb)) {
/* standard journal */ /* standard journal */
@@ -367,7 +367,7 @@ int block_of_journal(reiserfs_filsys_t *fs, unsigned long block)
return 0; return 0;
} }
int block_of_bitmap(reiserfs_filsys_t *fs, unsigned long block) int block_of_bitmap(reiserfs_filsys_t fs, unsigned long block)
{ {
if (spread_bitmaps(fs)) { if (spread_bitmaps(fs)) {
if (!(block % (fs->fs_blocksize * 8))) if (!(block % (fs->fs_blocksize * 8)))
@@ -384,7 +384,7 @@ int block_of_bitmap(reiserfs_filsys_t *fs, unsigned long block)
} }
/* check whether 'block' can be pointed to by an indirect item */ /* check whether 'block' can be pointed to by an indirect item */
int not_data_block(reiserfs_filsys_t *fs, unsigned long block) int not_data_block(reiserfs_filsys_t fs, unsigned long block)
{ {
if (block_of_bitmap(fs, block)) if (block_of_bitmap(fs, block))
/* it is one of bitmap blocks */ /* it is one of bitmap blocks */
@@ -403,7 +403,7 @@ int not_data_block(reiserfs_filsys_t *fs, unsigned long block)
} }
/* check whether 'block' can be logged */ /* check whether 'block' can be logged */
int not_journalable(reiserfs_filsys_t *fs, unsigned long block) int not_journalable(reiserfs_filsys_t fs, unsigned long block)
{ {
/* we should not update SB with journal copy during fsck */ /* we should not update SB with journal copy during fsck */
if (block < fs->fs_super_bh->b_blocknr) if (block < fs->fs_super_bh->b_blocknr)
@@ -420,18 +420,18 @@ int not_journalable(reiserfs_filsys_t *fs, unsigned long block)
// in reiserfs version 0 (undistributed bitmap) // in reiserfs version 0 (undistributed bitmap)
// FIXME: what if number of bitmaps is 15? // FIXME: what if number of bitmaps is 15?
unsigned int get_journal_old_start_must(reiserfs_filsys_t *fs) unsigned int get_journal_old_start_must(reiserfs_filsys_t fs)
{ {
return (REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 1 + return (REISERFS_OLD_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 1 +
get_sb_bmap_nr(fs->fs_ondisk_sb); get_sb_bmap_nr(fs->fs_ondisk_sb);
} }
unsigned int get_journal_new_start_must(reiserfs_filsys_t *fs) unsigned int get_journal_new_start_must(reiserfs_filsys_t fs)
{ {
return (REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 2; return (REISERFS_DISK_OFFSET_IN_BYTES / fs->fs_blocksize) + 2;
} }
unsigned int get_journal_start_must(reiserfs_filsys_t *fs) unsigned int get_journal_start_must(reiserfs_filsys_t fs)
{ {
if (is_old_sb_location(fs->fs_super_bh->b_blocknr, fs->fs_blocksize)) if (is_old_sb_location(fs->fs_super_bh->b_blocknr, fs->fs_blocksize))
return get_journal_old_start_must(fs); return get_journal_old_start_must(fs);
@@ -456,7 +456,7 @@ __u32 get_bytes_number(struct item_head * ih, int blocksize)
return 0; return 0;
} }
int check_item_f(reiserfs_filsys_t *fs, struct item_head *ih, char *item); int check_item_f(reiserfs_filsys_t fs, struct item_head *ih, char *item);
/* ih_key, ih_location and ih_item_len seem correct, check other fields */ /* ih_key, ih_location and ih_item_len seem correct, check other fields */
static int does_ih_look_correct(struct item_head *ih) static int does_ih_look_correct(struct item_head *ih)
@@ -491,7 +491,7 @@ static int does_ih_look_correct(struct item_head *ih)
/* check item length, ih_free_space for pure 3.5 format, unformatted node /* check item length, ih_free_space for pure 3.5 format, unformatted node
pointers */ pointers */
static int is_bad_indirect(reiserfs_filsys_t *fs, struct item_head *ih, static int is_bad_indirect(reiserfs_filsys_t fs, struct item_head *ih,
char *item, check_unfm_func_t check_unfm_func) char *item, check_unfm_func_t check_unfm_func)
{ {
unsigned int i; unsigned int i;
@@ -536,7 +536,7 @@ int known_hashes(void)
(hash_value (hashfn, name, namelen) == GET_HASH_VALUE (deh_offset)) (hash_value (hashfn, name, namelen) == GET_HASH_VALUE (deh_offset))
/* this also sets hash function */ /* this also sets hash function */
int is_properly_hashed(reiserfs_filsys_t *fs, int is_properly_hashed(reiserfs_filsys_t fs,
char *name, int namelen, __u32 offset) char *name, int namelen, __u32 offset)
{ {
unsigned int i; unsigned int i;
@@ -665,7 +665,7 @@ int dir_entry_bad_location(struct reiserfs_de_head *deh, struct item_head *ih,
/* the only corruption which is not considered fatal - is hash mismatching. If /* the only corruption which is not considered fatal - is hash mismatching. If
bad_dir is set - directory item having such names is considered bad */ bad_dir is set - directory item having such names is considered bad */
static int is_bad_directory(reiserfs_filsys_t *fs, struct item_head *ih, static int is_bad_directory(reiserfs_filsys_t fs, struct item_head *ih,
char *item, int bad_dir) char *item, int bad_dir)
{ {
int i; int i;
@@ -702,7 +702,7 @@ static int is_bad_directory(reiserfs_filsys_t *fs, struct item_head *ih,
} }
/* used by debugreisrefs -p only yet */ /* used by debugreisrefs -p only yet */
int is_it_bad_item(reiserfs_filsys_t *fs, struct item_head *ih, char *item, int is_it_bad_item(reiserfs_filsys_t fs, struct item_head *ih, char *item,
check_unfm_func_t check_unfm, int bad_dir) check_unfm_func_t check_unfm, int bad_dir)
{ {
int retval; int retval;
@@ -1159,7 +1159,7 @@ static int comp_ids(const void *p1, const void *p2)
/* functions to manipulate with super block's objectid map */ /* functions to manipulate with super block's objectid map */
int is_objectid_used(reiserfs_filsys_t *fs, __u32 objectid) int is_objectid_used(reiserfs_filsys_t fs, __u32 objectid)
{ {
__le32 *objectid_map; __le32 *objectid_map;
__u32 count = get_sb_oid_cursize(fs->fs_ondisk_sb); __u32 count = get_sb_oid_cursize(fs->fs_ondisk_sb);
@@ -1183,7 +1183,7 @@ int is_objectid_used(reiserfs_filsys_t *fs, __u32 objectid)
return !(pos & 1); return !(pos & 1);
} }
void mark_objectid_used(reiserfs_filsys_t *fs, __u32 objectid) void mark_objectid_used(reiserfs_filsys_t fs, __u32 objectid)
{ {
int i; int i;
__le32 *objectid_map; __le32 *objectid_map;
+11 -11
View File
@@ -272,7 +272,7 @@ static void print_path(struct tree_balance *tb, struct reiserfs_path *path)
} }
} }
static void print_directory_item(FILE *fp, reiserfs_filsys_t *fs, static void print_directory_item(FILE *fp, reiserfs_filsys_t fs,
struct buffer_head *bh, struct item_head *ih) struct buffer_head *bh, struct item_head *ih)
{ {
int i; int i;
@@ -500,7 +500,7 @@ static int print_internal(FILE * fp, struct buffer_head *bh, int first,
} }
static int is_symlink = 0; static int is_symlink = 0;
static int print_leaf(FILE * fp, reiserfs_filsys_t *fs, struct buffer_head *bh, static int print_leaf(FILE * fp, reiserfs_filsys_t fs, struct buffer_head *bh,
int print_mode, int first, int last) int print_mode, int first, int last)
{ {
struct item_head *ih; struct item_head *ih;
@@ -606,7 +606,7 @@ void print_journal_params(FILE * fp, struct journal_params *jp)
} }
/* return 1 if this is not super block */ /* return 1 if this is not super block */
int print_super_block(FILE * fp, reiserfs_filsys_t *fs, char *file_name, int print_super_block(FILE * fp, reiserfs_filsys_t fs, char *file_name,
struct buffer_head *bh, int short_print) struct buffer_head *bh, int short_print)
{ {
struct reiserfs_super_block *sb = struct reiserfs_super_block *sb =
@@ -730,7 +730,7 @@ int print_super_block(FILE * fp, reiserfs_filsys_t *fs, char *file_name,
return 0; return 0;
} }
void print_filesystem_state(FILE * fp, reiserfs_filsys_t *fs) void print_filesystem_state(FILE * fp, reiserfs_filsys_t fs)
{ {
reiserfs_warning(fp, "\nFilesystem state: "); reiserfs_warning(fp, "\nFilesystem state: ");
if (reiserfs_is_fs_consistent(fs)) if (reiserfs_is_fs_consistent(fs))
@@ -753,7 +753,7 @@ static int print_desc_block(FILE * fp, struct buffer_head *bh)
return 0; return 0;
} }
void print_block(FILE * fp, reiserfs_filsys_t *fs, struct buffer_head *bh, ...) //int print_mode, int first, int last) void print_block(FILE * fp, reiserfs_filsys_t fs, struct buffer_head *bh, ...) //int print_mode, int first, int last)
{ {
va_list args; va_list args;
int mode, first, last; int mode, first, last;
@@ -970,7 +970,7 @@ end2:
} }
/* read bitmap of disk and print details */ /* read bitmap of disk and print details */
void print_bmap(FILE * fp, reiserfs_filsys_t *fs, int silent) void print_bmap(FILE * fp, reiserfs_filsys_t fs, int silent)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
int bmap_nr; int bmap_nr;
@@ -1013,7 +1013,7 @@ void print_bmap(FILE * fp, reiserfs_filsys_t *fs, int silent)
} }
} }
void print_objectid_map(FILE * fp, reiserfs_filsys_t *fs) void print_objectid_map(FILE * fp, reiserfs_filsys_t fs)
{ {
int i; int i;
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
@@ -1057,7 +1057,7 @@ void print_objectid_map(FILE * fp, reiserfs_filsys_t *fs)
} }
void print_journal_header(reiserfs_filsys_t *fs) void print_journal_header(reiserfs_filsys_t fs)
{ {
struct reiserfs_journal_header *j_head; struct reiserfs_journal_header *j_head;
@@ -1073,7 +1073,7 @@ void print_journal_header(reiserfs_filsys_t *fs)
print_journal_params(stdout, &j_head->jh_journal); print_journal_params(stdout, &j_head->jh_journal);
} }
static void print_trans_element(reiserfs_filsys_t *fs, static void print_trans_element(reiserfs_filsys_t fs,
reiserfs_trans_t *trans, unsigned int index, reiserfs_trans_t *trans, unsigned int index,
unsigned long in_journal, unsigned long in_journal,
unsigned long in_place) unsigned long in_place)
@@ -1087,7 +1087,7 @@ static void print_trans_element(reiserfs_filsys_t *fs,
reiserfs_warning(stdout, "\n"); reiserfs_warning(stdout, "\n");
} }
void print_one_transaction(reiserfs_filsys_t *fs, reiserfs_trans_t *trans) void print_one_transaction(reiserfs_filsys_t fs, reiserfs_trans_t *trans)
{ {
reiserfs_warning(stdout, reiserfs_warning(stdout,
"Mountid %u, transid %u, desc %lu, length %u, commit %lu\n", "Mountid %u, transid %u, desc %lu, length %u, commit %lu\n",
@@ -1097,7 +1097,7 @@ void print_one_transaction(reiserfs_filsys_t *fs, reiserfs_trans_t *trans)
} }
/* print all valid transactions and found dec blocks */ /* print all valid transactions and found dec blocks */
void print_journal(reiserfs_filsys_t *fs) void print_journal(reiserfs_filsys_t fs)
{ {
if (!reiserfs_journal_opened(fs)) { if (!reiserfs_journal_opened(fs)) {
reiserfs_warning(stderr, reiserfs_warning(stderr,
+35 -35
View File
@@ -54,10 +54,10 @@ int is_block_count_correct(unsigned long journal_offset,
/* read super block. fixme: only 4k blocks, pre-journaled format /* read super block. fixme: only 4k blocks, pre-journaled format
is refused. Journal and bitmap are to be opened separately. is refused. Journal and bitmap are to be opened separately.
skip_check is set to 1 if checks of openned SB should be omitted.*/ skip_check is set to 1 if checks of openned SB should be omitted.*/
reiserfs_filsys_t *reiserfs_open(const char *filename, int flags, reiserfs_filsys_t reiserfs_open(const char *filename, int flags,
int *error, void *vp, int check) int *error, void *vp, int check)
{ {
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
struct buffer_head *bh; struct buffer_head *bh;
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
int fd; int fd;
@@ -184,13 +184,13 @@ found:
/* creates buffer for super block and fills it up with fields which are /* creates buffer for super block and fills it up with fields which are
constant for given size and version of a filesystem */ constant for given size and version of a filesystem */
reiserfs_filsys_t *reiserfs_create(char *filename, reiserfs_filsys_t reiserfs_create(char *filename,
int version, int version,
unsigned long block_count, unsigned long block_count,
int block_size, int block_size,
int default_journal, int new_format) int default_journal, int new_format)
{ {
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
time_t now; time_t now;
unsigned int bmap_nr = reiserfs_bmap_nr(block_count, block_size);; unsigned int bmap_nr = reiserfs_bmap_nr(block_count, block_size);;
@@ -316,23 +316,23 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
return fs; return fs;
} }
int no_reiserfs_found(reiserfs_filsys_t *fs) int no_reiserfs_found(reiserfs_filsys_t fs)
{ {
return (fs == NULL || fs->fs_blocksize == 0) ? 1 : 0; return (fs == NULL || fs->fs_blocksize == 0) ? 1 : 0;
} }
static int new_format(reiserfs_filsys_t *fs) static int new_format(reiserfs_filsys_t fs)
{ {
return fs->fs_super_bh->b_blocknr != 2; return fs->fs_super_bh->b_blocknr != 2;
} }
int spread_bitmaps(reiserfs_filsys_t *fs) int spread_bitmaps(reiserfs_filsys_t fs)
{ {
return fs->fs_super_bh->b_blocknr != 2; return fs->fs_super_bh->b_blocknr != 2;
} }
/* 0 means: do not guarantee that fs is consistent */ /* 0 means: do not guarantee that fs is consistent */
int reiserfs_is_fs_consistent(reiserfs_filsys_t *fs) int reiserfs_is_fs_consistent(reiserfs_filsys_t fs)
{ {
if (get_sb_umount_state(fs->fs_ondisk_sb) == FS_CLEANLY_UMOUNTED && if (get_sb_umount_state(fs->fs_ondisk_sb) == FS_CLEANLY_UMOUNTED &&
get_sb_fs_state(fs->fs_ondisk_sb) == FS_CONSISTENT) get_sb_fs_state(fs->fs_ondisk_sb) == FS_CONSISTENT)
@@ -342,7 +342,7 @@ int reiserfs_is_fs_consistent(reiserfs_filsys_t *fs)
/* flush bitmap, brelse super block, flush all dirty buffers, close and open /* flush bitmap, brelse super block, flush all dirty buffers, close and open
again the device, read super block */ again the device, read super block */
static void reiserfs_only_reopen(reiserfs_filsys_t *fs, int flag) static void reiserfs_only_reopen(reiserfs_filsys_t fs, int flag)
{ {
unsigned long super_block; unsigned long super_block;
@@ -377,13 +377,13 @@ static void reiserfs_only_reopen(reiserfs_filsys_t *fs, int flag)
fs->fs_dirt = 0; fs->fs_dirt = 0;
} }
void reiserfs_reopen(reiserfs_filsys_t *fs, int flag) void reiserfs_reopen(reiserfs_filsys_t fs, int flag)
{ {
reiserfs_only_reopen(fs, flag); reiserfs_only_reopen(fs, flag);
reiserfs_reopen_journal(fs, flag); reiserfs_reopen_journal(fs, flag);
} }
int is_opened_rw(reiserfs_filsys_t *fs) int is_opened_rw(reiserfs_filsys_t fs)
{ {
if ((fs->fs_flags) & O_RDWR) if ((fs->fs_flags) & O_RDWR)
return 1; return 1;
@@ -391,7 +391,7 @@ int is_opened_rw(reiserfs_filsys_t *fs)
} }
/* flush all changes made on a filesystem */ /* flush all changes made on a filesystem */
void reiserfs_flush(reiserfs_filsys_t *fs) void reiserfs_flush(reiserfs_filsys_t fs)
{ {
if (fs->fs_dirt) { if (fs->fs_dirt) {
reiserfs_flush_journal(fs); reiserfs_flush_journal(fs);
@@ -401,7 +401,7 @@ void reiserfs_flush(reiserfs_filsys_t *fs)
} }
/* free all memory involved into manipulating with filesystem */ /* free all memory involved into manipulating with filesystem */
void reiserfs_free(reiserfs_filsys_t *fs) void reiserfs_free(reiserfs_filsys_t fs)
{ {
reiserfs_free_journal(fs); reiserfs_free_journal(fs);
reiserfs_free_ondisk_bitmap(fs); reiserfs_free_ondisk_bitmap(fs);
@@ -418,7 +418,7 @@ void reiserfs_free(reiserfs_filsys_t *fs)
} }
/* this closes everything: journal. bitmap and the fs itself */ /* this closes everything: journal. bitmap and the fs itself */
void reiserfs_close(reiserfs_filsys_t *fs) void reiserfs_close(reiserfs_filsys_t fs)
{ {
reiserfs_close_journal(fs); reiserfs_close_journal(fs);
reiserfs_close_ondisk_bitmap(fs); reiserfs_close_ondisk_bitmap(fs);
@@ -428,7 +428,7 @@ void reiserfs_close(reiserfs_filsys_t *fs)
fsync(fs->fs_dev); fsync(fs->fs_dev);
} }
int reiserfs_new_blocknrs(reiserfs_filsys_t *fs, int reiserfs_new_blocknrs(reiserfs_filsys_t fs,
unsigned long *free_blocknrs, unsigned long *free_blocknrs,
unsigned long start, int amount_needed) unsigned long start, int amount_needed)
{ {
@@ -439,7 +439,7 @@ int reiserfs_new_blocknrs(reiserfs_filsys_t *fs,
return 0; return 0;
} }
int reiserfs_free_block(reiserfs_filsys_t *fs, unsigned long block) int reiserfs_free_block(reiserfs_filsys_t fs, unsigned long block)
{ {
if (fs->block_deallocator) if (fs->block_deallocator)
return fs->block_deallocator(fs, block); return fs->block_deallocator(fs, block);
@@ -447,7 +447,7 @@ int reiserfs_free_block(reiserfs_filsys_t *fs, unsigned long block)
return 0; return 0;
} }
static int reiserfs_search_by_key_x(reiserfs_filsys_t *fs, static int reiserfs_search_by_key_x(reiserfs_filsys_t fs,
struct reiserfs_key *key, struct reiserfs_key *key,
struct reiserfs_path *path, int key_length) struct reiserfs_path *path, int key_length)
{ {
@@ -496,13 +496,13 @@ static int reiserfs_search_by_key_x(reiserfs_filsys_t *fs,
return ITEM_NOT_FOUND; return ITEM_NOT_FOUND;
} }
int reiserfs_search_by_key_3(reiserfs_filsys_t *fs, struct reiserfs_key *key, int reiserfs_search_by_key_3(reiserfs_filsys_t fs, struct reiserfs_key *key,
struct reiserfs_path *path) struct reiserfs_path *path)
{ {
return reiserfs_search_by_key_x(fs, key, path, 3); return reiserfs_search_by_key_x(fs, key, path, 3);
} }
int reiserfs_search_by_key_4(reiserfs_filsys_t *fs, struct reiserfs_key *key, int reiserfs_search_by_key_4(reiserfs_filsys_t fs, struct reiserfs_key *key,
struct reiserfs_path *path) struct reiserfs_path *path)
{ {
return reiserfs_search_by_key_x(fs, key, path, 4); return reiserfs_search_by_key_x(fs, key, path, 4);
@@ -510,7 +510,7 @@ int reiserfs_search_by_key_4(reiserfs_filsys_t *fs, struct reiserfs_key *key,
/* key is key of byte in the regular file. This searches in tree /* key is key of byte in the regular file. This searches in tree
through items and in the found item as well */ through items and in the found item as well */
int reiserfs_search_by_position(reiserfs_filsys_t *s, struct reiserfs_key *key, int reiserfs_search_by_position(reiserfs_filsys_t s, struct reiserfs_key *key,
int version, struct reiserfs_path *path) int version, struct reiserfs_path *path)
{ {
struct buffer_head *bh; struct buffer_head *bh;
@@ -692,7 +692,7 @@ struct reiserfs_key *reiserfs_next_key(struct reiserfs_path *path)
} }
/* NOTE: this only should be used to look for keys who exists */ /* NOTE: this only should be used to look for keys who exists */
int reiserfs_search_by_entry_key(reiserfs_filsys_t *fs, int reiserfs_search_by_entry_key(reiserfs_filsys_t fs,
struct reiserfs_key *key, struct reiserfs_key *key,
struct reiserfs_path *path) struct reiserfs_path *path)
{ {
@@ -795,7 +795,7 @@ int reiserfs_search_by_entry_key(reiserfs_filsys_t *fs,
return POSITION_NOT_FOUND; return POSITION_NOT_FOUND;
} }
void init_tb_struct(struct tree_balance *tb, reiserfs_filsys_t *fs, void init_tb_struct(struct tree_balance *tb, reiserfs_filsys_t fs,
struct reiserfs_path *path, int size) struct reiserfs_path *path, int size)
{ {
memset(tb, '\0', sizeof(struct tree_balance)); memset(tb, '\0', sizeof(struct tree_balance));
@@ -807,7 +807,7 @@ void init_tb_struct(struct tree_balance *tb, reiserfs_filsys_t *fs,
tb->insert_size[0] = size; tb->insert_size[0] = size;
} }
int reiserfs_remove_entry(reiserfs_filsys_t *fs, struct reiserfs_key *key) int reiserfs_remove_entry(reiserfs_filsys_t fs, struct reiserfs_key *key)
{ {
struct reiserfs_path path; struct reiserfs_path path;
struct tree_balance tb; struct tree_balance tb;
@@ -842,7 +842,7 @@ int reiserfs_remove_entry(reiserfs_filsys_t *fs, struct reiserfs_key *key)
return 0; return 0;
} }
void reiserfs_paste_into_item(reiserfs_filsys_t *fs, void reiserfs_paste_into_item(reiserfs_filsys_t fs,
struct reiserfs_path *path, const void *body, struct reiserfs_path *path, const void *body,
int size) int size)
{ {
@@ -856,7 +856,7 @@ void reiserfs_paste_into_item(reiserfs_filsys_t *fs,
do_balance(&tb, NULL, body, M_PASTE, 0 /* zero num */ ); do_balance(&tb, NULL, body, M_PASTE, 0 /* zero num */ );
} }
void reiserfs_insert_item(reiserfs_filsys_t *fs, struct reiserfs_path *path, void reiserfs_insert_item(reiserfs_filsys_t fs, struct reiserfs_path *path,
struct item_head *ih, const void *body) struct item_head *ih, const void *body)
{ {
struct tree_balance tb; struct tree_balance tb;
@@ -884,7 +884,7 @@ __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, /* if name is found in a directory - return 1 and set path to the name,
otherwise return 0 and pathrelse path */ otherwise return 0 and pathrelse path */
int reiserfs_locate_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir, int reiserfs_locate_entry(reiserfs_filsys_t fs, struct reiserfs_key *dir,
char *name, struct reiserfs_path *path) char *name, struct reiserfs_path *path)
{ {
struct reiserfs_key entry_key; struct reiserfs_key entry_key;
@@ -947,7 +947,7 @@ int reiserfs_locate_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir,
found. Stores key found in the entry in 'key'. Returns minimal not used 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 generation counter in 'min_gen_counter'. dies if found object is not a
directory. */ directory. */
int reiserfs_find_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir, int reiserfs_find_entry(reiserfs_filsys_t fs, struct reiserfs_key *dir,
char *name, unsigned int *min_gen_counter, char *name, unsigned int *min_gen_counter,
struct reiserfs_key *key) struct reiserfs_key *key)
{ {
@@ -1071,7 +1071,7 @@ static char *make_entry(char *entry, char *name, struct reiserfs_key *key,
/* add new name into a directory. If it exists in a directory - do /* add new name into a directory. If it exists in a directory - do
nothing */ nothing */
int reiserfs_add_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir, int reiserfs_add_entry(reiserfs_filsys_t fs, struct reiserfs_key *dir,
char *name, int name_len, struct reiserfs_key *key, char *name, int name_len, struct reiserfs_key *key,
__u16 fsck_need) __u16 fsck_need)
{ {
@@ -1154,7 +1154,7 @@ void copy_short_key(void *to, const void *from)
} }
/* inserts new or old stat data of a directory (unreachable, nlinks == 0) */ /* inserts new or old stat data of a directory (unreachable, nlinks == 0) */
int create_dir_sd(reiserfs_filsys_t *fs, int create_dir_sd(reiserfs_filsys_t fs,
struct reiserfs_path *path, struct reiserfs_key *key, struct reiserfs_path *path, struct reiserfs_key *key,
void (*modify_item) (struct item_head *, void *)) void (*modify_item) (struct item_head *, void *))
{ {
@@ -1195,7 +1195,7 @@ int create_dir_sd(reiserfs_filsys_t *fs,
return key_format; return key_format;
} }
void make_sure_root_dir_exists(reiserfs_filsys_t *fs, void make_sure_root_dir_exists(reiserfs_filsys_t fs,
void (*modify_item) (struct item_head *, void *), void (*modify_item) (struct item_head *, void *),
int ih_flags) int ih_flags)
{ {
@@ -1290,7 +1290,7 @@ int can_we_format_it(char *device_name, int force)
return 1; return 1;
} }
int create_badblock_bitmap(reiserfs_filsys_t *fs, char *badblocks_file) int create_badblock_bitmap(reiserfs_filsys_t fs, char *badblocks_file)
{ {
FILE *fd; FILE *fd;
char buf[128]; char buf[128];
@@ -1342,7 +1342,7 @@ int create_badblock_bitmap(reiserfs_filsys_t *fs, char *badblocks_file)
return 0; return 0;
} }
void badblock_list(reiserfs_filsys_t *fs, badblock_func_t action, void *data) void badblock_list(reiserfs_filsys_t fs, badblock_func_t action, void *data)
{ {
struct reiserfs_path badblock_path; struct reiserfs_path badblock_path;
struct reiserfs_key rd_key = badblock_key; struct reiserfs_key rd_key = badblock_key;
@@ -1389,7 +1389,7 @@ void badblock_list(reiserfs_filsys_t *fs, badblock_func_t action, void *data)
} }
} }
static void callback_badblock_rm(reiserfs_filsys_t *fs, static void callback_badblock_rm(reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, struct reiserfs_path *badblock_path,
void *data) void *data)
{ {
@@ -1409,7 +1409,7 @@ static void callback_badblock_rm(reiserfs_filsys_t *fs,
do_balance(&tb, NULL, NULL, M_DELETE, 0 /* zero num */); do_balance(&tb, NULL, NULL, M_DELETE, 0 /* zero num */);
} }
void mark_badblock(reiserfs_filsys_t *fs, void mark_badblock(reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, void *data) struct reiserfs_path *badblock_path, void *data)
{ {
struct item_head *tmp_ih; struct item_head *tmp_ih;
@@ -1430,7 +1430,7 @@ void mark_badblock(reiserfs_filsys_t *fs,
pathrelse(badblock_path); pathrelse(badblock_path);
} }
void add_badblock_list(reiserfs_filsys_t *fs, int replace) void add_badblock_list(reiserfs_filsys_t fs, int replace)
{ {
struct tree_balance tb; struct tree_balance tb;
struct reiserfs_path badblock_path; struct reiserfs_path badblock_path;
+4 -4
View File
@@ -189,7 +189,7 @@ const struct reiserfs_key MAX_KEY =
tree), and in this case we return a special key, either MIN_KEY or tree), and in this case we return a special key, either MIN_KEY or
MAX_KEY. */ MAX_KEY. */
static const struct reiserfs_key *get_lkey(const struct reiserfs_path *p_s_chk_path, static const struct reiserfs_key *get_lkey(const struct reiserfs_path *p_s_chk_path,
const reiserfs_filsys_t *fs) const reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
int n_position, n_path_offset = p_s_chk_path->path_length; int n_position, n_path_offset = p_s_chk_path->path_length;
@@ -228,7 +228,7 @@ static const struct reiserfs_key *get_lkey(const struct reiserfs_path *p_s_chk_p
/* Get delimiting key of the buffer at the path and its right neighbor. */ /* Get delimiting key of the buffer at the path and its right neighbor. */
const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path, const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path,
const reiserfs_filsys_t *fs) const reiserfs_filsys_t fs)
{ {
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
int n_position, n_path_offset = p_s_chk_path->path_length; int n_position, n_path_offset = p_s_chk_path->path_length;
@@ -273,7 +273,7 @@ const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path,
which is MIN_KEY or MAX_KEY. */ which is MIN_KEY or MAX_KEY. */
static inline int key_in_buffer(const struct reiserfs_path *p_s_chk_path, /* Path which should be checked. */ static inline int key_in_buffer(const struct reiserfs_path *p_s_chk_path, /* Path which should be checked. */
const struct reiserfs_key *p_s_key, /* Key which should be checked. */ const struct reiserfs_key *p_s_key, /* Key which should be checked. */
reiserfs_filsys_t *fs /* Super block pointer. */ reiserfs_filsys_t fs /* Super block pointer. */
) )
{ {
@@ -317,7 +317,7 @@ void pathrelse(struct reiserfs_path *p_s_search_path)
key. search_by_key returns a path that must be checked for the key. search_by_key returns a path that must be checked for the
correctness of the top of the path but need not be checked for the correctness of the top of the path but need not be checked for the
correctness of the bottom of the path */ correctness of the bottom of the path */
int search_by_key(reiserfs_filsys_t *fs, struct reiserfs_key *p_s_key, /* Key to search */ int search_by_key(reiserfs_filsys_t fs, struct reiserfs_key *p_s_key, /* Key to search */
struct reiserfs_path *p_s_search_path, /* This structure was struct reiserfs_path *p_s_search_path, /* This structure was
allocated and allocated and
initialized by the initialized by the
+5 -5
View File
@@ -20,7 +20,7 @@ static reiserfs_bitmap_t *bmp;
static struct reiserfs_super_block *ondisk_sb; static struct reiserfs_super_block *ondisk_sb;
/* abnornal exit from block reallocation process */ /* abnornal exit from block reallocation process */
static void quit_resizer(reiserfs_filsys_t *fs) static void quit_resizer(reiserfs_filsys_t fs)
{ {
/* save changes to bitmap blocks */ /* save changes to bitmap blocks */
reiserfs_close(fs); reiserfs_close(fs);
@@ -30,7 +30,7 @@ static void quit_resizer(reiserfs_filsys_t *fs)
} }
/* block moving */ /* block moving */
static unsigned long move_generic_block(reiserfs_filsys_t *fs, static unsigned long move_generic_block(reiserfs_filsys_t fs,
unsigned long block, unsigned long block,
unsigned long bnd, int h) unsigned long bnd, int h)
{ {
@@ -87,7 +87,7 @@ static unsigned long move_generic_block(reiserfs_filsys_t *fs,
return unused_block; return unused_block;
} }
static unsigned long move_unformatted_block(reiserfs_filsys_t *fs, static unsigned long move_unformatted_block(reiserfs_filsys_t fs,
unsigned long block, unsigned long block,
unsigned long bnd, int h) unsigned long bnd, int h)
{ {
@@ -100,7 +100,7 @@ static unsigned long move_unformatted_block(reiserfs_filsys_t *fs,
} }
/* recursive function processing all tree nodes */ /* recursive function processing all tree nodes */
static unsigned long move_formatted_block(reiserfs_filsys_t *fs, static unsigned long move_formatted_block(reiserfs_filsys_t fs,
unsigned long block, unsigned long block,
unsigned long bnd, int h) unsigned long bnd, int h)
{ {
@@ -189,7 +189,7 @@ static unsigned long move_formatted_block(reiserfs_filsys_t *fs,
return new_blocknr; return new_blocknr;
} }
int shrink_fs(reiserfs_filsys_t *fs, long long int blocks) int shrink_fs(reiserfs_filsys_t fs, long long int blocks)
{ {
unsigned long n_root_block; unsigned long n_root_block;
unsigned int bmap_nr_new; unsigned int bmap_nr_new;
+1 -1
View File
@@ -44,4 +44,4 @@ extern int opt_safe;
extern int resize_fs_online(char *devname, long long int blocks); extern int resize_fs_online(char *devname, long long int blocks);
/* do_shrink.c */ /* do_shrink.c */
extern int shrink_fs(reiserfs_filsys_t *, long long int blocks); extern int shrink_fs(reiserfs_filsys_t , long long int blocks);
+3 -3
View File
@@ -88,7 +88,7 @@ static int bwrite_cond(struct buffer_head *bh)
} }
/* the first one of the most important functions */ /* the first one of the most important functions */
static int expand_fs(reiserfs_filsys_t *fs, long long int block_count_new) static int expand_fs(reiserfs_filsys_t fs, long long int block_count_new)
{ {
unsigned int bmap_nr_new, bmap_nr_old; unsigned int bmap_nr_new, bmap_nr_old;
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
@@ -138,7 +138,7 @@ static int expand_fs(reiserfs_filsys_t *fs, long long int block_count_new)
return 0; return 0;
} }
static int resizer_check_fs_size(reiserfs_filsys_t *fs, long long int new_size) static int resizer_check_fs_size(reiserfs_filsys_t fs, long long int new_size)
{ {
if (new_size < 0) { if (new_size < 0) {
reiserfs_warning(stderr, "\nresizer_reiserfs: the new size " reiserfs_warning(stderr, "\nresizer_reiserfs: the new size "
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
char *bytes_count_str = NULL; char *bytes_count_str = NULL;
char *devname; char *devname;
char *jdevice_name = NULL; char *jdevice_name = NULL;
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
struct reiserfs_super_block *sb; struct reiserfs_super_block *sb;
int c; int c;
+7 -7
View File
@@ -83,7 +83,7 @@ static unsigned char UUID[16];
static char *badblocks_file; static char *badblocks_file;
/* If specified paramenters defines the standard journal, make it standard. */ /* If specified paramenters defines the standard journal, make it standard. */
static int should_make_journal_standard(reiserfs_filsys_t *fs, static int should_make_journal_standard(reiserfs_filsys_t fs,
char *j_new_dev_name) char *j_new_dev_name)
{ {
if (!is_reiserfs_jr_magic_string(fs->fs_ondisk_sb)) if (!is_reiserfs_jr_magic_string(fs->fs_ondisk_sb))
@@ -126,7 +126,7 @@ static int should_make_journal_standard(reiserfs_filsys_t *fs,
return 1; return 1;
} }
static int set_standard_journal_params(reiserfs_filsys_t *fs) static int set_standard_journal_params(reiserfs_filsys_t fs)
{ {
struct buffer_head *bh; struct buffer_head *bh;
@@ -193,7 +193,7 @@ static int set_standard_journal_params(reiserfs_filsys_t *fs)
return 1; return 1;
} }
static void zero_journal(reiserfs_filsys_t *fs) static void zero_journal(reiserfs_filsys_t fs)
{ {
unsigned int i; unsigned int i;
struct buffer_head *bh; struct buffer_head *bh;
@@ -285,7 +285,7 @@ static void set_time_last_checked(char *str)
print_usage_and_exit(); print_usage_and_exit();
} }
static void callback_new_badblocks(reiserfs_filsys_t *fs, static void callback_new_badblocks(reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, struct reiserfs_path *badblock_path,
void *data) void *data)
{ {
@@ -310,7 +310,7 @@ static void callback_new_badblocks(reiserfs_filsys_t *fs,
pathrelse(badblock_path); pathrelse(badblock_path);
} }
static void callback_clear_badblocks(reiserfs_filsys_t *fs, static void callback_clear_badblocks(reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, struct reiserfs_path *badblock_path,
void *data) void *data)
{ {
@@ -328,7 +328,7 @@ static void callback_clear_badblocks(reiserfs_filsys_t *fs,
pathrelse(badblock_path); pathrelse(badblock_path);
} }
static void add_badblocks(reiserfs_filsys_t *fs) static void add_badblocks(reiserfs_filsys_t fs)
{ {
unsigned long i, marked = 0; unsigned long i, marked = 0;
@@ -389,7 +389,7 @@ static void add_badblocks(reiserfs_filsys_t *fs)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
reiserfs_filsys_t *fs; reiserfs_filsys_t fs;
char *device_name; char *device_name;
char *jdevice_name; char *jdevice_name;
char *j_new_device_name; char *j_new_device_name;