nilfs-utils: do not initialize static or global variables to 0 or NULL

Fix the following checkpatch errors:

 ERROR: do not initialise statics to 0 or NULL
 #92: FILE: lscp.c:92:
 +static int show_all = 0;

 ERROR: do not initialise statics to 0 or NULL
 #82: FILE: rmcp.c:82:
 +static int force = 0;

 ERROR: do not initialise statics to 0 or NULL
 #83: FILE: rmcp.c:83:
 +static int interactive = 0;

 ERROR: do not initialise statics to 0 or NULL
 #108: FILE: mkfs/mkfs.c:108:
 +static int quiet = 0;

 ERROR: do not initialise statics to 0 or NULL
 #109: FILE: mkfs/mkfs.c:109:
 +static int cflag = 0;

 ERROR: do not initialise statics to 0 or NULL
 #110: FILE: mkfs/mkfs.c:110:
 +static int nflag = 0;

 ERROR: do not initialise statics to 0 or NULL
 #111: FILE: mkfs/mkfs.c:111:
 +static int verbose = 0;

 ERROR: do not initialise statics to 0 or NULL
 #113: FILE: mkfs/mkfs.c:113:
 +static int force_overwrite = 0;

 ERROR: do not initialise statics to 0 or NULL
 #118: FILE: mkfs/mkfs.c:118:
 +static time_t creation_time = 0;

 ERROR: do not initialise statics to 0 or NULL
 #236: FILE: mkfs/mkfs.c:236:
 +static void **disk_buffer = NULL;

 ERROR: do not initialise statics to 0 or NULL
 #54: FILE: mount/fstab.c:54:
 +static int have_mtab_info = 0;

 ERROR: do not initialise statics to 0 or NULL
 #55: FILE: mount/fstab.c:55:
 +static int var_mtab_does_not_exist = 0;

 ERROR: do not initialise statics to 0 or NULL
 #56: FILE: mount/fstab.c:56:
 +static int var_mtab_is_a_symlink = 0;

 ERROR: do not initialise statics to 0 or NULL
 #108: FILE: mount/fstab.c:108:
 +static int got_mtab = 0;

 ERROR: do not initialise statics to 0 or NULL
 #109: FILE: mount/fstab.c:109:
 +static int got_fstab = 0;

 ERROR: do not initialise statics to 0 or NULL
 #327: FILE: mount/fstab.c:327:
 +static int we_created_lockfile = 0;

 ERROR: do not initialise statics to 0 or NULL
 #331: FILE: mount/fstab.c:331:
 +static int signals_have_been_setup = 0;

 ERROR: do not initialise globals to 0 or NULL
 #97: FILE: mount/mount.nilfs2.c:97:
 +int verbose = 0;

 ERROR: do not initialise globals to 0 or NULL
 #98: FILE: mount/mount.nilfs2.c:98:
 +int mount_quiet = 0;

 ERROR: do not initialise globals to 0 or NULL
 #99: FILE: mount/mount.nilfs2.c:99:
 +int readonly = 0;

 ERROR: do not initialise globals to 0 or NULL
 #100: FILE: mount/mount.nilfs2.c💯
 +int readwrite = 0;

 ERROR: do not initialise statics to 0 or NULL
 #101: FILE: mount/mount.nilfs2.c:101:
 +static int nomtab = 0;

 ERROR: do not initialise statics to 0 or NULL
 #102: FILE: mount/mount.nilfs2.c:102:
 +static int devro = 0;

 ERROR: do not initialise statics to 0 or NULL
 #103: FILE: mount/mount.nilfs2.c:103:
 +static int fake = 0;

 ERROR: do not initialise globals to 0 or NULL
 #90: FILE: mount/mount_libmount.c:90:
 +int mount_quiet = 0;   /* for sundries.c */

 ERROR: do not initialise statics to 0 or NULL
 #91: FILE: mount/mount_libmount.c:91:
 +static int verbose = 0;

 ERROR: do not initialise statics to 0 or NULL
 #92: FILE: mount/mount_libmount.c:92:
 +static int devro = 0;

 ERROR: do not initialise statics to 0 or NULL
 #94: FILE: mount/mount_libmount.c:94:
 +static char *mount_fstype = NULL;

 ERROR: do not initialise globals to 0 or NULL
 #98: FILE: mount/umount.nilfs2.c:98:
 +int verbose = 0;

 ERROR: do not initialise globals to 0 or NULL
 #99: FILE: mount/umount.nilfs2.c:99:
 +int mount_quiet = 0;

 ERROR: do not initialise globals to 0 or NULL
 #100: FILE: mount/umount.nilfs2.c💯
 +int readonly = 0;

 ERROR: do not initialise globals to 0 or NULL
 #101: FILE: mount/umount.nilfs2.c:101:
 +int readwrite = 0;

 ERROR: do not initialise statics to 0 or NULL
 #102: FILE: mount/umount.nilfs2.c:102:
 +static int nomtab = 0;

 ERROR: do not initialise globals to 0 or NULL
 #82: FILE: mount/umount_libmount.c:82:
 +int mount_quiet = 0;   /* for sundries.c */

 ERROR: do not initialise statics to 0 or NULL
 #83: FILE: mount/umount_libmount.c:83:
 +static int verbose = 0;

 ERROR: do not initialise statics to 0 or NULL
 #84: FILE: mount/umount_libmount.c:84:
 +static int force = 0;

 ERROR: do not initialise statics to 0 or NULL
 #85: FILE: mount/umount_libmount.c:85:
 +static int suid = 0;   /* reserved for non-root user mount/umount

 ERROR: do not initialise statics to 0 or NULL
 #125: FILE: nilfs-clean/nilfs-clean.c:125:
 +static int show_version_only = 0;

 ERROR: do not initialise statics to 0 or NULL
 #126: FILE: nilfs-clean/nilfs-clean.c:126:
 +static int verbose = 0;

 ERROR: do not initialise statics to 0 or NULL
 #128: FILE: nilfs-clean/nilfs-clean.c:128:
 +static const char *conffile = NULL;

 ERROR: do not initialise statics to 0 or NULL
 #105: FILE: nilfs-resize/nilfs-resize.c:105:
 +static int show_version_only = 0;

 ERROR: do not initialise statics to 0 or NULL
 #106: FILE: nilfs-resize/nilfs-resize.c:106:
 +static int verbose = 0;

 ERROR: do not initialise statics to 0 or NULL
 #107: FILE: nilfs-resize/nilfs-resize.c:107:
 +static int assume_yes = 0;

 ERROR: do not initialise statics to 0 or NULL
 #143: FILE: nilfs-resize/nilfs-resize.c:143:
 +static int pm_in_progress = 0;  /* 0: off, 1: on, -1: interrupted */

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
This commit is contained in:
Ryusuke Konishi 2014-02-14 00:16:40 +09:00
parent 05f16aeb77
commit e131a9ebe5
10 changed files with 45 additions and 45 deletions

