reiserfsprogs: Fix sparse "warning: Using plain integer as NULL pointer"
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
1 parent
dd29f49a6c
commit
20357cf349
27 files changed
+192
-188
No files matched your search
+2
-2
@@ -1030,7 +1030,7 @@ static struct reiserfs_key *lkey(struct buffer_head **path, int h)
|
||||
return internal_key(path[h - 1], pos - 1);
|
||||
h--;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* path[h] - leaf node */
|
||||
@@ -1044,7 +1044,7 @@ static struct reiserfs_key *rkey(struct buffer_head **path, int h)
|
||||
return internal_key(path[h - 1], pos);
|
||||
h--;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* are all delimiting keys correct */
|
||||
|
||||
+3
-3
@@ -213,7 +213,7 @@ static __u64 _look_for_lost(reiserfs_filsys_t *fs, int link_lost_dirs)
|
||||
rebuild_semantic_pass(&obj_key,
|
||||
&lost_found_dir_key,
|
||||
/*dot_dot */ 0,
|
||||
/*reloc_ih */ 0);
|
||||
/*reloc_ih */ NULL);
|
||||
erase_name(strlen(lost_name));
|
||||
/*fsck_progress ("finished\n"); */
|
||||
|
||||
@@ -233,7 +233,7 @@ static __u64 _look_for_lost(reiserfs_filsys_t *fs, int link_lost_dirs)
|
||||
rebuild_check_regular_file(&path,
|
||||
tp_item_body
|
||||
(&path),
|
||||
0
|
||||
NULL
|
||||
/*reloc_ih */
|
||||
);
|
||||
pathrelse(&path);
|
||||
@@ -355,7 +355,7 @@ void after_lost_found(reiserfs_filsys_t *fs)
|
||||
save_lost_found_result(fs);
|
||||
|
||||
id_map_free(proper_id_map(fs));
|
||||
proper_id_map(fs) = 0;
|
||||
proper_id_map(fs) = NULL;
|
||||
|
||||
fs->fs_dirt = 1;
|
||||
reiserfs_close(fs);
|
||||
|
||||
+21
-21
@@ -100,39 +100,39 @@ static char *parse_options(struct fsck_data *data, int argc, char *argv[])
|
||||
{"clean-attributes", no_argument, &mode,
|
||||
FSCK_CLEAN_ATTRIBUTES},
|
||||
/* options */
|
||||
{"logfile", required_argument, 0, 'l'},
|
||||
{"badblocks", required_argument, 0, 'B'},
|
||||
{"interactive", no_argument, 0, 'i'},
|
||||
{"adjust-size", no_argument, 0, 'z'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"yes", no_argument, 0, 'y'},
|
||||
{"force", no_argument, 0, 'f'},
|
||||
{"nolog", no_argument, 0, 'n'},
|
||||
{"logfile", required_argument, NULL, 'l'},
|
||||
{"badblocks", required_argument, NULL, 'B'},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"adjust-size", no_argument, NULL, 'z'},
|
||||
{"quiet", no_argument, NULL, 'q'},
|
||||
{"yes", no_argument, NULL, 'y'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"nolog", no_argument, NULL, 'n'},
|
||||
|
||||
/* if file exists ad reiserfs can be load of it - only
|
||||
blocks marked used in that bitmap will be read */
|
||||
{"scan-marked-in-bitmap", required_argument, 0, 'b'},
|
||||
{"scan-marked-in-bitmap", required_argument, NULL, 'b'},
|
||||
|
||||
{"create-passes-dump", required_argument, 0, 'd'},
|
||||
{"create-passes-dump", required_argument, NULL, 'd'},
|
||||
|
||||
/* all blocks will be read */
|
||||
{"scan-whole-partition", no_argument, 0, 'S'},
|
||||
{"scan-whole-partition", no_argument, NULL, 'S'},
|
||||
/* useful for -S */
|
||||
{"hash", required_argument, 0, 'h'},
|
||||
{"hash", required_argument, NULL, 'h'},
|
||||
|
||||
/* preparing rollback data */
|
||||
{"rollback-data", required_argument, 0, 'R'},
|
||||
{"rollback-data", required_argument, NULL, 'R'},
|
||||
|
||||
{"journal", required_argument, 0, 'j'},
|
||||
{"journal", required_argument, NULL, 'j'},
|
||||
{"no-journal-available", no_argument, &flag,
|
||||
OPT_SKIP_JOURNAL},
|
||||
|
||||
{"bad-block-file", required_argument, 0, 'B'},
|
||||
{"bad-block-file", required_argument, NULL, 'B'},
|
||||
|
||||
/* start reiserfsck in background and exit */
|
||||
{"background", no_argument, 0, 'g'},
|
||||
{"background", no_argument, NULL, 'g'},
|
||||
|
||||
{0, 0, 0, 0}
|
||||
{}
|
||||
};
|
||||
int option_index;
|
||||
|
||||
@@ -209,7 +209,7 @@ static char *parse_options(struct fsck_data *data, int argc, char *argv[])
|
||||
|
||||
case 'h': /* --hash: suppose that this hash was used on a filesystem */
|
||||
asprintf(&data->rebuild.defined_hash, "%s", optarg);
|
||||
if (name2func(data->rebuild.defined_hash) == 0)
|
||||
if (name2func(data->rebuild.defined_hash) == NULL)
|
||||
reiserfs_panic
|
||||
("reiserfsck: Unknown hash is specified: %s",
|
||||
data->rebuild.defined_hash);
|
||||
@@ -630,7 +630,7 @@ static void reset_super_block(reiserfs_filsys_t *fs)
|
||||
static int where_to_start_from(reiserfs_filsys_t *fs)
|
||||
{
|
||||
int ret;
|
||||
FILE *fp = 0;
|
||||
FILE *fp = NULL;
|
||||
int last_run_state;
|
||||
|
||||
last_run_state = get_sb_fs_state(fs->fs_ondisk_sb);
|
||||
@@ -640,7 +640,7 @@ static int where_to_start_from(reiserfs_filsys_t *fs)
|
||||
/* We are able to perform the next step only if there is a file with the previous
|
||||
* step results. */
|
||||
fp = open_file(state_dump_file(fs), "r");
|
||||
if (fp == 0) {
|
||||
if (fp == NULL) {
|
||||
set_sb_fs_state(fs->fs_ondisk_sb, 0);
|
||||
return START_FROM_THE_BEGINNING;
|
||||
}
|
||||
@@ -1300,7 +1300,7 @@ static void fsck_rollback(reiserfs_filsys_t *fs)
|
||||
|
||||
close(fs->fs_journal_dev);
|
||||
free(fs->fs_file_name);
|
||||
fs->fs_file_name = 0;
|
||||
fs->fs_file_name = NULL;
|
||||
close(fs->fs_dev);
|
||||
freemem(fs);
|
||||
|
||||
|
||||
+4
-4
@@ -364,7 +364,7 @@ static int verify_directory_item(reiserfs_filsys_t *fs, struct buffer_head *bh,
|
||||
get_sb_hash_code(fs->
|
||||
fs_ondisk_sb));
|
||||
/* add_hash_hit (fs, hash_code);*/
|
||||
if (code2func(hash_code) != 0) {
|
||||
if (code2func(hash_code) != NULL) {
|
||||
/* deh_offset matches to some hash of the name */
|
||||
if (fsck_hash_defined(fs) &&
|
||||
hash_code !=
|
||||
@@ -2038,7 +2038,7 @@ static void choose_hash_function(reiserfs_filsys_t *fs)
|
||||
return;
|
||||
|
||||
max = 0;
|
||||
hash_code = func2code(0);
|
||||
hash_code = func2code(NULL);
|
||||
|
||||
for (i = 0; i < fsck_data(fs)->rebuild.hash_amount; i++) {
|
||||
/* remember hash whihc got more hits */
|
||||
@@ -2294,7 +2294,7 @@ static void after_pass_0(reiserfs_filsys_t *fs)
|
||||
|
||||
/* free what we do not need anymore */
|
||||
reiserfs_delete_bitmap(fsck_source_bitmap(fs));
|
||||
fsck_source_bitmap(fs) = 0;
|
||||
fsck_source_bitmap(fs) = NULL;
|
||||
|
||||
if (!fsck_run_one_step(fs)) {
|
||||
if (fsck_user_confirmed(fs, "Continue? (Yes):", "Yes\n", 1)) {
|
||||
@@ -2306,7 +2306,7 @@ static void after_pass_0(reiserfs_filsys_t *fs)
|
||||
save_pass_0_result(fs);
|
||||
|
||||
id_map_free(proper_id_map(fs));
|
||||
proper_id_map(fs) = 0;
|
||||
proper_id_map(fs) = NULL;
|
||||
|
||||
time(&t);
|
||||
fsck_progress("###########\n"
|
||||
|
||||
+9
-7
@@ -115,7 +115,8 @@ static void indirect_in_tree(struct buffer_head *bh, struct item_head *ih)
|
||||
|
||||
static void leaf_is_in_tree_now(struct buffer_head *bh)
|
||||
{
|
||||
item_action_t actions[] = { stat_data_in_tree, indirect_in_tree, 0, 0 };
|
||||
item_action_t actions[] = { stat_data_in_tree, indirect_in_tree,
|
||||
NULL, NULL };
|
||||
|
||||
mark_block_used((bh)->b_blocknr, 1);
|
||||
|
||||
@@ -136,7 +137,7 @@ static void insert_pointer(struct buffer_head *bh, struct reiserfs_path *path)
|
||||
init_tb_struct(&tb, fs, path, 0x7fff);
|
||||
|
||||
/* fix_nodes & do_balance must work for internal nodes only */
|
||||
ih = 0;
|
||||
ih = NULL;
|
||||
|
||||
retval = fix_nodes( /*tb.transaction_handle, */ M_INTERNAL, &tb, ih);
|
||||
if (retval != CARRY_ON)
|
||||
@@ -149,12 +150,12 @@ static void insert_pointer(struct buffer_head *bh, struct reiserfs_path *path)
|
||||
if (PATH_LAST_POSITION(path) == 0 && path->pos_in_item == 0)
|
||||
PATH_H_B_ITEM_ORDER(path, 0) = -1;
|
||||
else {
|
||||
if (PATH_H_PPARENT(path, 0) == 0)
|
||||
if (PATH_H_PPARENT(path, 0) == NULL)
|
||||
PATH_H_B_ITEM_ORDER(path, 0) = 0;
|
||||
/* PATH_H_B_ITEM_ORDER (path, 0) = PATH_H_PPARENT (path, 0) ? PATH_H_B_ITEM_ORDER (path, 0) : 0;*/
|
||||
}
|
||||
|
||||
ih = 0;
|
||||
ih = NULL;
|
||||
body = (char *)bh;
|
||||
//memmode = 0;
|
||||
|
||||
@@ -192,7 +193,7 @@ int balance_condition_2_fails(struct buffer_head *new,
|
||||
/* new node can not be joined with its left neighbor */
|
||||
|
||||
right_dkey = uget_rkey(path);
|
||||
if (right_dkey == 0)
|
||||
if (right_dkey == NULL)
|
||||
/* there is no right neighbor */
|
||||
return 0;
|
||||
|
||||
@@ -293,7 +294,8 @@ static void try_to_insert_pointer_to_leaf(struct buffer_head *new_bh)
|
||||
if (balance_condition_fails(new_bh, bh))
|
||||
goto cannot_insert;
|
||||
|
||||
if (uget_lkey(&path) != 0 || PATH_LAST_POSITION(&path) != 0)
|
||||
if (uget_lkey(&path) != NULL ||
|
||||
PATH_LAST_POSITION(&path) != 0)
|
||||
die("try_to_insert_pointer_to_leaf: bad search result");
|
||||
|
||||
path.pos_in_item = 0;
|
||||
@@ -808,7 +810,7 @@ static void after_pass_1(reiserfs_filsys_t *fs)
|
||||
if (proper_id_map(fs)) {
|
||||
/* when we run pass 1 only - we do not have proper_id_map */
|
||||
id_map_free(proper_id_map(fs));
|
||||
proper_id_map(fs) = 0;
|
||||
proper_id_map(fs) = NULL;
|
||||
}
|
||||
|
||||
time(&t);
|
||||
|
||||
+3
-3
@@ -143,7 +143,7 @@ void save_item(struct si **head, struct item_head *ih, char *item,
|
||||
memcpy(&(si->si_ih), ih, IH_SIZE);
|
||||
memcpy(si->si_dnm_data, item, get_ih_item_len(ih));
|
||||
|
||||
if (*head == 0)
|
||||
if (*head == NULL)
|
||||
*head = si;
|
||||
else {
|
||||
cur = *head;
|
||||
@@ -503,7 +503,7 @@ static void do_pass_2(reiserfs_filsys_t *fs)
|
||||
reiserfs_bitmap_find_zero_bit(fsck_uninsertables(fs),
|
||||
&j) == 0) {
|
||||
bh = bread(fs->fs_dev, j, fs->fs_blocksize);
|
||||
if (bh == 0) {
|
||||
if (bh == NULL) {
|
||||
fsck_log
|
||||
("pass_2: Reading of the block (%lu) failed on the device 0x%x\n",
|
||||
j, fs->fs_dev);
|
||||
@@ -606,7 +606,7 @@ static void after_pass_2(reiserfs_filsys_t *fs)
|
||||
save_pass_2_result(fs);
|
||||
|
||||
id_map_free(proper_id_map(fs));
|
||||
proper_id_map(fs) = 0;
|
||||
proper_id_map(fs) = NULL;
|
||||
|
||||
reiserfs_delete_bitmap(fsck_new_bitmap(fs));
|
||||
reiserfs_delete_bitmap(fsck_allocable_bitmap(fs));
|
||||
|
||||
@@ -283,7 +283,7 @@ start_again:
|
||||
one_more_corruption(fs, FIXABLE);
|
||||
fsck_log("\n");
|
||||
if (retval == DIRECTORY_NOT_FOUND)
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ static int check_semantic_pass(struct reiserfs_key *key,
|
||||
|
||||
retval =
|
||||
check_check_regular_file(&path, sd,
|
||||
/* relocate ? new_ih : */ 0);
|
||||
/* relocate ? new_ih : */ NULL);
|
||||
pathrelse(&path);
|
||||
return retval;
|
||||
}
|
||||
@@ -538,11 +538,11 @@ static int check_semantic_pass(struct reiserfs_key *key,
|
||||
dir_size = 0;
|
||||
while ((dir_item =
|
||||
get_next_directory_item(&next_item_key, parent, &tmp_ih,
|
||||
&pos_in_item, dir_format)) != 0) {
|
||||
&pos_in_item, dir_format)) != NULL) {
|
||||
/* dir_item is copy of the item in separately allocated memory,
|
||||
item_key is a key of next item in the tree */
|
||||
int i;
|
||||
char *name = 0;
|
||||
char *name = NULL;
|
||||
int namelen, entry_len;
|
||||
struct reiserfs_de_head *deh =
|
||||
(struct reiserfs_de_head *)dir_item + pos_in_item;
|
||||
@@ -554,7 +554,7 @@ static int check_semantic_pass(struct reiserfs_key *key,
|
||||
|
||||
if (name) {
|
||||
free(name);
|
||||
name = 0;
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
namelen = name_in_entry_length(&tmp_ih, deh, i);
|
||||
@@ -701,7 +701,7 @@ static int check_semantic_pass(struct reiserfs_key *key,
|
||||
|
||||
freemem(dir_item);
|
||||
free(name);
|
||||
name = 0;
|
||||
name = NULL;
|
||||
|
||||
if (not_of_one_file(&next_item_key, key))
|
||||
/* next key is not of this directory */
|
||||
@@ -895,7 +895,7 @@ void semantic_check(void)
|
||||
|
||||
check_safe_links();
|
||||
|
||||
if (check_semantic_pass(&root_dir_key, &parent_root_dir_key, 0, 0) !=
|
||||
if (check_semantic_pass(&root_dir_key, &parent_root_dir_key, 0, NULL) !=
|
||||
OK) {
|
||||
fsck_log("check_semantic_tree: No root directory found");
|
||||
one_more_corruption(fs, FATAL);
|
||||
|
||||
@@ -332,7 +332,7 @@ void relocate_dir(struct item_head *ih, int change_ih)
|
||||
key = ih->ih_key;
|
||||
set_type_and_offset(KEY_FORMAT_1, &key, SD_OFFSET, TYPE_STAT_DATA);
|
||||
|
||||
si = 0;
|
||||
si = NULL;
|
||||
while (1) {
|
||||
reiserfs_search_by_key_4(fs, &key, &path);
|
||||
|
||||
@@ -582,7 +582,7 @@ static char *get_next_directory_item(struct reiserfs_key *key, /* on return this
|
||||
("get_next_directory_item: The entry \"..\" cannot be found in %k\n",
|
||||
&ih->ih_key);
|
||||
pathrelse(&path);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,7 +796,7 @@ start_again: /* when directory was relocated */
|
||||
if (not_a_directory(sd)) {
|
||||
retval =
|
||||
rebuild_check_regular_file(&path, sd,
|
||||
relocate ? new_ih : 0);
|
||||
relocate ? new_ih : NULL);
|
||||
pathrelse(&path);
|
||||
return retval;
|
||||
}
|
||||
@@ -901,11 +901,11 @@ start_again: /* when directory was relocated */
|
||||
dir_size = 0;
|
||||
while ((dir_item =
|
||||
get_next_directory_item(&item_key, parent, &tmp_ih,
|
||||
&pos_in_item)) != 0) {
|
||||
&pos_in_item)) != NULL) {
|
||||
/* dir_item is copy of the item in separately allocated memory,
|
||||
item_key is a key of next item in the tree */
|
||||
int i;
|
||||
char *name = 0;
|
||||
char *name = NULL;
|
||||
int namelen, entry_len;
|
||||
struct reiserfs_de_head *deh =
|
||||
(struct reiserfs_de_head *)dir_item + pos_in_item;
|
||||
@@ -916,7 +916,7 @@ start_again: /* when directory was relocated */
|
||||
|
||||
if (name) {
|
||||
free(name);
|
||||
name = 0;
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
namelen = name_in_entry_length(&tmp_ih, deh, i);
|
||||
@@ -1030,7 +1030,7 @@ start_again: /* when directory was relocated */
|
||||
|
||||
freemem(dir_item);
|
||||
free(name);
|
||||
name = 0;
|
||||
name = NULL;
|
||||
|
||||
if (not_of_one_file(&item_key, key))
|
||||
/* next key is not of this directory */
|
||||
@@ -1302,7 +1302,7 @@ static void after_pass_3(reiserfs_filsys_t *fs)
|
||||
save_rebuild_semantic_result(fs);
|
||||
|
||||
id_map_free(proper_id_map(fs));
|
||||
proper_id_map(fs) = 0;
|
||||
proper_id_map(fs) = NULL;
|
||||
|
||||
fs->fs_dirt = 1;
|
||||
reiserfs_close(fs);
|
||||
@@ -1333,7 +1333,7 @@ void pass_3_semantic(reiserfs_filsys_t *fs)
|
||||
link_relocated_files();
|
||||
|
||||
rebuild_semantic_pass(&root_dir_key, &parent_root_dir_key,
|
||||
0 /*!dot_dot */ , 0 /*reloc_ih */ );
|
||||
0 /*!dot_dot */ , NULL /*reloc_ih */ );
|
||||
|
||||
add_badblock_list(fs, 1);
|
||||
|
||||
|
||||
+6
-6
@@ -17,7 +17,7 @@
|
||||
int what_fs_version()
|
||||
{
|
||||
size_t n = 0;
|
||||
char *answer = 0;
|
||||
char *answer = NULL;
|
||||
int version;
|
||||
printf("\nwhat the version of ReiserFS do you use[1-4]\n"
|
||||
"\t(1) 3.6.x\n"
|
||||
@@ -171,8 +171,8 @@ int check_sb (reiserfs_filsys_t *fs) {
|
||||
void rebuild_sb(reiserfs_filsys_t *fs, char *filename, struct fsck_data *data)
|
||||
{
|
||||
int version = 0;
|
||||
struct reiserfs_super_block *ondisk_sb = 0;
|
||||
struct reiserfs_super_block *sb = 0;
|
||||
struct reiserfs_super_block *ondisk_sb = NULL;
|
||||
struct reiserfs_super_block *sb = NULL;
|
||||
struct reiserfs_journal_header *j_head;
|
||||
|
||||
int magic_was_found = 0;
|
||||
@@ -182,11 +182,11 @@ void rebuild_sb(reiserfs_filsys_t *fs, char *filename, struct fsck_data *data)
|
||||
__u32 p_jp_journal_1st_block = 0;
|
||||
__u32 p_jp_dev_size = 0;
|
||||
int standard_journal = -1;
|
||||
char *journal_dev_name = 0;
|
||||
char *journal_dev_name = NULL;
|
||||
char *tmp;
|
||||
int sb_size;
|
||||
|
||||
char *answer = 0;
|
||||
char *answer = NULL;
|
||||
size_t n = 0;
|
||||
struct stat stat_buf;
|
||||
int retval, exit_code = EXIT_OK;
|
||||
@@ -525,7 +525,7 @@ void rebuild_sb(reiserfs_filsys_t *fs, char *filename, struct fsck_data *data)
|
||||
set_sb_tree_height(sb, 0);
|
||||
}
|
||||
|
||||
if (get_sb_hash_code(sb) && code2name(get_sb_hash_code(sb)) == 0) {
|
||||
if (get_sb_hash_code(sb) && code2name(get_sb_hash_code(sb)) == NULL) {
|
||||
fsck_log("rebuild-sb: wrong hash occured (%lu), zeroed\n",
|
||||
get_sb_hash_code(sb));
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ static unsigned long indirect_to_direct(struct reiserfs_path *path, __u64 len,
|
||||
struct buffer_head *bh = PATH_PLAST_BUFFER(path);
|
||||
struct item_head *ih = tp_item_head(path);
|
||||
__u32 unfm_ptr;
|
||||
struct buffer_head *unfm_bh = 0;
|
||||
struct buffer_head *unfm_bh = NULL;
|
||||
struct item_head ins_ih;
|
||||
char *buf;
|
||||
char bad_drct[fs->fs_blocksize];
|
||||
|
||||
Reference in new issue
Block a user