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

+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' */
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 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
changed and return 1. Otherwise - return 0 */
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 long to_copy, copied, block;
@@ -688,7 +688,7 @@ void reiserfs_bitmap_invert(reiserfs_bitmap_t *bm)
/*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) {
reiserfs_delete_bitmap(fs->fs_bitmap2);
@@ -697,7 +697,7 @@ void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t *fs)
}
/* 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 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);
}
int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t *fs)
int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t fs)
{
if (fs->fs_bitmap2)
reiserfs_panic("bitmap is initiaized already");
@@ -744,7 +744,7 @@ int reiserfs_create_ondisk_bitmap(reiserfs_filsys_t *fs)
return 1;
}
void reiserfs_close_ondisk_bitmap(reiserfs_filsys_t *fs)
void reiserfs_close_ondisk_bitmap(reiserfs_filsys_t fs)
{
if (!fs->fs_bitmap2)
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.*/
void replace_key(reiserfs_filsys_t *fs,
void replace_key(reiserfs_filsys_t fs,
struct buffer_head *dest, int n_dest,
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 */
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_key key;
@@ -926,7 +926,7 @@ static struct buffer_head *get_left_neighbor(reiserfs_filsys_t *s,
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_key key;
@@ -953,7 +953,7 @@ static struct buffer_head *get_right_neighbor(reiserfs_filsys_t *s,
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 buffer_head *bh;
@@ -972,7 +972,7 @@ int is_left_mergeable(reiserfs_filsys_t *s, struct reiserfs_path *path)
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 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, };
int n_counter, n_number_of_freeblk, n_amount_needed, /* number of needed empty blocks */
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)
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)
{
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;
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,
n_path_offset = PATH_H_PATH_OFFSET(p_s_tb->tb_path, n_h + 1);
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 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
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)
{
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
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)
{
unsigned long offset;
@@ -50,7 +50,7 @@ static unsigned long next_desc_expected(reiserfs_filsys_t *fs,
}
/* 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)
{
struct buffer_head *d_bh, *c_bh;
@@ -102,7 +102,7 @@ error_desc_brelse:
}
/* 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 *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
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 *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 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)
{
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;
}
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,
unsigned int index,
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 */
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)
{
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 */
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);
fsync(fs->fs_dev);
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;
int ret = 0;
@@ -419,7 +419,7 @@ __u32 advise_journal_max_trans_age(void)
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_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
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;
__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.
* 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 len, /* including journal header */
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
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;
@@ -772,19 +772,19 @@ void reiserfs_reopen_journal(reiserfs_filsys_t *fs, int flag)
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;
}
void reiserfs_flush_journal(reiserfs_filsys_t *fs)
void reiserfs_flush_journal(reiserfs_filsys_t fs)
{
if (!reiserfs_journal_opened(fs))
return;
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))
return;
@@ -794,7 +794,7 @@ void reiserfs_free_journal(reiserfs_filsys_t *fs)
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_free_journal(fs);
@@ -802,7 +802,7 @@ void reiserfs_close_journal(reiserfs_filsys_t *fs)
}
/* 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,
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? */
int reiserfs_replay_journal(reiserfs_filsys_t *fs)
int reiserfs_replay_journal(reiserfs_filsys_t fs)
{
struct buffer_head *bh;
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 */
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;
@@ -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);
}
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)
{
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)) {
/* standard journal */
@@ -367,7 +367,7 @@ int block_of_journal(reiserfs_filsys_t *fs, unsigned long block)
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 (!(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 */
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))
/* 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 */
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 */
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)
// 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 +
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;
}
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))
return get_journal_old_start_must(fs);
@@ -456,7 +456,7 @@ __u32 get_bytes_number(struct item_head * ih, int blocksize)
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 */
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
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)
{
unsigned int i;
@@ -536,7 +536,7 @@ int known_hashes(void)
(hash_value (hashfn, name, namelen) == GET_HASH_VALUE (deh_offset))
/* 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)
{
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
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)
{
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 */
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)
{
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 */
int is_objectid_used(reiserfs_filsys_t *fs, __u32 objectid)
int is_objectid_used(reiserfs_filsys_t fs, __u32 objectid)
{
__le32 *objectid_map;
__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);
}
void mark_objectid_used(reiserfs_filsys_t *fs, __u32 objectid)
void mark_objectid_used(reiserfs_filsys_t fs, __u32 objectid)
{
int i;
__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)
{
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 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)
{
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 */
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 reiserfs_super_block *sb =
@@ -730,7 +730,7 @@ int print_super_block(FILE * fp, reiserfs_filsys_t *fs, char *file_name,
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: ");
if (reiserfs_is_fs_consistent(fs))
@@ -753,7 +753,7 @@ static int print_desc_block(FILE * fp, struct buffer_head *bh)
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;
int mode, first, last;
@@ -970,7 +970,7 @@ end2:
}
/* 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;
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;
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;
@@ -1073,7 +1073,7 @@ void print_journal_header(reiserfs_filsys_t *fs)
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,
unsigned long in_journal,
unsigned long in_place)
@@ -1087,7 +1087,7 @@ static void print_trans_element(reiserfs_filsys_t *fs,
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,
"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 */
void print_journal(reiserfs_filsys_t *fs)
void print_journal(reiserfs_filsys_t fs)
{
if (!reiserfs_journal_opened(fs)) {
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
is refused. Journal and bitmap are to be opened separately.
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)
{
reiserfs_filsys_t *fs;
reiserfs_filsys_t fs;
struct buffer_head *bh;
struct reiserfs_super_block *sb;
int fd;
@@ -184,13 +184,13 @@ found:
/* creates buffer for super block and fills it up with fields which are
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,
unsigned long block_count,
int block_size,
int default_journal, int new_format)
{
reiserfs_filsys_t *fs;
reiserfs_filsys_t fs;
time_t now;
unsigned int bmap_nr = reiserfs_bmap_nr(block_count, block_size);;
@@ -316,23 +316,23 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
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;
}
static int new_format(reiserfs_filsys_t *fs)
static int new_format(reiserfs_filsys_t fs)
{
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;
}
/* 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 &&
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
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;
@@ -377,13 +377,13 @@ static void reiserfs_only_reopen(reiserfs_filsys_t *fs, int flag)
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_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)
return 1;
@@ -391,7 +391,7 @@ int is_opened_rw(reiserfs_filsys_t *fs)
}
/* 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) {
reiserfs_flush_journal(fs);
@@ -401,7 +401,7 @@ void reiserfs_flush(reiserfs_filsys_t *fs)
}
/* 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_ondisk_bitmap(fs);
@@ -418,7 +418,7 @@ void reiserfs_free(reiserfs_filsys_t *fs)
}
/* 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_ondisk_bitmap(fs);
@@ -428,7 +428,7 @@ void reiserfs_close(reiserfs_filsys_t *fs)
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 start, int amount_needed)
{
@@ -439,7 +439,7 @@ int reiserfs_new_blocknrs(reiserfs_filsys_t *fs,
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)
return fs->block_deallocator(fs, block);
@@ -447,7 +447,7 @@ int reiserfs_free_block(reiserfs_filsys_t *fs, unsigned long block)
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_path *path, int key_length)
{
@@ -496,13 +496,13 @@ static int reiserfs_search_by_key_x(reiserfs_filsys_t *fs,
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)
{
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)
{
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
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)
{
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 */
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_path *path)
{
@@ -795,7 +795,7 @@ int reiserfs_search_by_entry_key(reiserfs_filsys_t *fs,
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)
{
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;
}
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 tree_balance tb;
@@ -842,7 +842,7 @@ int reiserfs_remove_entry(reiserfs_filsys_t *fs, struct reiserfs_key *key)
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,
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 */ );
}
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 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,
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)
{
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
generation counter in 'min_gen_counter'. dies if found object is not a
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,
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
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,
__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) */
int create_dir_sd(reiserfs_filsys_t *fs,
int create_dir_sd(reiserfs_filsys_t fs,
struct reiserfs_path *path, struct reiserfs_key *key,
void (*modify_item) (struct item_head *, void *))
{
@@ -1195,7 +1195,7 @@ int create_dir_sd(reiserfs_filsys_t *fs,
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 *),
int ih_flags)
{
@@ -1290,7 +1290,7 @@ int can_we_format_it(char *device_name, int force)
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;
char buf[128];
@@ -1342,7 +1342,7 @@ int create_badblock_bitmap(reiserfs_filsys_t *fs, char *badblocks_file)
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_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,
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 */);
}
void mark_badblock(reiserfs_filsys_t *fs,
void mark_badblock(reiserfs_filsys_t fs,
struct reiserfs_path *badblock_path, void *data)
{
struct item_head *tmp_ih;
@@ -1430,7 +1430,7 @@ void mark_badblock(reiserfs_filsys_t *fs,
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 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
MAX_KEY. */
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;
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. */
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;
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. */
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. */
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
correctness of the top of the path but need not be checked for the
correctness of the bottom of the path */
int search_by_key(reiserfs_filsys_t *fs, struct 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
allocated and
initialized by the