aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2013-08-26 12:33:00 -0400
committerJeff Mahoney <jeffm@suse.com>2013-08-26 19:02:18 -0400
commit20357cf349bb25d1e3e72e62887727811c2496c3 (patch)
tree116344c92888366106e7d91fb44205c8f7c18ac8
parentdd29f49a6c4e241b055175f29e17ee2fe8457fcd (diff)
downloadreiserfsprogs-20357cf349bb25d1e3e72e62887727811c2496c3.tar.gz
reiserfsprogs: Fix sparse "warning: Using plain integer as NULL pointer"
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
-rw-r--r--debugreiserfs/corruption.c24
-rw-r--r--fsck/check_tree.c4
-rw-r--r--fsck/lost+found.c6
-rw-r--r--fsck/main.c42
-rw-r--r--fsck/pass0.c8
-rw-r--r--fsck/pass1.c16
-rw-r--r--fsck/pass2.c6
-rw-r--r--fsck/semantic_check.c14
-rw-r--r--fsck/semantic_rebuild.c18
-rw-r--r--fsck/super.c12
-rw-r--r--fsck/ufile.c2
-rw-r--r--include/reiserfs_lib.h2
-rw-r--r--lib/io.c38
-rw-r--r--lib/misc.c6
-rw-r--r--lib/parse_time.c2
-rw-r--r--mkreiserfs/mkreiserfs.c20
-rw-r--r--reiserfscore/bitmap.c14
-rw-r--r--reiserfscore/do_balan.c8
-rw-r--r--reiserfscore/fix_node.c14
-rw-r--r--reiserfscore/journal.c4
-rw-r--r--reiserfscore/lbalance.c6
-rw-r--r--reiserfscore/node_formats.c8
-rw-r--r--reiserfscore/prints.c6
-rw-r--r--reiserfscore/reiserfslib.c54
-rw-r--r--reiserfscore/stree.c2
-rw-r--r--resize_reiserfs/resize_reiserfs.c4
-rw-r--r--tune/tune.c40
27 files changed, 192 insertions, 188 deletions
diff --git a/debugreiserfs/corruption.c b/debugreiserfs/corruption.c
index 58a586b..d8790e5 100644
--- a/debugreiserfs/corruption.c
+++ b/debugreiserfs/corruption.c
@@ -99,7 +99,7 @@ static void edit_super_block(reiserfs_filsys_t *fs)
size_t n;
int num;
- str = 0;
+ str = NULL;
n = 0;
/* bs_block_count */
@@ -239,7 +239,7 @@ static void corrupt_clobber_hash(char *name, struct item_head *ih,
void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline)
{
struct buffer_head *bh;
- char *line = 0;
+ char *line = NULL;
size_t n = 0;
unsigned long block;
@@ -319,7 +319,7 @@ void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline)
while (getline(&line, &n, stdin) != -1) {
if (line[0] == '\n') {
free(line);
- line = 0;
+ line = NULL;
n = 0;
break;
}
@@ -330,7 +330,7 @@ void do_corrupt_one_block(reiserfs_filsys_t *fs, char *fline)
}
free(line);
- line = 0;
+ line = NULL;
n = 0;
}
}
@@ -772,7 +772,7 @@ void do_leaves_corruption(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
unsigned long nr_leaves = 0;
unsigned int i, should_be_corrupted;
- srand(time(0));
+ srand(time(NULL));
printf("%lu leaves will be corrupted\n", nr_leaves_cr);
if ((data(fs)->log_file_name) && (data(fs)->log)) {
fprintf(data(fs)->log,
@@ -898,7 +898,7 @@ void do_ih_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
unsigned long nr_leaves = 0;
unsigned int should_be_corrupted = 0;
- srand(time(0));
+ srand(time(NULL));
printf("item headers in %lu leaves will be corrupted\n", nr_leaves_cr);
if ((data(fs)->log_file_name) && (data(fs)->log)) {
@@ -1010,7 +1010,7 @@ void do_dir_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
unsigned long nr_leaves = 0;
unsigned int should_be_corrupted = 0;
- srand(time(0));
+ srand(time(NULL));
printf("DIR items in %lu leaves will be corrupted\n", nr_leaves_cr);
if ((data(fs)->log_file_name) && (data(fs)->log)) {
@@ -1095,7 +1095,7 @@ void do_sd_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
unsigned long nr_leaves = 0;
unsigned int should_be_corrupted = 0;
- srand(time(0));
+ srand(time(NULL));
printf("SD items in %lu leaves will be corrupted\n", nr_leaves_cr);
if ((data(fs)->log_file_name) && (data(fs)->log)) {
@@ -1180,7 +1180,7 @@ void do_ind_random_corrupt(reiserfs_filsys_t *fs, unsigned long nr_leaves_cr)
unsigned long nr_leaves = 0;
unsigned int should_be_corrupted = 0;
- srand(time(0));
+ srand(time(NULL));
printf("IND items in %lu leaves will be corrupted\n", nr_leaves_cr);
if ((data(fs)->log_file_name) && (data(fs)->log)) {
@@ -1336,7 +1336,7 @@ void what_to_corrupt(reiserfs_filsys_t *fs, char *corruption_command)
void do_fs_random_corrupt(reiserfs_filsys_t *fs)
{
- char *line = 0;
+ char *line = NULL;
size_t n = 0;
printf("Corrupting fs. Please insert one of the following command\n"
@@ -1352,7 +1352,7 @@ void do_fs_random_corrupt(reiserfs_filsys_t *fs)
while (getline(&line, &n, stdin) != -1) {
if (line[0] == '\n') {
free(line);
- line = 0;
+ line = NULL;
n = 0;
break;
}
@@ -1365,7 +1365,7 @@ void do_fs_random_corrupt(reiserfs_filsys_t *fs)
what_to_corrupt(fs, line);
free(line);
- line = 0;
+ line = NULL;
n = 0;
}
}
diff --git a/fsck/check_tree.c b/fsck/check_tree.c
index 3304f79..8135d79 100644
--- a/fsck/check_tree.c
+++ b/fsck/check_tree.c
@@ -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 */
diff --git a/fsck/lost+found.c b/fsck/lost+found.c
index 830faa4..56efadb 100644
--- a/fsck/lost+found.c
+++ b/fsck/lost+found.c
@@ -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);
diff --git a/fsck/main.c b/fsck/main.c
index ea2152f..092babe 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -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);
diff --git a/fsck/pass0.c b/fsck/pass0.c
index 68ff8c2..cf04581 100644
--- a/fsck/pass0.c
+++ b/fsck/pass0.c
@@ -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"
diff --git a/fsck/pass1.c b/fsck/pass1.c
index ee0076f..b7117de 100644
--- a/fsck/pass1.c
+++ b/fsck/pass1.c
@@ -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);
diff --git a/fsck/pass2.c b/fsck/pass2.c
index db300ac..8c718c2 100644
--- a/fsck/pass2.c
+++ b/fsck/pass2.c
@@ -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));
diff --git a/fsck/semantic_check.c b/fsck/semantic_check.c
index ebd61b8..291d491 100644
--- a/fsck/semantic_check.c
+++ b/fsck/semantic_check.c
@@ -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);
diff --git a/fsck/semantic_rebuild.c b/fsck/semantic_rebuild.c
index d5f4568..f7c2af6 100644
--- a/fsck/semantic_rebuild.c
+++ b/fsck/semantic_rebuild.c
@@ -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);
diff --git a/fsck/super.c b/fsck/super.c
index 39fae80..d1794a0 100644
--- a/fsck/super.c
+++ b/fsck/super.c
@@ -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));
diff --git a/fsck/ufile.c b/fsck/ufile.c
index 68add8a..9053e3a 100644
--- a/fsck/ufile.c
+++ b/fsck/ufile.c
@@ -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];
diff --git a/include/reiserfs_lib.h b/include/reiserfs_lib.h
index 606d076..2f02ec9 100644
--- a/include/reiserfs_lib.h
+++ b/include/reiserfs_lib.h
@@ -280,7 +280,7 @@ typedef int (*check_unfm_func_t) (reiserfs_filsys_t *, __u32);
int is_it_bad_item(reiserfs_filsys_t *, struct item_head *, char *,
check_unfm_func_t, int bad_dir);
-#define hash_func_is_unknown(fs) ((fs)->fs_hash_function == 0)
+#define hash_func_is_unknown(fs) ((fs)->fs_hash_function == NULL)
#define reiserfs_hash(fs) ((fs)->fs_hash_function)
int known_hashes(void);
diff --git a/lib/io.c b/lib/io.c
index 9d319ed..ae11402 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -143,13 +143,13 @@ static void insert_into_hash_queue(struct buffer_head *bh)
static void remove_from_hash_queue(struct buffer_head *bh)
{
- if (bh->b_hash_next == 0 && bh->b_hash_prev == 0
+ if (bh->b_hash_next == NULL && bh->b_hash_prev == NULL
&& bh != g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES])
/* (b_dev == -1) ? */
return;
if (bh == g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES]) {
- if (bh->b_hash_prev != 0)
+ if (bh->b_hash_prev)
die("remove_from_hash_queue: hash queue corrupted");
g_a_hash_queues[bh->b_blocknr % NR_HASH_QUEUES] =
bh->b_hash_next;
@@ -160,18 +160,18 @@ static void remove_from_hash_queue(struct buffer_head *bh)
if (bh->b_hash_prev)
bh->b_hash_prev->b_hash_next = bh->b_hash_next;
- bh->b_hash_prev = bh->b_hash_next = 0;
+ bh->b_hash_prev = bh->b_hash_next = NULL;
}
static void put_buffer_list_end(struct buffer_head **list,
struct buffer_head *bh)
{
- struct buffer_head *last = 0;
+ struct buffer_head *last = NULL;
if (bh->b_prev || bh->b_next)
die("put_buffer_list_end: buffer list corrupted");
- if (*list == 0) {
+ if (*list == NULL) {
bh->b_next = bh;
bh->b_prev = bh;
*list = bh;
@@ -189,7 +189,7 @@ static void remove_from_buffer_list(struct buffer_head **list,
struct buffer_head *bh)
{
if (bh == bh->b_next) {
- *list = 0;
+ *list = NULL;
} else {
bh->b_prev->b_next = bh->b_next;
bh->b_next->b_prev = bh->b_prev;
@@ -197,7 +197,7 @@ static void remove_from_buffer_list(struct buffer_head **list,
*list = bh->b_next;
}
- bh->b_next = bh->b_prev = 0;
+ bh->b_next = bh->b_prev = NULL;
}
static void put_buffer_list_head(struct buffer_head **list,
@@ -255,13 +255,13 @@ static int grow_buffers(int size)
bh = (struct buffer_head *)getmem(GROW_BUFFERS__NEW_BUFERS_PER_CALL *
sizeof(struct buffer_head) +
sizeof(struct buffer_head *));
- if (g_buffer_heads == 0)
+ if (!g_buffer_heads)
g_buffer_heads = bh;
else {
/* link new array to the end of array list */
tmp = g_buffer_heads;
while (*(struct buffer_head **)
- (tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL) != 0)
+ (tmp + GROW_BUFFERS__NEW_BUFERS_PER_CALL) != NULL)
tmp =
*(struct buffer_head **)(tmp +
GROW_BUFFERS__NEW_BUFERS_PER_CALL);
@@ -275,7 +275,7 @@ static int grow_buffers(int size)
tmp = bh + i;
memset(tmp, 0, sizeof(struct buffer_head));
tmp->b_data = getmem(size);
- if (tmp->b_data == 0)
+ if (!tmp->b_data)
die("grow_buffers: no memory for new buffer data");
tmp->b_dev = -1;
tmp->b_size = size;
@@ -313,7 +313,7 @@ static struct buffer_head *get_free_buffer(struct buffer_head **list,
next = *list;
if (!next)
- return 0;
+ return NULL;
for (;;) {
if (!next)
@@ -328,7 +328,7 @@ static struct buffer_head *get_free_buffer(struct buffer_head **list,
if (next == *list)
break;
}
- return 0;
+ return NULL;
}
/* to_write == 0 when all blocks have to be flushed. Otherwise - write only
@@ -441,7 +441,7 @@ struct buffer_head *getblk(int dev, unsigned long block, int size)
void brelse(struct buffer_head *bh)
{
- if (bh == 0)
+ if (!bh)
return;
if (bh->b_count == 0)
@@ -486,7 +486,7 @@ struct buffer_head *bread(int dev, unsigned long block, size_t size)
int ret;
if (is_bad_block(block))
- return 0;
+ return NULL;
bh = getblk(dev, block, size);
@@ -524,7 +524,7 @@ struct buffer_head *bread(int dev, unsigned long block, size_t size)
static struct block_handler *rollback_blocks_array;
static __u32 rollback_blocks_number = 0;
-static FILE *s_rollback_file = 0;
+static FILE *s_rollback_file = NULL;
static FILE *log_file;
static int do_rollback = 0;
@@ -609,7 +609,7 @@ int open_rollback_file(char *rollback_file, FILE * log)
"Specified file (%s) does not look like a rollback file\n",
rollback_file);
fclose(s_rollback_file);
- s_rollback_file = 0;
+ s_rollback_file = NULL;
return -1;
}
@@ -632,7 +632,7 @@ int open_rollback_file(char *rollback_file, FILE * log)
void close_rollback_file()
{
- if (s_rollback_file == 0)
+ if (!s_rollback_file)
return;
if (!do_rollback) {
@@ -641,7 +641,7 @@ void close_rollback_file()
return;
fwrite(&rollback_blocks_number, sizeof(rollback_blocksize), 1,
s_rollback_file);
- if (log_file != 0)
+ if (log_file)
fprintf(log_file, "rollback: %u blocks backed up\n",
rollback_blocks_number);
}
@@ -774,7 +774,7 @@ void do_fsck_rollback(int fd_device, int fd_journal_device, FILE * progress)
}
printf("\n");
- if (log_file != 0)
+ if (log_file)
fprintf(log_file, "rollback: (%u) blocks restored\n",
count_rollbacked);
}
diff --git a/lib/misc.c b/lib/misc.c
index 409a219..f9a1580 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -269,7 +269,7 @@ static int misc_root_mounted(char *device)
static int misc_file_ro(char *file)
{
- if (utime(file, 0) == -1) {
+ if (utime(file, NULL) == -1) {
if (errno == EROFS)
return 1;
}
@@ -584,7 +584,7 @@ __u64 mask64(int from, int count)
__u32 get_random(void)
{
- srandom(time(0));
+ srandom(time(NULL));
return random();
}
@@ -815,7 +815,7 @@ void clean_after_dma_check(int fd, dma_info_t *dma_info)
int user_confirmed(FILE * fp, char *q, char *yes)
{
- char *answer = 0;
+ char *answer = NULL;
size_t n = 0;
fprintf(fp, "%s", q);
diff --git a/lib/parse_time.c b/lib/parse_time.c
index 13acca6..f8e3929 100644
--- a/lib/parse_time.c
+++ b/lib/parse_time.c
@@ -15,7 +15,7 @@ time_t parse_time(char *str)
struct tm ts;
if (strcmp(str, "now") == 0) {
- return (time(0));
+ return (time(NULL));
}
memset(&ts, 0, sizeof(ts));
#ifdef HAVE_STRPTIME
diff --git a/mkreiserfs/mkreiserfs.c b/mkreiserfs/mkreiserfs.c
index 0f9a5ab..dc8400b 100644
--- a/mkreiserfs/mkreiserfs.c
+++ b/mkreiserfs/mkreiserfs.c
@@ -568,17 +568,17 @@ int main(int argc, char **argv)
while (1) {
static struct option options[] = {
- {"block-size", required_argument, 0, 'b'},
- {"journal-device", required_argument, 0, 'j'},
- {"journal-size", required_argument, 0, 's'},
- {"transaction-max-size", required_argument, 0, 't'},
- {"journal-offset", required_argument, 0, 'o'},
- {"badblocks", required_argument, 0, 'B'},
- {"hash", required_argument, 0, 'h'},
- {"uuid", required_argument, 0, 'u'},
- {"label", required_argument, 0, 'l'},
+ {"block-size", required_argument, NULL, 'b'},
+ {"journal-device", required_argument, NULL, 'j'},
+ {"journal-size", required_argument, NULL, 's'},
+ {"transaction-max-size", required_argument, NULL, 't'},
+ {"journal-offset", required_argument, NULL, 'o'},
+ {"badblocks", required_argument, NULL, 'B'},
+ {"hash", required_argument, NULL, 'h'},
+ {"uuid", required_argument, NULL, 'u'},
+ {"label", required_argument, NULL, 'l'},
{"format", required_argument, &flag, 1},
- {0, 0, 0, 0}
+ {}
};
int option_index;
diff --git a/reiserfscore/bitmap.c b/reiserfscore/bitmap.c
index 96c61df..7bb3ab1 100644
--- a/reiserfscore/bitmap.c
+++ b/reiserfscore/bitmap.c
@@ -17,14 +17,14 @@ reiserfs_bitmap_t *reiserfs_create_bitmap(unsigned int bit_count)
bm = getmem(sizeof(*bm));
if (!bm)
- return 0;
+ return NULL;
bm->bm_bit_size = bit_count;
bm->bm_byte_size = ((unsigned long long)bit_count + 7) / 8;
bm->bm_set_bits = 0;
bm->bm_map = getmem(bm->bm_byte_size);
if (!bm->bm_map) {
freemem(bm);
- return 0;
+ return NULL;
}
return bm;
@@ -420,7 +420,7 @@ FILE *open_file(char *filename, char *option)
if (!fp) {
reiserfs_warning(stderr, "open_file: could not open file %s\n",
filename);
- return 0;
+ return NULL;
}
reiserfs_warning(stderr, "Temp file opened by fsck: \"%s\" .. \n",
filename);
@@ -622,7 +622,7 @@ reiserfs_bitmap_t *reiserfs_bitmap_load(FILE * fp)
reiserfs_warning(stderr, "reiserfs_bitmap_load: "
"no bitmap start magic found");
// fclose (fp);
- return 0;
+ return NULL;
}
/* read bit size of bitmap */
@@ -633,7 +633,7 @@ reiserfs_bitmap_t *reiserfs_bitmap_load(FILE * fp)
reiserfs_warning(stderr,
"reiserfs_bitmap_load: creation failed");
// fclose (fp);
- return 0;
+ return NULL;
}
/*printf ("LOAD: bit_size - %d\n", v); */
@@ -665,7 +665,7 @@ reiserfs_bitmap_t *reiserfs_bitmap_load(FILE * fp)
if (v != BITMAP_END_MAGIC) {
reiserfs_warning(stderr, "reiserfs_bitmap_load: "
"no bitmap end magic found");
- return 0;
+ return NULL;
}
/* reiserfs_warning (stderr, "%d bits set - done\n", reiserfs_bitmap_ones (bm)); */
@@ -692,7 +692,7 @@ void reiserfs_free_ondisk_bitmap(reiserfs_filsys_t *fs)
{
if (fs->fs_bitmap2) {
reiserfs_delete_bitmap(fs->fs_bitmap2);
- fs->fs_bitmap2 = 0;
+ fs->fs_bitmap2 = NULL;
}
}
diff --git a/reiserfscore/do_balan.c b/reiserfscore/do_balan.c
index bdb8517..ec69e6b 100644
--- a/reiserfscore/do_balan.c
+++ b/reiserfscore/do_balan.c
@@ -143,9 +143,9 @@ static int balance_leaf_when_delete( /*struct reiserfs_transaction_handle *th, *
return 0;
}
/* all contents of all the 3 buffers will be in R[0] */
- leaf_move_items(LEAF_FROM_S_TO_R, tb, n, -1, 0);
+ leaf_move_items(LEAF_FROM_S_TO_R, tb, n, -1, NULL);
leaf_move_items(LEAF_FROM_L_TO_R, tb,
- B_NR_ITEMS(tb->L[0]), -1, 0);
+ B_NR_ITEMS(tb->L[0]), -1, NULL);
/* right_delimiting_key is correct in R[0] */
replace_key(tb->tb_fs, tb->CFR[0], tb->rkey[0],
@@ -1402,7 +1402,7 @@ struct buffer_head *get_FEB(struct tree_balance *tb)
struct buffer_info bi;
for (i = 0; i < MAX_FEB_SIZE; i++)
- if (tb->FEB[i] != 0)
+ if (tb->FEB[i] != NULL)
break;
if (i == MAX_FEB_SIZE)
@@ -1413,7 +1413,7 @@ struct buffer_head *get_FEB(struct tree_balance *tb)
make_empty_node(&bi);
misc_set_bit(BH_Uptodate, &first_b->b_state);
- tb->FEB[i] = 0;
+ tb->FEB[i] = NULL;
tb->used[i] = first_b;
return (first_b);
diff --git a/reiserfscore/fix_node.c b/reiserfscore/fix_node.c
index f09fe58..c2467ff 100644
--- a/reiserfscore/fix_node.c
+++ b/reiserfscore/fix_node.c
@@ -918,7 +918,7 @@ static struct buffer_head *get_left_neighbor(reiserfs_filsys_t *s,
search_by_key(s, &key, &path_to_left_neighbor, DISK_LEAF_NODE_LEVEL);
if (PATH_LAST_POSITION(&path_to_left_neighbor) == 0) {
pathrelse(&path_to_left_neighbor);
- return 0;
+ return NULL;
}
bh = PATH_PLAST_BUFFER(&path_to_left_neighbor);
bh->b_count++;
@@ -946,7 +946,7 @@ static struct buffer_head *get_right_neighbor(reiserfs_filsys_t *s,
if (PATH_PLAST_BUFFER(&path_to_right_neighbor) ==
PATH_PLAST_BUFFER(path)) {
pathrelse(&path_to_right_neighbor);
- return 0;
+ return NULL;
}
bh = PATH_PLAST_BUFFER(&path_to_right_neighbor);
bh->b_count++;
@@ -963,7 +963,7 @@ int is_left_mergeable(reiserfs_filsys_t *s, struct reiserfs_path *path)
right = item_head(PATH_PLAST_BUFFER(path), 0);
bh = get_left_neighbor(s, path);
- if (bh == 0) {
+ if (bh == NULL) {
return 0;
}
retval =
@@ -984,7 +984,7 @@ int is_right_mergeable(reiserfs_filsys_t *s, struct reiserfs_path *path)
B_NR_ITEMS(PATH_PLAST_BUFFER(path)) - 1);
bh = get_right_neighbor(s, path);
- if (bh == 0) {
+ if (bh == NULL) {
return 0;
}
retval = are_items_mergeable(left, item_head(bh, 0), bh->b_size);
@@ -1221,7 +1221,8 @@ static int get_lfree(struct tree_balance *tb, int h)
struct buffer_head *l, *f;
int order;
- if ((f = PATH_H_PPARENT(tb->tb_path, h)) == 0 || (l = tb->FL[h]) == 0)
+ if ((f = PATH_H_PPARENT(tb->tb_path, h)) == NULL ||
+ (l = tb->FL[h]) == NULL)
return 0;
if (f == l)
@@ -1247,7 +1248,8 @@ static int get_rfree(struct tree_balance *tb, int h)
struct buffer_head *r, *f;
int order;
- if ((f = PATH_H_PPARENT(tb->tb_path, h)) == 0 || (r = tb->FR[h]) == 0)
+ if ((f = PATH_H_PPARENT(tb->tb_path, h)) == NULL ||
+ (r = tb->FR[h]) == NULL)
return 0;
if (f == r)
diff --git a/reiserfscore/journal.c b/reiserfscore/journal.c
index 6acb408..70f9a52 100644
--- a/reiserfscore/journal.c
+++ b/reiserfscore/journal.c
@@ -786,9 +786,9 @@ void reiserfs_free_journal(reiserfs_filsys_t *fs)
if (!reiserfs_journal_opened(fs))
return;
brelse(fs->fs_jh_bh);
- fs->fs_jh_bh = 0;
+ fs->fs_jh_bh = NULL;
free(fs->fs_j_file_name);
- fs->fs_j_file_name = 0;
+ fs->fs_j_file_name = NULL;
}
void reiserfs_close_journal(reiserfs_filsys_t *fs)
diff --git a/reiserfscore/lbalance.c b/reiserfscore/lbalance.c
index c477fa7..afd7f92 100644
--- a/reiserfscore/lbalance.c
+++ b/reiserfscore/lbalance.c
@@ -52,7 +52,7 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi,
get_deh_location(&deh[from + copy_count - 1]);
} else {
copy_records_len = 0;
- records = 0;
+ records = NULL;
}
/* when copy last to first, dest buffer can contain 0 items */
@@ -570,7 +570,7 @@ int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes)
int i;
/* move shift_num (and shift_bytes bytes) items from S[0] to left neighbor L[0] */
- i = leaf_move_items(LEAF_FROM_S_TO_L, tb, shift_num, shift_bytes, 0);
+ i = leaf_move_items(LEAF_FROM_S_TO_L, tb, shift_num, shift_bytes, NULL);
if (shift_num) {
if (B_NR_ITEMS(S0) == 0) {
@@ -597,7 +597,7 @@ int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes)
/* move shift_num (and shift_bytes) items from S[0] to right neighbor R[0] */
ret_value =
- leaf_move_items(LEAF_FROM_S_TO_R, tb, shift_num, shift_bytes, 0);
+ leaf_move_items(LEAF_FROM_S_TO_R, tb, shift_num, shift_bytes, NULL);
/* replace rkey in CFR[0] by the 0-th key from R[0] */
if (shift_num) {
diff --git a/reiserfscore/node_formats.c b/reiserfscore/node_formats.c
index dda3990..213aeda 100644
--- a/reiserfscore/node_formats.c
+++ b/reiserfscore/node_formats.c
@@ -520,7 +520,7 @@ static const struct {
hashf_t func;
char *name;
} hashes[] = { {
-0, "not set"}, {
+NULL, "not set"}, {
keyed_hash, "\"tea\""}, {
yura_hash, "\"rupasov\""}, {
r5_hash, "\"r5\""}};
@@ -563,7 +563,7 @@ int is_properly_hashed(reiserfs_filsys_t *fs,
fprintf(stderr,
"Detecting hash code: could not detect hash with name \"%.*s\"\n",
namelen, name);
- reiserfs_hash(fs) = 0;
+ reiserfs_hash(fs) = NULL;
return 1;
}
@@ -611,7 +611,7 @@ int find_hash_in_use(char *name, int namelen, __u32 offset,
char *code2name(unsigned int code)
{
if (code >= HASH_AMOUNT || code < 0)
- return 0;
+ return NULL;
return hashes[code].name;
}
@@ -645,7 +645,7 @@ hashf_t name2func(char *hash)
for (i = 0; i < HASH_AMOUNT; i++)
if (!strcmp(hash, hashes[i].name))
return hashes[i].func;
- return 0;
+ return NULL;
}
int dir_entry_bad_location(struct reiserfs_de_head *deh, struct item_head *ih,
diff --git a/reiserfscore/prints.c b/reiserfscore/prints.c
index b15fd4d..e579601 100644
--- a/reiserfscore/prints.c
+++ b/reiserfscore/prints.c
@@ -456,7 +456,7 @@ void reiserfs_print_item(FILE * fp, struct buffer_head *bh,
return;
}
- print_directory_item(fp, 0, bh, ih);
+ print_directory_item(fp, NULL, bh, ih);
}
/* this prints internal nodes (4 keys/items in line) (dc_number,
@@ -813,8 +813,8 @@ void print_tb(int mode, int item_pos, int pos_in_item, struct tree_balance *tb,
} else {
/* printk ("print_tb: h=%d, PATH_H_PATH_OFFSET=%d, path_length=%d\n",
h, PATH_H_PATH_OFFSET (tb->tb_path, h), tb->tb_path->path_length); */
- tbSh = 0;
- tbFh = 0;
+ tbSh = NULL;
+ tbFh = NULL;
}
printf
("* %u * %3lu(%2lu) * %3lu(%2lu) * %3lu(%2lu) * %5lu * %5lu * %5lu * %5lu * %5lu *\n",
diff --git a/reiserfscore/reiserfslib.c b/reiserfscore/reiserfslib.c
index cba2b0f..c70ddff 100644
--- a/reiserfscore/reiserfslib.c
+++ b/reiserfscore/reiserfslib.c
@@ -76,7 +76,7 @@ reiserfs_filsys_t *reiserfs_open(const char *filename, int flags,
if (fd == -1) {
if (error)
*error = errno;
- return 0;
+ return NULL;
}
fs = getmem(sizeof(*fs));
@@ -160,7 +160,7 @@ found:
"reiserfs_open: bread failed reading block %d, size %d\n",
i, fs->fs_blocksize);
freemem(fs);
- return 0;
+ return NULL;
}
sb = (struct reiserfs_super_block *)bh->b_data;
}
@@ -199,7 +199,7 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
if (count_blocks(filename, block_size) < block_count) {
reiserfs_warning(stderr,
"reiserfs_create: no enough blocks on device\n");
- return 0;
+ return NULL;
}
if (!is_block_count_correct(REISERFS_DISK_OFFSET_IN_BYTES / block_size,
@@ -207,13 +207,13 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
reiserfs_warning(stderr,
"reiserfs_create: can not create that small "
"(%u blocks) filesystem\n", block_count);
- return 0;
+ return NULL;
}
fs = getmem(sizeof(*fs));
if (!fs) {
reiserfs_warning(stderr, "reiserfs_create: getmem failed\n");
- return 0;
+ return NULL;
}
fs->fs_dev = open(filename, O_RDWR | O_EXCL
@@ -226,7 +226,7 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
"reiserfs_create: could not open %s: %s\n",
filename, strerror(errno));
freemem(fs);
- return 0;
+ return NULL;
}
fs->fs_blocksize = block_size;
@@ -244,7 +244,7 @@ reiserfs_filsys_t *reiserfs_create(char *filename,
if (!fs->fs_super_bh) {
reiserfs_warning(stderr, "reiserfs_create: getblk failed\n");
- return 0;
+ return NULL;
}
mark_buffer_uptodate(fs->fs_super_bh, 1);
@@ -407,12 +407,12 @@ void reiserfs_free(reiserfs_filsys_t *fs)
/* release super block and memory used by filesystem handler */
brelse(fs->fs_super_bh);
- fs->fs_super_bh = 0;
+ fs->fs_super_bh = NULL;
free_buffers();
free(fs->fs_file_name);
- fs->fs_file_name = 0;
+ fs->fs_file_name = NULL;
freemem(fs);
}
@@ -464,7 +464,7 @@ static int reiserfs_search_by_key_x(reiserfs_filsys_t *fs,
curr = PATH_OFFSET_PELEMENT(path, ++path->path_length);
bh = curr->pe_buffer =
bread(fs->fs_dev, block, fs->fs_blocksize);
- if (bh == 0) {
+ if (bh == NULL) {
path->path_length--;
pathrelse(path);
return ITEM_NOT_FOUND;
@@ -553,7 +553,7 @@ int reiserfs_search_by_position(reiserfs_filsys_t *s, struct reiserfs_key *key,
next_key = leaf_key(bh, PATH_LAST_POSITION(path));
else
next_key = uget_rkey(path);
- if (next_key == 0 || not_of_one_file(next_key, key)) {
+ if (next_key == NULL || not_of_one_file(next_key, key)) {
/* there is no any part of such file in the tree */
path->pos_in_item = 0;
return FILE_NOT_FOUND;
@@ -642,7 +642,7 @@ struct reiserfs_key *uget_lkey(struct reiserfs_path *path)
}
/* there is no left delimiting key */
- return 0;
+ return NULL;
}
struct reiserfs_key *uget_rkey(struct reiserfs_path *path)
@@ -679,7 +679,7 @@ struct reiserfs_key *uget_rkey(struct reiserfs_path *path)
}
/* there is no right delimiting key */
- return 0;
+ return NULL;
}
struct reiserfs_key *reiserfs_next_key(struct reiserfs_path *path)
@@ -756,7 +756,8 @@ int reiserfs_search_by_entry_key(reiserfs_filsys_t *fs,
/* next item is in right neighboring node */
struct reiserfs_key *next_key = uget_rkey(path);
- if (next_key == 0 || not_of_one_file(next_key, key)) {
+ if (next_key == NULL ||
+ not_of_one_file(next_key, key)) {
/* there are no items of that directory */
path->pos_in_item = 0;
return DIRECTORY_NOT_FOUND;
@@ -821,22 +822,22 @@ int reiserfs_remove_entry(reiserfs_filsys_t *fs, struct reiserfs_key *key)
if (get_ih_entry_count(ih) == 1) {
init_tb_struct(&tb, fs, &path,
-(IH_SIZE + get_ih_item_len(ih)));
- if (fix_nodes(M_DELETE, &tb, 0) != CARRY_ON) {
+ if (fix_nodes(M_DELETE, &tb, NULL) != CARRY_ON) {
unfix_nodes(&tb);
return 1;
}
- do_balance(&tb, 0, 0, M_DELETE, 0);
+ do_balance(&tb, NULL, NULL, M_DELETE, 0);
return 0;
}
deh = B_I_DEH(get_bh(&path), ih) + path.pos_in_item;
init_tb_struct(&tb, fs, &path,
-(DEH_SIZE + entry_length(ih, deh, path.pos_in_item)));
- if (fix_nodes(M_CUT, &tb, 0) != CARRY_ON) {
+ if (fix_nodes(M_CUT, &tb, NULL) != CARRY_ON) {
unfix_nodes(&tb);
return 1;
}
- do_balance(&tb, 0, 0, M_CUT, 0);
+ do_balance(&tb, NULL, NULL, M_CUT, 0);
return 0;
}
@@ -848,10 +849,10 @@ void reiserfs_paste_into_item(reiserfs_filsys_t *fs,
init_tb_struct(&tb, fs, path, size);
- if (fix_nodes(M_PASTE, &tb, 0 /*ih */ ) != CARRY_ON)
+ if (fix_nodes(M_PASTE, &tb, NULL) != CARRY_ON)
reiserfs_panic("reiserfs_paste_into_item: fix_nodes failed");
- do_balance(&tb, 0, body, M_PASTE, 0 /*zero num */ );
+ do_balance(&tb, NULL, body, M_PASTE, 0 /* zero num */ );
}
void reiserfs_insert_item(reiserfs_filsys_t *fs, struct reiserfs_path *path,
@@ -1081,7 +1082,7 @@ int reiserfs_add_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir,
int item_len;
__u32 hash;
- if (reiserfs_find_entry(fs, dir, name, &gen_counter, 0))
+ if (reiserfs_find_entry(fs, dir, name, &gen_counter, NULL))
/* entry is in the directory already or directory was not found */
return 0;
@@ -1117,7 +1118,7 @@ int reiserfs_add_entry(reiserfs_filsys_t *fs, struct reiserfs_key *dir,
/* fsck may need to insert item which was not reached yet */
set_ih_flags(&entry_ih, fsck_need);
- entry = make_entry(0, name, key, get_offset(&(entry_ih.ih_key)));
+ entry = make_entry(NULL, name, key, get_offset(&(entry_ih.ih_key)));
retval = reiserfs_search_by_entry_key(fs, &(entry_ih.ih_key), &path);
switch (retval) {
@@ -1401,11 +1402,10 @@ static void callback_badblock_rm(reiserfs_filsys_t *fs,
-(IH_SIZE +
get_ih_item_len(tp_item_head(badblock_path))));
- if (fix_nodes(M_DELETE, &tb, 0) != CARRY_ON)
+ if (fix_nodes(M_DELETE, &tb, NULL) != CARRY_ON)
die("%s: fix_nodes failed", __FUNCTION__);
- do_balance( /*tb.transaction_handle, */ &tb, 0, 0, M_DELETE,
- 0 /*zero num */ );
+ do_balance(&tb, NULL, NULL, M_DELETE, 0 /* zero num */);
}
void mark_badblock(reiserfs_filsys_t *fs,
@@ -1490,10 +1490,10 @@ void add_badblock_list(reiserfs_filsys_t *fs, int replace)
init_tb_struct(&tb, fs, &badblock_path, UNFM_P_SIZE);
- if (fix_nodes(M_PASTE, &tb, 0) != CARRY_ON)
+ if (fix_nodes(M_PASTE, &tb, NULL) != CARRY_ON)
die("reiserfsck_paste_into_item: fix_nodes failed");
- do_balance(&tb, 0, (const char *)&ni, M_PASTE, 0);
+ do_balance(&tb, NULL, (const char *)&ni, M_PASTE, 0);
break;
}
diff --git a/reiserfscore/stree.c b/reiserfscore/stree.c
index b0a235f..8b2c013 100644
--- a/reiserfscore/stree.c
+++ b/reiserfscore/stree.c
@@ -372,7 +372,7 @@ int search_by_key(reiserfs_filsys_t *fs, struct reiserfs_key *p_s_key, /* Key to
/* make sure, that the node contents look like a node of
certain level */
if (!is_tree_node(p_s_bh, expected_level)) {
- print_block(stderr, 0, p_s_bh, 3, -1, -1);
+ print_block(stderr, NULL, p_s_bh, 3, -1, -1);
reiserfs_panic("search_by_key: expected level %d",
expected_level);
}
diff --git a/resize_reiserfs/resize_reiserfs.c b/resize_reiserfs/resize_reiserfs.c
index 58ba49c..09a5b10 100644
--- a/resize_reiserfs/resize_reiserfs.c
+++ b/resize_reiserfs/resize_reiserfs.c
@@ -249,7 +249,7 @@ int main(int argc, char *argv[])
devname = argv[optind];
- fs = reiserfs_open(devname, O_RDONLY, &error, 0, 1);
+ fs = reiserfs_open(devname, O_RDONLY, &error, NULL, 1);
if (!fs) {
if (error) {
reiserfs_exit(1, "cannot open '%s': %s",
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
reiserfs_exit(1, "the file system isn't in valid state.");
/* Needed to keep idiot compiler from issuing false warning */
- sb_old = 0;
+ sb_old = NULL;
/* save SB for reporting */
if (opt_verbose) {
diff --git a/tune/tune.c b/tune/tune.c
index a22cbc0..7a9b0e7 100644
--- a/tune/tune.c
+++ b/tune/tune.c
@@ -409,36 +409,36 @@ int main(int argc, char **argv)
if (argc < 2)
print_usage_and_exit();
- device_name = 0;
- jdevice_name = 0;
- j_new_device_name = 0;
+ device_name = NULL;
+ jdevice_name = NULL;
+ j_new_device_name = NULL;
memset(UUID, 0, 16);
while (1) {
static struct option options[] = {
- {"help", no_argument, 0, 'h'},
- {"journal-device", required_argument, 0, 'j'},
+ {"help", no_argument, NULL, 'h'},
+ {"journal-device", required_argument, NULL, 'j'},
{"journal-new-device", required_argument, &flag,
OPT_NEW_J},
- {"journal-new-size", required_argument, 0, 's'},
- {"trans-max-size", required_argument, 0, 't'},
- {"journal-new-offset", required_argument, 0, 'o'},
+ {"journal-new-size", required_argument, NULL, 's'},
+ {"trans-max-size", required_argument, NULL, 't'},
+ {"journal-new-offset", required_argument, NULL, 'o'},
{"no-journal-available", no_argument, &flag,
OPT_SKIP_J},
- /*{"keep-old-journal-param", no_argument, 0, 'p'}, */
- {"uuid", required_argument, 0, 'u'},
- {"label", required_argument, 0, 'l'},
- {"add-badblocks", required_argument, 0, 'b'},
- {"badblocks", required_argument, 0, 'B'},
- {"force", no_argument, 0, 'f'},
+ /*{"keep-old-journal-param", no_argument, NULL, 'p'}, */
+ {"uuid", required_argument, NULL, 'u'},
+ {"label", required_argument, NULL, 'l'},
+ {"add-badblocks", required_argument, NULL, 'b'},
+ {"badblocks", required_argument, NULL, 'B'},
+ {"force", no_argument, NULL, 'f'},
{"make-journal-standard", no_argument, &flag,
OPT_STANDARD},
- {"check-interval", required_argument, 0, 'c'},
- {"time-last-checked", required_argument, 0, 'C'},
- {"max-mount-count", required_argument, 0, 'm'},
- {"mount-count", required_argument, 0, 'M'},
- {0, 0, 0, 0}
+ {"check-interval", required_argument, NULL, 'c'},
+ {"time-last-checked", required_argument, NULL, 'C'},
+ {"max-mount-count", required_argument, NULL, 'm'},
+ {"mount-count", required_argument, NULL, 'M'},
+ {}
};
int option_index;
@@ -560,7 +560,7 @@ int main(int argc, char **argv)
/* device to be formatted */
device_name = argv[optind];
- fs = reiserfs_open(device_name, O_RDONLY, 0, NULL, 1);
+ fs = reiserfs_open(device_name, O_RDONLY, NULL, NULL, 1);
if (no_reiserfs_found(fs)) {
message("Cannot open reiserfs on %s", device_name);
return 1;