View File

@ -89,7 +89,7 @@ static __u64 param_index;
static __u64 param_lines;
static struct nilfs_cpinfo cpinfos[LSCP_NCPINFO];
static int show_block_count = 1;
static int show_all = 0;
static int show_all;
static void lscp_print_header(void)
{

View File

@ -79,8 +79,8 @@ static const struct option long_options[] = {
static char *progname;
static int force = 0;
static int interactive = 0;
static int force;
static int interactive;
static int rmcp_confirm(const char *arg)
{

View File

@ -105,18 +105,18 @@ extern int optind;
char *progname = "mkfs.nilfs2";
/* Options */
static int quiet = 0;
static int cflag = 0;
static int nflag = 0;
static int verbose = 0;
static int quiet;
static int cflag;
static int nflag;
static int verbose;
static int discard = 1;
static int force_overwrite = 0;
static int force_overwrite;
static unsigned long blocksize = NILFS_DEF_BLOCKSIZE;
static unsigned long blocks_per_segment = NILFS_DEF_BLKS_PER_SEG;
static unsigned long r_segments_percentage = NILFS_DEF_RESERVED_SEGMENTS;
static time_t creation_time = 0;
static char volume_label[80] = {0};
static time_t creation_time;
static char volume_label[80];
static __u64 compat_array[NILFS_MAX_FEATURE_TYPES] = {
/* Compat */
0,
@ -233,7 +233,7 @@ segment_start_blocknr(struct nilfs_disk_info *di, unsigned long segnum)
/*
* I/O primitives
*/
static void **disk_buffer = NULL;
static void **disk_buffer;
static unsigned long disk_buffer_size;
static void init_disk_buffer(long max_blocks);

View File

@ -51,9 +51,9 @@
extern int verbose;
/* Information about mtab. ------------------------------------*/
static int have_mtab_info = 0;
static int var_mtab_does_not_exist = 0;
static int var_mtab_is_a_symlink = 0;
static int have_mtab_info;
static int var_mtab_does_not_exist;
static int var_mtab_is_a_symlink;
static void
get_mtab_info(void) {
@ -105,8 +105,8 @@ mtab_is_writable() {
/* Contents of mtab and fstab ---------------------------------*/
struct mntentchn mounttable, fstab;
static int got_mtab = 0;
static int got_fstab = 0;
static int got_mtab;
static int got_fstab;
static void read_mounttable(void), read_fstab(void);
@ -324,11 +324,11 @@ getmntoptfile (const char *file) {
/* Updating mtab ----------------------------------------------*/
/* Flag for already existing lock file. */
static int we_created_lockfile = 0;
static int we_created_lockfile;
static int lockfile_fd = -1;
/* Flag to indicate that signals have been set up. */
static int signals_have_been_setup = 0;
static int signals_have_been_setup;
/* Ensure that the lock is released if we are interrupted. */
extern char *strsignal(int sig); /* not always in <string.h> */

View File

@ -94,13 +94,13 @@
#include "nls.h"
/* mount options */
int verbose = 0;
int mount_quiet = 0;
int readonly = 0;
int readwrite = 0;
static int nomtab = 0;
static int devro = 0;
static int fake = 0;
int verbose;
int mount_quiet;
int readonly;
int readwrite;
static int nomtab;
static int devro;
static int fake;
/* global variables */
extern char *optarg;

View File

@ -87,11 +87,11 @@
#endif /* _GNU_SOURCE */
/* mount options */
int mount_quiet = 0; /* for sundries.c */
static int verbose = 0;
static int devro = 0;
int mount_quiet; /* for sundries.c */
static int verbose;
static int devro;
static char *mount_fstype = NULL;
static char *mount_fstype;
/* global variables */
const char fstype[] = NILFS2_FS_NAME;

View File

@ -95,11 +95,11 @@
#include "nls.h"
int verbose = 0;
int mount_quiet = 0;
int readonly = 0;
int readwrite = 0;
static int nomtab = 0;
int verbose;
int mount_quiet;
int readonly;
int readwrite;
static int nomtab;
extern char *optarg;
extern int optind;

View File

@ -79,10 +79,10 @@
#endif /* _GNU_SOURCE */
/* options */
int mount_quiet = 0; /* for sundries.c */
static int verbose = 0;
static int force = 0;
static int suid = 0; /* reserved for non-root user mount/umount
int mount_quiet; /* for sundries.c */
static int verbose;
static int force;
static int suid; /* reserved for non-root user mount/umount
(not supported yet) */
/* global variables */

View File

@ -122,10 +122,10 @@ enum {
/* options */
static char *progname;
static int show_version_only = 0;
static int verbose = 0;
static int show_version_only;
static int verbose;
static int clean_cmd = NILFS_CLEAN_CMD_RUN;
static const char *conffile = NULL;
static const char *conffile;
static unsigned long protection_period = ULONG_MAX;
static int nsegments_per_clean = 2;

View File

@ -102,9 +102,9 @@ static const struct option long_option[] = {
/* options */
static char *progname;
static int show_version_only = 0;
static int verbose = 0;
static int assume_yes = 0;
static int show_version_only;
static int verbose;
static int assume_yes;
static int show_progress = 1;
/* global variables */
@ -140,7 +140,7 @@ static int pm_labelwidth = 10;
static __u64 pm_max;
static __u64 pm_done;
static int pm_curpos;
static int pm_in_progress = 0; /* 0: off, 1: on, -1: interrupted */
static int pm_in_progress; /* 0: off, 1: on, -1: interrupted */
static const char *pm_label;
static void nilfs_resize_logger(int priority, const char *fmt, ...)