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:
1 parent
81aeadf510
commit
97fa944851
37 files changed
+393
-393
No files matched your search
+12
-12
@@ -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_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,
|
||||
char *corruption_command);
|
||||
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 */
|
||||
static void edit_super_block(reiserfs_filsys_t *fs)
|
||||
static void edit_super_block(reiserfs_filsys_t fs)
|
||||
{
|
||||
char *str;
|
||||
size_t n;
|
||||
@@ -236,7 +236,7 @@ static void corrupt_clobber_hash(char *name, struct item_head *ih,
|
||||
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;
|
||||
char *line = NULL;
|
||||
@@ -341,7 +341,7 @@ void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline)
|
||||
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,
|
||||
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;
|
||||
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;
|
||||
@@ -889,7 +889,7 @@ void do_bitmap_corruption(reiserfs_filsys_t *fs)
|
||||
}
|
||||
|
||||
/* 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 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 */
|
||||
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 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 */
|
||||
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 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 */
|
||||
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 int nr_ih_cr;
|
||||
@@ -1273,7 +1273,7 @@ static void do_ind_random_corrupt(reiserfs_filsys_t *fs,
|
||||
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;
|
||||
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;
|
||||
size_t n = 0;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "debugreiserfs.h"
|
||||
|
||||
reiserfs_filsys_t *fs;
|
||||
reiserfs_filsys_t fs;
|
||||
|
||||
#define print_usage_and_exit() {\
|
||||
fprintf (stderr, "Usage: %s [options] device\n\n\
|
||||
@@ -67,7 +67,7 @@ struct reiserfs_fsstat {
|
||||
} g_stat_info;
|
||||
#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;
|
||||
int i, j, count;
|
||||
@@ -132,7 +132,7 @@ static void print_disk_tree(reiserfs_filsys_t *fs, unsigned long block_nr)
|
||||
level++;
|
||||
}
|
||||
|
||||
static void print_disk_blocks(reiserfs_filsys_t *fs)
|
||||
static void print_disk_blocks(reiserfs_filsys_t fs)
|
||||
{
|
||||
int type;
|
||||
unsigned long done = 0, total;
|
||||
@@ -171,8 +171,8 @@ static void print_disk_blocks(reiserfs_filsys_t *fs)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
void pack_one_block(reiserfs_filsys_t *fs, unsigned long block);
|
||||
static void print_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)
|
||||
{
|
||||
struct buffer_head *bh;
|
||||
|
||||
@@ -427,9 +427,9 @@ static char *parse_options(struct debugreiserfs_data *data,
|
||||
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))
|
||||
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;
|
||||
unsigned long block_count;
|
||||
@@ -508,7 +508,7 @@ static void init_bitmap(reiserfs_filsys_t *fs)
|
||||
}
|
||||
|
||||
/* 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)) {
|
||||
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,
|
||||
void *data)
|
||||
{
|
||||
@@ -610,7 +610,7 @@ static int str2int(char *str, int *res)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void do_corrupt_blocks(reiserfs_filsys_t *fs)
|
||||
static void do_corrupt_blocks(reiserfs_filsys_t fs)
|
||||
{
|
||||
char *line;
|
||||
FILE *fd;
|
||||
@@ -647,7 +647,7 @@ static void do_corrupt_blocks(reiserfs_filsys_t *fs)
|
||||
return;
|
||||
}
|
||||
|
||||
static void debugreiserfs_zero_reiserfs(reiserfs_filsys_t *fs)
|
||||
static void debugreiserfs_zero_reiserfs(reiserfs_filsys_t fs)
|
||||
{
|
||||
unsigned long done, total, i;
|
||||
struct buffer_head *bh;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
extern reiserfs_filsys_t *fs;
|
||||
extern reiserfs_filsys_t fs;
|
||||
|
||||
/*
|
||||
* modes
|
||||
@@ -238,27 +238,27 @@ struct debugreiserfs_data {
|
||||
#define be_quiet(fs) (data(fs)->options & BE_QUIET)
|
||||
|
||||
/* stat.c */
|
||||
void do_stat(reiserfs_filsys_t *fs);
|
||||
void do_stat(reiserfs_filsys_t fs);
|
||||
|
||||
/* corruption.c */
|
||||
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_bitmap_corruption(reiserfs_filsys_t *fs);
|
||||
void do_fs_random_corrupt(reiserfs_filsys_t *fs);
|
||||
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_bitmap_corruption(reiserfs_filsys_t fs);
|
||||
void do_fs_random_corrupt(reiserfs_filsys_t fs);
|
||||
|
||||
/* recover.c */
|
||||
void do_recover(reiserfs_filsys_t *fs);
|
||||
void do_recover(reiserfs_filsys_t fs);
|
||||
|
||||
/* scan.c */
|
||||
void do_scan(reiserfs_filsys_t *fs);
|
||||
void do_scan(reiserfs_filsys_t fs);
|
||||
|
||||
/* journal.c */
|
||||
void scan_journal(reiserfs_filsys_t *fs);
|
||||
void scan_journal(reiserfs_filsys_t fs);
|
||||
|
||||
/* unpack.c */
|
||||
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 item_head si_ih;
|
||||
|
||||
+11
-11
@@ -184,7 +184,7 @@ static void pack_indirect(struct packed_item *pi, struct buffer_head *bh,
|
||||
maybe gencounter (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)
|
||||
{
|
||||
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;
|
||||
__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
|
||||
of journal, bitmap blocks, super block or is transparently out of range of
|
||||
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))
|
||||
return 1;
|
||||
@@ -351,7 +351,7 @@ static int check_unfm_ptr(reiserfs_filsys_t *fs, __u32 block)
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
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,
|
||||
direntries are hashed properly and hash function is defined,
|
||||
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;
|
||||
struct item_head *ih;
|
||||
@@ -493,13 +493,13 @@ static void pack_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh)
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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++;
|
||||
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*/
|
||||
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 type;
|
||||
@@ -546,7 +546,7 @@ static void send_block(reiserfs_filsys_t *fs, struct buffer_head *bh,
|
||||
}
|
||||
|
||||
/* 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;
|
||||
unsigned long block;
|
||||
@@ -638,7 +638,7 @@ static void pack_frozen_data(reiserfs_filsys_t *fs)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
__u32 magic32;
|
||||
@@ -699,7 +699,7 @@ void pack_partition(reiserfs_filsys_t *fs)
|
||||
(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;
|
||||
__u16 magic16;
|
||||
|
||||
@@ -233,7 +233,7 @@ static void read_map (FILE * fp)
|
||||
free (buf);
|
||||
}
|
||||
|
||||
void do_recover (reiserfs_filsys_t *fs)
|
||||
void do_recover (reiserfs_filsys_t fs)
|
||||
{
|
||||
FILE * fp;
|
||||
|
||||
@@ -276,7 +276,7 @@ static long int get_answer(long int max)
|
||||
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 item_head *ih;
|
||||
@@ -409,7 +409,7 @@ static void recover_items(FILE * fp, reiserfs_filsys_t *fs, FILE * target_file)
|
||||
free(map);
|
||||
}
|
||||
|
||||
void do_recover(reiserfs_filsys_t *fs)
|
||||
void do_recover(reiserfs_filsys_t fs)
|
||||
{
|
||||
FILE *fp, *recovery;
|
||||
|
||||
|
||||
@@ -581,7 +581,7 @@ static void map_one_item(struct saved_item *item)
|
||||
}
|
||||
|
||||
// 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,
|
||||
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 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;
|
||||
|
||||
@@ -845,7 +845,7 @@ static void make_map(const void *nodep, VISIT value, int level)
|
||||
}
|
||||
|
||||
/* store map if it is a regular file */
|
||||
static void locate_file(reiserfs_filsys_t *fs, struct reiserfs_key *key)
|
||||
static void locate_file(reiserfs_filsys_t fs, struct reiserfs_key *key)
|
||||
{
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
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 */
|
||||
static void look_for_name(reiserfs_filsys_t *fs)
|
||||
static void look_for_name(reiserfs_filsys_t fs)
|
||||
{
|
||||
INITIALIZE_REISERFS_PATH(path);
|
||||
char *name, *objectid, *dirid;
|
||||
@@ -998,7 +998,7 @@ static void scan_for_key(struct buffer_head *bh, struct reiserfs_key *key)
|
||||
}
|
||||
#endif
|
||||
|
||||
void do_scan(reiserfs_filsys_t *fs)
|
||||
void do_scan(reiserfs_filsys_t fs)
|
||||
{
|
||||
unsigned long i;
|
||||
struct buffer_head *bh;
|
||||
|
||||
@@ -105,7 +105,7 @@ static int is_unique_item(struct obstack *ostack, void **tree, void *ih)
|
||||
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;
|
||||
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 done, total;
|
||||
|
||||
Reference in new issue
Block a user