reiserfsprogs: fix remaining sparse warnings

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
Jeff Mahoney committed 2013-08-26 19:02:19 -04:00
1 parent 20357cf349
commit 767f7b85df
25 files changed
+122 -116

No files matched your search

+12 -7
View File
@@ -738,7 +738,7 @@ int corrupt_block_header(struct block_head *blkh, unsigned int offset,
/* corrupt random number of bytes within block header started from random /* corrupt random number of bytes within block header started from random
offset */ offset */
void do_one_blkh_random_corrupt(struct buffer_head *bh) static void do_one_blkh_random_corrupt(struct buffer_head *bh)
{ {
struct block_head *blkh; struct block_head *blkh;
unsigned int from; unsigned int from;
@@ -889,7 +889,8 @@ 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 */
void do_ih_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr) static void do_ih_random_corrupt(reiserfs_filsys_t *fs,
unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
unsigned int i, j; unsigned int i, j;
@@ -973,7 +974,8 @@ void do_ih_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
} }
/* corrupt item */ /* corrupt item */
void do_one_item_random_corrupt(struct buffer_head *bh, struct item_head *ih) static void do_one_item_random_corrupt(struct buffer_head *bh,
struct item_head *ih)
{ {
unsigned int i; unsigned int i;
unsigned int from; unsigned int from;
@@ -1001,7 +1003,8 @@ void do_one_item_random_corrupt(struct buffer_head *bh, struct item_head *ih)
} }
/* corrupt the random number of directory items in random number of leaves */ /* corrupt the random number of directory items in random number of leaves */
void do_dir_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr) static void do_dir_random_corrupt(reiserfs_filsys_t *fs,
unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
unsigned int i, j; unsigned int i, j;
@@ -1086,7 +1089,8 @@ void do_dir_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
} }
/* 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 */
void do_sd_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr) static void do_sd_random_corrupt(reiserfs_filsys_t *fs,
unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
unsigned int i, j; unsigned int i, j;
@@ -1171,7 +1175,8 @@ void do_sd_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
} }
/* corrupt the random number of indierct items in random number of leaves */ /* corrupt the random number of indierct items in random number of leaves */
void do_ind_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr) static void do_ind_random_corrupt(reiserfs_filsys_t *fs,
unsigned long nr_leaves_cr)
{ {
unsigned int nr_ih_cr; unsigned int nr_ih_cr;
unsigned int i, j; unsigned int i, j;
@@ -1268,7 +1273,7 @@ void do_ind_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
corrupted corrupted
*/ */
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;
+7 -7
View File
@@ -238,10 +238,10 @@ static void print_one_block(reiserfs_filsys_t *fs, unsigned long block)
"bitmap" saved in that file and build the tree of blocks marked used in "bitmap" saved in that file and build the tree of blocks marked used in
that "bitmap" that "bitmap"
*/ */
char *where_to_save; static char *where_to_save;
char *badblocks_file; static char *badblocks_file;
char *corruption_list_file; static char *corruption_list_file;
char *program_name; static char *program_name;
static char *parse_options(struct debugreiserfs_data *data, static char *parse_options(struct debugreiserfs_data *data,
int argc, char *argv[]) int argc, char *argv[])
@@ -583,7 +583,7 @@ static void callback_badblock_print(reiserfs_filsys_t *fs,
pathrelse(badblock_path); pathrelse(badblock_path);
} }
void extract_badblock_list() static void extract_badblock_list(void)
{ {
FILE *fd; FILE *fd;
@@ -610,7 +610,7 @@ static int str2int(char *str, int *res)
return 1; return 1;
} }
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 @@ void do_corrupt_blocks(reiserfs_filsys_t *fs)
return; return;
} }
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;
+1 -6
View File
@@ -66,6 +66,7 @@ int main(int argc, char *argv[]);
#define OPT_FORCE 1 << 11 #define OPT_FORCE 1 << 11
/* pass0.c */ /* pass0.c */
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 *);
@@ -243,9 +244,6 @@ void mark_block_used(unsigned long block, int check_hardware);
void mark_block_uninsertable(unsigned long block); void mark_block_uninsertable(unsigned long block);
int is_block_uninsertable(unsigned long block); int is_block_uninsertable(unsigned long block);
/* objectid.c */
int comp_ids(const void *p1, const void *p2);
typedef struct id_map { typedef struct id_map {
void **index; void **index;
__u32 count, last_used; __u32 count, last_used;
@@ -469,9 +467,6 @@ 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 *);
/* journal.c */
int replay_journal(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);
+1 -1
View File
@@ -330,7 +330,7 @@ void load_lost_found_result(reiserfs_filsys_t *fs)
*/ */
} }
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);
+5 -5
View File
@@ -15,7 +15,7 @@ extern int screen_savebuffer_len;
extern char *screen_savebuffer; extern char *screen_savebuffer;
reiserfs_filsys_t *fs; reiserfs_filsys_t *fs;
char *badblocks_file; static char *badblocks_file;
#define print_usage_and_exit() { \ #define print_usage_and_exit() { \
fsck_progress ("Usage: %s [mode] [options] " \ fsck_progress ("Usage: %s [mode] [options] " \
@@ -317,7 +317,7 @@ static char *parse_options(struct fsck_data *data, int argc, char *argv[])
** that -- and only then run this program. **\n\ ** that -- and only then run this program. **\n\
*************************************************************\n\ *************************************************************\n\
\nWill rebuild the filesystem (%s) tree\n" \nWill rebuild the filesystem (%s) tree\n"
void warn_what_will_be_done(char *file_name, struct fsck_data *data) static void warn_what_will_be_done(char *file_name, struct fsck_data *data)
{ {
FILE *warn_to; FILE *warn_to;
@@ -422,7 +422,7 @@ void warn_what_will_be_done(char *file_name, struct fsck_data *data)
static dma_info_t dma_info; static dma_info_t dma_info;
static dma_info_t old_dma_info; static dma_info_t old_dma_info;
void check_dma() static void check_dma(int sig)
{ {
old_dma_info = dma_info; old_dma_info = dma_info;
if (get_dma_info(&dma_info) == -1) { if (get_dma_info(&dma_info) == -1) {
@@ -476,7 +476,7 @@ void check_dma()
alarm(1); alarm(1);
} }
void register_timer() static void register_timer(void)
{ {
memset(&dma_info, 0, sizeof(dma_info)); memset(&dma_info, 0, sizeof(dma_info));
memset(&old_dma_info, 0, sizeof(old_dma_info)); memset(&old_dma_info, 0, sizeof(old_dma_info));
@@ -770,7 +770,7 @@ static void reiserfsck_replay_journal(reiserfs_filsys_t *fs)
fs->fs_ondisk_sb = getmem(sb_size); fs->fs_ondisk_sb = getmem(sb_size);
memcpy(fs->fs_ondisk_sb, on_place_sb, sb_size); memcpy(fs->fs_ondisk_sb, on_place_sb, sb_size);
replay_journal(fs); reiserfs_replay_journal(fs);
/* Copy checked reliable sb fields from backed up sb to a new one. */ /* Copy checked reliable sb fields from backed up sb to a new one. */
set_sb_block_count(on_place_sb, get_sb_block_count(fs->fs_ondisk_sb)); set_sb_block_count(on_place_sb, get_sb_block_count(fs->fs_ondisk_sb));
+2 -2
View File
@@ -18,13 +18,13 @@ reiserfs_bitmap_t *leaves_bitmap;
#define pass0_mark_leaf(block) __mark (leaves, block) #define pass0_mark_leaf(block) __mark (leaves, block)
/* nodes which are referred to from only one indirect item */ /* nodes which are referred to from only one indirect item */
reiserfs_bitmap_t *good_unfm_bitmap; static reiserfs_bitmap_t *good_unfm_bitmap;
#define pass0_is_good_unfm(block) __is_marked (good_unfm, block) #define pass0_is_good_unfm(block) __is_marked (good_unfm, block)
#define pass0_mark_good_unfm(block) __mark (good_unfm, block) #define pass0_mark_good_unfm(block) __mark (good_unfm, block)
#define pass0_unmark_good_unfm(block) __unmark (good_unfm, block) #define pass0_unmark_good_unfm(block) __unmark (good_unfm, block)
/* nodes which are referred to from more than one indirect item */ /* nodes which are referred to from more than one indirect item */
reiserfs_bitmap_t *bad_unfm_bitmap; static reiserfs_bitmap_t *bad_unfm_bitmap;
#define pass0_is_bad_unfm(block) __is_marked (bad_unfm, block) #define pass0_is_bad_unfm(block) __is_marked (bad_unfm, block)
#define pass0_mark_bad_unfm(block) __mark (bad_unfm, block) #define pass0_mark_bad_unfm(block) __mark (bad_unfm, block)
#define pass0_unmark_bad_unfm(block) __unmark (bad_unfm, block) #define pass0_unmark_bad_unfm(block) __unmark (bad_unfm, block)
+6 -6
View File
@@ -24,7 +24,8 @@ struct buffer_head *make_buffer(int dev, unsigned long blocknr, int size,
return bh; return bh;
} }
int find_not_of_one_file(struct reiserfs_key *to_find, struct reiserfs_key *key) static int find_not_of_one_file(struct reiserfs_key *to_find,
struct reiserfs_key *key)
{ {
if ((get_key_objectid(to_find) != ~(__u32) 0) && if ((get_key_objectid(to_find) != ~(__u32) 0) &&
(get_key_objectid(to_find) != get_key_objectid(key))) (get_key_objectid(to_find) != get_key_objectid(key)))
@@ -165,7 +166,8 @@ static void insert_pointer(struct buffer_head *bh, struct reiserfs_path *path)
} }
/* return 1 if left and right can be joined. 0 otherwise */ /* return 1 if left and right can be joined. 0 otherwise */
int balance_condition_fails(struct buffer_head *left, struct buffer_head *right) static int balance_condition_fails(struct buffer_head *left,
struct buffer_head *right)
{ {
if (B_FREE_SPACE(left) >= B_CHILD_SIZE(right) - if (B_FREE_SPACE(left) >= B_CHILD_SIZE(right) -
(are_items_mergeable (are_items_mergeable
@@ -177,8 +179,8 @@ int balance_condition_fails(struct buffer_head *left, struct buffer_head *right)
/* return 1 if new can be joined with last node on the path or with /* return 1 if new can be joined with last node on the path or with
its right neighbor, 0 otherwise */ its right neighbor, 0 otherwise */
int balance_condition_2_fails(struct buffer_head *new, static int balance_condition_2_fails(struct buffer_head *new,
struct reiserfs_path *path) struct reiserfs_path *path)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct reiserfs_key *right_dkey; struct reiserfs_key *right_dkey;
@@ -672,8 +674,6 @@ void load_pass_1_result(FILE * fp, reiserfs_filsys_t *fs)
reiserfs_bitmap_zeros(fsck_uninsertables(fs))); reiserfs_bitmap_zeros(fsck_uninsertables(fs)));
} }
extern reiserfs_bitmap_t *leaves_bitmap;
/* 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)
+5 -5
View File
@@ -29,8 +29,8 @@ struct reiserfs_path_key {
struct reiserfs_path_key *next, *prev; struct reiserfs_path_key *next, *prev;
}; };
struct reiserfs_path_key *head_key = NULL; static struct reiserfs_path_key *head_key = NULL;
struct reiserfs_path_key *tail_key = NULL; static struct reiserfs_path_key *tail_key = NULL;
static int check_path_key(struct reiserfs_key *key) static int check_path_key(struct reiserfs_key *key)
{ {
@@ -68,7 +68,7 @@ static int add_path_key(struct reiserfs_key *key)
return 0; return 0;
} }
void del_path_key() static void del_path_key(void)
{ {
if (tail_key == NULL) if (tail_key == NULL)
die("Wrong path_key structure"); die("Wrong path_key structure");
@@ -750,7 +750,7 @@ static int check_semantic_pass(struct reiserfs_key *key,
return retval; return retval;
} }
int check_safe_links() static int check_safe_links(void)
{ {
struct reiserfs_path safe_link_path, path; struct reiserfs_path safe_link_path, path;
struct reiserfs_key safe_link_key = { -1, 0, {{0, 0}} }; struct reiserfs_key safe_link_key = { -1, 0, {{0, 0}} };
@@ -858,7 +858,7 @@ int check_safe_links()
return OK; return OK;
} }
void release_safe_links() static void release_safe_links(void)
{ {
freemem(trunc_links); freemem(trunc_links);
} }
+2 -2
View File
@@ -6,7 +6,7 @@
#include "fsck.h" #include "fsck.h"
int screen_width; int screen_width;
int screen_curr_pos; static int screen_curr_pos;
char *screen_savebuffer; char *screen_savebuffer;
int screen_savebuffer_len; int screen_savebuffer_len;
@@ -1138,7 +1138,6 @@ static void make_sure_lost_found_exists(reiserfs_filsys_t *fs)
__u64 sd_size; __u64 sd_size;
__u32 sd_blocks; __u32 sd_blocks;
struct buffer_head *bh; struct buffer_head *bh;
struct item_head *ih;
void *sd; void *sd;
int item_len; int item_len;
@@ -1202,6 +1201,7 @@ static void make_sure_lost_found_exists(reiserfs_filsys_t *fs)
&lost_found_dir_key, 1 << IH_Unreachable); &lost_found_dir_key, 1 << IH_Unreachable);
if (item_len) { if (item_len) {
struct item_head *ih;
if (reiserfs_search_by_key_4(fs, &root_dir_key, &path) == if (reiserfs_search_by_key_4(fs, &root_dir_key, &path) ==
ITEM_NOT_FOUND) ITEM_NOT_FOUND)
reiserfs_panic reiserfs_panic
+1 -1
View File
@@ -14,7 +14,7 @@
fsck_log(fmt, ## list); \ fsck_log(fmt, ## list); \
} }
int what_fs_version() static int what_fs_version(void)
{ {
size_t n = 0; size_t n = 0;
char *answer = NULL; char *answer = NULL;
+1 -1
View File
@@ -60,7 +60,7 @@ void mark_block_used(unsigned long block, int check_hardware)
reiserfs_bitmap_set_bit(fsck_new_bitmap(fs), block); reiserfs_bitmap_set_bit(fsck_new_bitmap(fs), block);
} }
void mark_block_free(unsigned long block) static void mark_block_free(unsigned long block)
{ {
if (!is_block_used(block)) if (!is_block_used(block))
die("mark_block_free: (%lu) is free already", block); die("mark_block_free: (%lu) is free already", block);
+2 -2
View File
@@ -21,9 +21,9 @@
#include <linux/major.h> #include <linux/major.h>
#if MAJOR_IN_MKDEV #if defined(MAJOR_IN_MKDEV)
# include <sys/mkdev.h> # include <sys/mkdev.h>
#elif MAJOR_IN_SYSMACROS #elif defined(MAJOR_IN_SYSMACROS)
# include <sys/sysmacros.h> # include <sys/sysmacros.h>
#endif #endif
+6 -1
View File
@@ -489,6 +489,8 @@ 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);
//#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
@@ -523,6 +525,8 @@ struct reiserfs_key {
} __attribute__ ((__packed__)) u; } __attribute__ ((__packed__)) u;
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
extern const struct reiserfs_key MIN_KEY, MAX_KEY;
/* set/get fields of keys on disk with these defines */ /* set/get fields of keys on disk with these defines */
#define get_key_dirid(k) get_le32 (k, k2_dir_id) #define get_key_dirid(k) get_le32 (k, k2_dir_id)
#define set_key_dirid(k,val) set_le32 (k, k2_dir_id, val) #define set_key_dirid(k,val) set_le32 (k, k2_dir_id, val)
@@ -1400,7 +1404,8 @@ struct buffer_info {
/* stree.c */ /* stree.c */
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 *);
struct reiserfs_key *get_rkey (struct reiserfs_path *p_s_chk_path, reiserfs_filsys_t *); const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path,
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 *);
+2 -2
View File
@@ -17,7 +17,7 @@ void check_memory_msg(void)
"the same place with the same block number.\n"); "the same place with the same block number.\n");
} }
void check_hd_msg(void) static void check_hd_msg(void)
{ {
fprintf(stderr, fprintf(stderr,
"\nThe problem has occurred looks like a hardware problem. If you have\n" "\nThe problem has occurred looks like a hardware problem. If you have\n"
@@ -630,7 +630,7 @@ int open_rollback_file(char *rollback_file, FILE * log)
return 0; return 0;
} }
void close_rollback_file() void close_rollback_file(void)
{ {
if (!s_rollback_file) if (!s_rollback_file)
return; return;
+2 -2
View File
@@ -360,8 +360,8 @@ int misc_device_mounted(char *device)
return hasmntopt(mnt, MNTOPT_RO) ? MF_RO : MF_RW; return hasmntopt(mnt, MNTOPT_RO) ? MF_RO : MF_RW;
} }
char buf1[100]; static char buf1[100];
char buf2[100]; static char buf2[100];
void print_how_fast(unsigned long passed, unsigned long total, void print_how_fast(unsigned long passed, unsigned long total,
int cursor_pos, int reset_time) int cursor_pos, int reset_time)
+1
View File
@@ -3,6 +3,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include "parse_time.h"
#include "misc.h" #include "misc.h"
#include "reiserfs_lib.h" #include "reiserfs_lib.h"
+14 -15
View File
@@ -1,5 +1,4 @@
/* /* * Copyright 1996-2004 by Hans Reiser, licensing governed by
* Copyright 1996-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README * reiserfsprogs/README
*/ */
@@ -34,7 +33,7 @@
# include <uuid/uuid.h> # include <uuid/uuid.h>
#endif #endif
char *program_name; static char *program_name;
static void message(const char *fmt, ...) static void message(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2))); __attribute__ ((format(printf, 1, 2)));
@@ -84,18 +83,18 @@ static void print_usage_and_exit(void)
exit(1); exit(1);
} }
int Create_default_journal = 1; static int Create_default_journal = 1;
int Block_size = 4096; static int Block_size = 4096;
/* size of journal + 1 block for journal header */ /* size of journal + 1 block for journal header */
unsigned long Journal_size = 0; static unsigned long Journal_size = 0;
int Max_trans_size = 0; //JOURNAL_TRANS_MAX; static int Max_trans_size = 0; //JOURNAL_TRANS_MAX;
int Hash = DEFAULT_HASH; static int Hash = DEFAULT_HASH;
int Offset = 0; static int Offset = 0;
char *Format; static char *Format;
unsigned char UUID[16]; static unsigned char UUID[16];
char *LABEL = NULL; static char *LABEL = NULL;
char *badblocks_file; static char *badblocks_file;
enum mkfs_mode { enum mkfs_mode {
DEBUG_MODE = 1 << 0, DEBUG_MODE = 1 << 0,
@@ -103,7 +102,7 @@ enum mkfs_mode {
DO_NOTHING = 1 << 2 DO_NOTHING = 1 << 2
}; };
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)
@@ -167,7 +166,7 @@ static void invalidate_other_formats(int dev)
brelse(bh); brelse(bh);
} }
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;
+1 -2
View File
@@ -926,12 +926,11 @@ static struct buffer_head *get_left_neighbor(reiserfs_filsys_t *s,
return bh; return bh;
} }
extern struct reiserfs_key MIN_KEY;
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;
struct reiserfs_key *rkey; const struct reiserfs_key *rkey;
struct reiserfs_path path_to_right_neighbor; struct reiserfs_path path_to_right_neighbor;
struct buffer_head *bh; struct buffer_head *bh;
+9 -6
View File
@@ -19,7 +19,8 @@ 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 */
unsigned long commit_expected(reiserfs_filsys_t *fs, struct buffer_head *d_bh) static unsigned long commit_expected(reiserfs_filsys_t *fs,
struct buffer_head *d_bh)
{ {
unsigned long offset; unsigned long offset;
struct journal_params *sb_jp; struct journal_params *sb_jp;
@@ -34,8 +35,8 @@ unsigned long commit_expected(reiserfs_filsys_t *fs, struct buffer_head *d_bh)
/* 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 */
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;
struct journal_params *sb_jp; struct journal_params *sb_jp;
@@ -49,7 +50,8 @@ unsigned long next_desc_expected(reiserfs_filsys_t *fs,
} }
/* common checks for validness of a transaction */ /* common checks for validness of a transaction */
int transaction_check_content(reiserfs_filsys_t *fs, reiserfs_trans_t *trans) static int transaction_check_content(reiserfs_filsys_t *fs,
reiserfs_trans_t *trans)
{ {
struct buffer_head *d_bh, *c_bh; struct buffer_head *d_bh, *c_bh;
struct reiserfs_journal_desc *desc; struct reiserfs_journal_desc *desc;
@@ -100,7 +102,8 @@ error_desc_brelse:
} }
/* common checks for validness of a transaction */ /* common checks for validness of a transaction */
int transaction_check_desc(reiserfs_filsys_t *fs, struct buffer_head *d_bh) static int transaction_check_desc(reiserfs_filsys_t *fs,
struct buffer_head *d_bh)
{ {
struct buffer_head *c_bh; struct buffer_head *c_bh;
int ret = 1; int ret = 1;
@@ -817,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 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;
+1 -1
View File
@@ -1145,7 +1145,7 @@ void get_set_sd_field(int field, struct item_head *ih, void *sd,
} }
} }
int comp_ids(const void *p1, const void *p2) static int comp_ids(const void *p1, const void *p2)
{ {
__u32 id1 = le32_to_cpu(*(__u32 *) p1); __u32 id1 = le32_to_cpu(*(__u32 *) p1);
__u32 id2 = le32_to_cpu(*(__u32 *) p2); __u32 id2 = le32_to_cpu(*(__u32 *) p2);
+6 -6
View File
@@ -229,7 +229,7 @@ static char *vi_type(struct virtual_item *vi)
return NULL; return NULL;
} }
void print_virtual_node(struct virtual_node *vn) static void print_virtual_node(struct virtual_node *vn)
{ {
int i, j; int i, j;
@@ -255,7 +255,7 @@ void print_virtual_node(struct virtual_node *vn)
} }
} }
void print_path(struct tree_balance *tb, struct reiserfs_path *path) static void print_path(struct tree_balance *tb, struct reiserfs_path *path)
{ {
int offset = path->path_length; int offset = path->path_length;
struct buffer_head *bh; struct buffer_head *bh;
@@ -272,8 +272,8 @@ void print_path(struct tree_balance *tb, struct reiserfs_path *path)
} }
} }
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;
int namelen; int namelen;
@@ -383,9 +383,9 @@ void print_indirect_item(FILE * fp, struct buffer_head *bh, int item_num)
reiserfs_warning(fp, "]\n"); reiserfs_warning(fp, "]\n");
} }
char timebuf[256]; static char timebuf[256];
char *timestamp(time_t t) static char *timestamp(time_t t)
{ {
strftime(timebuf, 256, "%d/%Y %T", localtime(&t)); strftime(timebuf, 256, "%d/%Y %T", localtime(&t));
return timebuf; return timebuf;
+7 -7
View File
@@ -12,7 +12,7 @@
struct reiserfs_key root_dir_key = { 0, 0, {{0, 0},} }; struct reiserfs_key root_dir_key = { 0, 0, {{0, 0},} };
struct reiserfs_key parent_root_dir_key = { 0, 0, {{0, 0},} }; struct reiserfs_key parent_root_dir_key = { 0, 0, {{0, 0},} };
struct reiserfs_key lost_found_dir_key = { 0, 0, {{0, 0},} }; struct reiserfs_key lost_found_dir_key = { 0, 0, {{0, 0},} };
struct reiserfs_key badblock_key = static struct reiserfs_key badblock_key =
{ BADBLOCK_DIRID, BADBLOCK_OBJID, {{0, 0},} }; { BADBLOCK_DIRID, BADBLOCK_OBJID, {{0, 0},} };
__u16 root_dir_format = 0; __u16 root_dir_format = 0;
@@ -190,8 +190,8 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
int default_journal, int new_format) int default_journal, int new_format)
{ {
reiserfs_filsys_t *fs; reiserfs_filsys_t *fs;
unsigned int bmap_nr = reiserfs_bmap_nr(block_count, block_size);;
time_t now; time_t now;
unsigned int bmap_nr = reiserfs_bmap_nr(block_count, block_size);;
/* convert root dir key and parent root dir key to little endian format */ /* convert root dir key and parent root dir key to little endian format */
make_const_keys(); make_const_keys();
@@ -320,7 +320,7 @@ 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;
} }
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;
} }
@@ -1043,8 +1043,8 @@ int reiserfs_find_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir,
} }
/* compose directory entry: dir entry head and name itself */ /* compose directory entry: dir entry head and name itself */
char *make_entry(char *entry, char *name, struct reiserfs_key *key, static char *make_entry(char *entry, char *name, struct reiserfs_key *key,
__u32 offset) __u32 offset)
{ {
struct reiserfs_de_head *deh; struct reiserfs_de_head *deh;
__u16 state; __u16 state;
@@ -1142,12 +1142,12 @@ int reiserfs_add_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir,
return item_len; return item_len;
} }
void copy_key(void *to, void *from) void copy_key(void *to, const void *from)
{ {
memcpy(to, from, KEY_SIZE); memcpy(to, from, KEY_SIZE);
} }
void copy_short_key(void *to, void *from) void copy_short_key(void *to, const void *from)
{ {
memcpy(to, from, SHORT_KEY_SIZE); memcpy(to, from, SHORT_KEY_SIZE);
} }
+11 -10
View File
@@ -173,10 +173,10 @@ int bin_search(void *p_v_key, /* Key to search for. */
} }
/* Minimal possible key. It is never in the tree. */ /* Minimal possible key. It is never in the tree. */
struct reiserfs_key MIN_KEY = { 0, 0, {{0, 0},} }; const struct reiserfs_key MIN_KEY = { 0, 0, {{0, 0},} };
/* Maximal possible key. It is never in the tree. */ /* Maximal possible key. It is never in the tree. */
struct reiserfs_key MAX_KEY = const struct reiserfs_key MAX_KEY =
{ 0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},} }; { 0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},} };
/* Get delimiting key of the buffer by looking for it in the buffers in the /* Get delimiting key of the buffer by looking for it in the buffers in the
@@ -185,8 +185,8 @@ struct reiserfs_key MAX_KEY =
there is no delimiting key in the tree (buffer is first or last buffer in there is no delimiting key in the tree (buffer is first or last buffer in
tree), and in this case we return a special key, either MIN_KEY or tree), and in this case we return a special key, either MIN_KEY or
MAX_KEY. */ MAX_KEY. */
struct reiserfs_key *get_lkey(struct reiserfs_path *p_s_chk_path, static const struct reiserfs_key *get_lkey(const struct reiserfs_path *p_s_chk_path,
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;
@@ -224,8 +224,8 @@ struct reiserfs_key *get_lkey(struct reiserfs_path *p_s_chk_path,
} }
/* 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. */
struct reiserfs_key *get_rkey(struct reiserfs_path *p_s_chk_path, const struct reiserfs_key *get_rkey(const struct reiserfs_path *p_s_chk_path,
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;
@@ -268,8 +268,8 @@ struct reiserfs_key *get_rkey(struct reiserfs_path *p_s_chk_path,
the first or last node in the tree order then one of the delimiting keys the first or last node in the tree order then one of the delimiting keys
may be absent, and in this case get_lkey and get_rkey return a special key may be absent, and in this case get_lkey and get_rkey return a special key
which is MIN_KEY or MAX_KEY. */ which is MIN_KEY or MAX_KEY. */
static inline int key_in_buffer(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. */
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. */
) )
{ {
@@ -406,8 +406,9 @@ int search_by_key(reiserfs_filsys_t *fs, struct reiserfs_key *p_s_key, /* Key to
} }
} }
int bin_search_in_dir_item(struct item_head *ih, struct reiserfs_de_head *deh, static int bin_search_in_dir_item(struct item_head *ih,
struct reiserfs_key *key, int *pos_in_item) struct reiserfs_de_head *deh,
struct reiserfs_key *key, int *pos_in_item)
{ {
int rbound, lbound, j; int rbound, lbound, j;
+2 -2
View File
@@ -15,12 +15,12 @@
#include "resize.h" #include "resize.h"
#include <limits.h> #include <limits.h>
int opt_banner = 0; static int opt_banner = 0;
static int opt_skipj = 0;
int opt_force = 0; int opt_force = 0;
int opt_verbose = 1; /* now "verbose" option is default */ int opt_verbose = 1; /* now "verbose" option is default */
int opt_nowrite = 0; int opt_nowrite = 0;
int opt_safe = 0; int opt_safe = 0;
int opt_skipj = 0;
char *g_progname; char *g_progname;
+15 -17
View File
@@ -14,7 +14,7 @@
#include <limits.h> #include <limits.h>
#include "parse_time.h" #include "parse_time.h"
char *program_name; static char *program_name;
static void message(const char *fmt, ...) static void message(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2))); __attribute__ ((format(printf, 1, 2)));
@@ -35,8 +35,6 @@ static void message(const char *fmt, ...)
} }
} }
reiserfs_filsys_t *fs;
static void print_usage_and_exit(void) static void print_usage_and_exit(void)
{ {
message("Usage: %s [options] device [block-count]\n" message("Usage: %s [options] device [block-count]\n"
@@ -70,19 +68,19 @@ static void print_usage_and_exit(void)
exit(1); exit(1);
} }
unsigned long Journal_size = 0; static unsigned long Journal_size = 0;
int Max_trans_size = JOURNAL_TRANS_MAX; static int Max_trans_size = JOURNAL_TRANS_MAX;
unsigned short Max_mnt_count = 0; static unsigned short Max_mnt_count = 0;
unsigned short Mnt_count = 0; static unsigned short Mnt_count = 0;
unsigned int Check_interval = 0; static unsigned int Check_interval = 0;
time_t Time_last_checked = 0; static time_t Time_last_checked = 0;
int Offset = 0; static int Offset = 0;
__u16 Options = 0; static __u16 Options = 0;
int Force = 0; static int Force = 0;
int Bads = 0; static int Bads = 0;
char *LABEL; static char *LABEL;
unsigned char UUID[16]; static unsigned char UUID[16];
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,
@@ -195,7 +193,7 @@ static int set_standard_journal_params(reiserfs_filsys_t *fs)
return 1; return 1;
} }
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;