lssu: display a "p" flag on protected segments

Display a "p" flag in STAT field of the output lines of protected
segments when -l (--latest-usage) option is specfied.  This flag
clarifies which segments are protected by garbage collection at that
moment.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: move utility definitions into util.h

Gather up definitions of utility macros such as min_t(), max_t(),
DIV_ROUND_UP(), ARRAY_SIZE(), nilfs_cnt64_ge(), etc, into
include/util.h to make them reusable.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: use min_t() and max_t()

Simplify some calculations in lssu, lscp, lib/gc.c, lib/nilfs.c,
lib/cnoconv.c, and cleanerd with min_t() and max_t().

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: fix order of storage class specifiers

Fix the following checkpatch warnings:

 WARNING: storage class should be at the beginning of the declaration
 #54: FILE: dumpseg.c:54:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #57: FILE: lscp.c:57:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #61: FILE: lssu.c:61:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #100: FILE: lssu.c:100:
 +const static struct lssu_format lssu_format[] = {

 WARNING: storage class should be at the beginning of the declaration
 #53: FILE: mkcp.c:53:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #57: FILE: rmcp.c:57:
 +const static struct option long_options[] = {

 WARNING: storage class should be at the beginning of the declaration
 #85: FILE: nilfs-tune/nilfs-tune.c:85:
 +const static __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {

 WARNING: storage class should be at the beginning of the declaration
 #94: FILE: nilfs-tune/nilfs-tune.c:94:
 +const static __u64 clear_ok_features[NILFS_MAX_FEATURE_TYPES] = {

 WARNING: storage class should be at the beginning of the declaration
 #96: FILE: cleanerd/cleanerd.c:96:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #1060: FILE: mkfs/mkfs.c:1060:
 +const static __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {

 WARNING: storage class should be at the beginning of the declaration
 #70: FILE: nilfs-clean/nilfs-clean.c:70:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #72: FILE: nilfs-resize/nilfs-resize.c:72:
 +const static struct option long_option[] = {

 WARNING: storage class should be at the beginning of the declaration
 #144: FILE: nilfs-resize/nilfs-resize.c:144:
 +const static char *pm_label;

 WARNING: storage class should be at the beginning of the declaration
 #707: FILE: nilfs-resize/nilfs-resize.c:707:
 +       const static struct timespec retry_interval = { 0, 500000000 };

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: insert backslash between lines splitting quoted string

Fix the following checkpatch warnings:

 WARNING: quoted string split across lines
 #97: FILE: lscp.c:97:
 +       printf("                 CNO        DATE     TIME  MODE  FLG     %s"
 +              "       ICNT\n",

 WARNING: quoted string split across lines
 #257: FILE: cleaner_ctl.c:257:
 +                                    _("Error: no valid nilfs mountpoint "
 +                                      "found."));

 WARNING: quoted string split across lines
 #308: FILE: cleaner_ctl.c:308:
 +                                    _("Error: cannot create receive queue: "
 +                                      "%s."),

 WARNING: quoted string split across lines
 #338: FILE: cleaner_ctl.c:338:
 +                                            _("Error: cannot open cleaner on "
 +                                              "%s: %s."),

 WARNING: quoted string split across lines
 #290: FILE: cleaner_exec.c:290:
 +       nilfs_cleaner_printf(_("cleanerd (pid=%ld) still exists on %d. "
 +                              "waiting."),

 WARNING: quoted string split across lines
 #380: FILE: cleanerd/cleanerd.c:380:
 +               syslog(LOG_ERR, "failed to create checkpoint number converter "
 +                      ": %m");

 WARNING: quoted string split across lines
 #1397: FILE: cleanerd/cleanerd.c:1397:
 +               syslog(LOG_ERR, "cannot convert protection time to checkpoint "
 +                      "number: %m");

 WARNING: quoted string split across lines
 #730: FILE: mkfs/mkfs.c:730:
 +                       perr("Error: %s is currently mounted. "
 +                            "You cannot make a filesystem on this device.",

 WARNING: quoted string split across lines
 #772: FILE: mkfs/mkfs.c:772:
 +                               pinfo("WARNING: Device %s appears to contain "
 +                                       "an existing %s superblock.",

 WARNING: quoted string split across lines
 #777: FILE: mkfs/mkfs.c:777:
 +                               pinfo("WARNING: Device %s appears to contain "
 +                                       "an partition table (%s).",

 WARNING: quoted string split across lines
 #782: FILE: mkfs/mkfs.c:782:
 +                                       pinfo("Device %s appears to contain "
 +                                               "something weird.", device);

 WARNING: quoted string split across lines
 #860: FILE: mkfs/mkfs.c:860:
 +               perr("Internal error: illegal disk buffer access "
 +                    "(blocknr=%llu)", blocknr);

 WARNING: quoted string split across lines
 #946: FILE: mkfs/mkfs.c:946:
 +                               pinfo("Discard succeeded and will return 0s "
 +                                     " - skip wiping");

 WARNING: quoted string split across lines
 #206: FILE: mount/fstab.c:206:
 +                       printf (_("mount: could not open %s - "
 +                                 "using %s instead\n"),

 WARNING: quoted string split across lines
 #434: FILE: mount/fstab.c:434:
 +               die (EX_FILEIO, _("can't create lock file %s: %s "
 +                                                 "(use -n flag to override)"),

 WARNING: quoted string split across lines
 #460: FILE: mount/fstab.c:460:
 +                       die (EX_FILEIO, _("can't link lock file %s: %s "
 +                            "(use -n flag to override)"),

 WARNING: quoted string split across lines
 #476: FILE: mount/fstab.c:476:
 +                       die (EX_FILEIO, _("can't open lock file %s: %s "
 +                            "(use -n flag to override)"),

 WARNING: quoted string split across lines
 #430: FILE: mount/mount.nilfs2.c:430:
 +               error(_("%s: the device already has a rw-mount on %s."
 +                       "\n\t\tmultiple rw-mount is not allowed."),

 WARNING: quoted string split across lines
 #446: FILE: mount/mount.nilfs2.c:446:
 +                       error(_("%s: remount failed due to %s shutdown "
 +                               "failure"), progname, NILFS_CLEANERD_NAME);

 WARNING: quoted string split across lines
 #301: FILE: mount/mount_libmount.c:301:
 +               error(_("%s: the device already has a rw-mount on %s."
 +                       "\n\t\tmultiple rw-mount is not allowed."),

 WARNING: quoted string split across lines
 #324: FILE: mount/mount_libmount.c:324:
 +                       error(_("%s: different mount point (%s). "
 +                               "remount failed."),

 WARNING: quoted string split across lines
 #334: FILE: mount/mount_libmount.c:334:
 +                               error(_("%s: remount failed due to %s "
 +                                       "shutdown failure"), progname,

 WARNING: quoted string split across lines
 #182: FILE: mount/mount_mntent.c:182:
 +                               fprintf(stderr, _("[mntent]: warning: no final "
 +                                       "newline at the end of %s\n"),

 WARNING: quoted string split across lines
 #466: FILE: nilfs-clean/nilfs-clean.c:466:
 +                               myprintf(_("Error: invalid protection period: "
 +                                          "%s\n"), optarg);

 WARNING: quoted string split across lines
 #353: FILE: nilfs-resize/nilfs-resize.c:353:
 +               myprintf("Error: the filesystem does not have enough free "
 +                        "space.\n"

 WARNING: quoted string split across lines
 #362: FILE: nilfs-resize/nilfs-resize.c:362:
 +               myprintf("%llu free segments (%llu bytes) will be left "
 +                        "after shrinkage.\n", nsegs, nbytes);

 WARNING: quoted string split across lines
 #393: FILE: nilfs-resize/nilfs-resize.c:393:
 +                       myprintf("Error: operation failed during searching "
 +                                "movable segments: %s\n", strerror(errno));

 WARNING: quoted string split across lines
 #430: FILE: nilfs-resize/nilfs-resize.c:430:
 +                       myprintf("Error: operation failed during searching "
 +                                "latest segment: %s\n", strerror(errno));

 WARNING: quoted string split across lines
 #468: FILE: nilfs-resize/nilfs-resize.c:468:
 +                       myprintf("Error: operation failed during searching "
 +                                "active segments: %s\n", strerror(errno));

 WARNING: quoted string split across lines
 #499: FILE: nilfs-resize/nilfs-resize.c:499:
 +                       myprintf("Error: operation failed during searching "
 +                                "in-use segments: %s\n", strerror(errno));

 WARNING: quoted string split across lines
 #529: FILE: nilfs-resize/nilfs-resize.c:529:
 +                       myprintf("Error: operation failed during counting "
 +                                "in-use segments: %s\n", strerror(errno));

 WARNING: quoted string split across lines
 #725: FILE: nilfs-resize/nilfs-resize.c:725:
 +                       myprintf("Error: Failed to move active segments -- "
 +                                "give up.\n");

 WARNING: quoted string split across lines
 #752: FILE: nilfs-resize/nilfs-resize.c:752:
 +               myprintf("Error: Confused. Number of segments became larger "
 +                        "than requested size.\n");

 WARNING: quoted string split across lines
 #798: FILE: nilfs-resize/nilfs-resize.c:798:
 +                       myprintf("Error: operation failed during moving "
 +                                "in-use segments: %s\n", strerror(errno));

 WARNING: quoted string split across lines
 #866: FILE: nilfs-resize/nilfs-resize.c:866:
 +               myprintf("%llu segments will be truncated from "
 +                        "segnum %llu.\n",

 WARNING: quoted string split across lines
 #873: FILE: nilfs-resize/nilfs-resize.c:873:
 +               myprintf("Error: Confused. Number of segments "
 +                        "became larger than requested size:\n"

 WARNING: quoted string split across lines
 #888: FILE: nilfs-resize/nilfs-resize.c:888:
 +                       myprintf("       This kernel does not support the "
 +                                "set allocation range API.\n");

 WARNING: quoted string split across lines
 #940: FILE: nilfs-resize/nilfs-resize.c:940:
 +                       myprintf("In-use segment found again. "
 +                                "will retry moving them.. (retry = %d)\n",

 WARNING: quoted string split across lines
 #1175: FILE: nilfs-resize/nilfs-resize.c:1175:
 +                       myprintf("Error: size larger than partition "
 +                                "size (%llu bytes).\n", devsize);

 WARNING: quoted string split across lines
 #1190: FILE: nilfs-resize/nilfs-resize.c:1190:
 +                       myprintf("size %llu is not alinged to sector "
 +                                "size. truncated to %llu.\n",

 WARNING: quoted string split across lines
 #1201: FILE: nilfs-resize/nilfs-resize.c:1201:
 +               myprintf("Error: %s is not currently mounted. Offline resising"
 +                        "\n"

 WARNING: quoted string split across lines
 #288: FILE: nilfs-tune/nilfs-tune.c:288:
 +       sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
 +               "%02x%02x-%02x%02x%02x%02x%02x%02x", uuid[0], uuid[1],

 WARNING: quoted string split across lines
 #527: FILE: nilfs-tune/nilfs-tune.c:527:
 +               fprintf(stderr, "Warning: %s: unknown incompatible "
 +                       "features: 0x%llx\n", device, features);

 WARNING: quoted string split across lines
 #533: FILE: nilfs-tune/nilfs-tune.c:533:
 +               fprintf(stderr, "Warning: %s: unknown read-only compatible "
 +                       "features: 0x%llx\n", device, features);

 WARNING: quoted string split across lines
 #591: FILE: nilfs-tune/nilfs-tune.c:591:
 +               fprintf(stderr, "ERROR: %s is currently mounted.  "
 +                       "Aborting execution.\n"

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: do not indent labels

Fix the following checkpatch warnings:

 WARNING: labels should not be indented
 #218: FILE: lssu.c:218:
 +               skip_scan:

 WARNING: labels should not be indented
 #1565: FILE: cleanerd/cleanerd.c:1565:
 +       sleep:

 WARNING: labels should not be indented
 #58: FILE: mount/mount_mntent.c:58:
 +       next:

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: remove unnecessary whitespace before quoted newlines

Fix the following checkpatch warnings:

 WARNING: unnecessary whitespace before a quoted newline
 #1166: FILE: mkfs/mkfs.c:1166:
 +               "Usage: %s [-b block-size] [-B blocks-per-segment] [-c] [-f] \n"

 WARNING: unnecessary whitespace before a quoted newline
 #1167: FILE: mkfs/mkfs.c:1167:
 +               "       [-L volume-label] [-m reserved-segments-percentage] \n"

 WARNING: unnecessary whitespace before a quoted newline
 #1168: FILE: mkfs/mkfs.c:1168:
 +               "       [-O feature[,...]] \n"

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
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:100:
 +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:100:
 +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>
nilfs-utils: remove unnecessary parentheses from return statements

Fix the following checkpatch errors:

 ERROR: return is not a function, parentheses are not required
 #84: FILE: nilfs.c:84:
 +       return (c == '\n' || c == '\0');

 ERROR: return is not a function, parentheses are not required
 #50: FILE: mkfs/bitops.c:50:
 +       return (mask & *ADDR);

 ERROR: return is not a function, parentheses are not required
 #222: FILE: mkfs/mkfs.c:222:
 +       return (di->blocks_per_segment *

 ERROR: return is not a function, parentheses are not required
 #66: FILE: mount/mount_mntent.c:66:
 +       return (c == ' ' || c == '\t');

 ERROR: return is not a function, parentheses are not required
 #408: FILE: nilfs-resize/nilfs-resize.c:408:
 +       return (snp - segnumv); /* return the number of found segments */

 ERROR: return is not a function, parentheses are not required
 #479: FILE: nilfs-resize/nilfs-resize.c:479:
 +       return (snp - segnumv); /* return the number of found segments */

 ERROR: return is not a function, parentheses are not required
 #509: FILE: nilfs-resize/nilfs-resize.c:509:
 +       return (snp - segnumv); /* return the number of found segments */

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: remove spaces between function name and open parenthesis

Fix the following checkpatch warnings and errors:

 WARNING: space prohibited between function name and open parenthesis '('
 #23: FILE: nls.h:23:
 +# define _(Text) gettext (Text)

 ERROR: Macros with complex values should be enclosed in parenthesis
 #23: FILE: nls.h:23:
 +# define _(Text) gettext (Text)

 WARNING: space prohibited between function name and open parenthesis '('
 #25: FILE: nls.h:25:
 +#  define N_(String) gettext_noop (String)

 ERROR: Macros with complex values should be enclosed in parenthesis
 #25: FILE: nls.h:25:
 +#  define N_(String) gettext_noop (String)

 WARNING: space prohibited between function name and open parenthesis '('
 #49: FILE: mount/fstab.c:49:
 +#define streq(s, t)    (strcmp ((s), (t)) == 0)

 WARNING: externs should be avoided in .c files
 #51: FILE: mount/fstab.c:51:
 +extern int verbose;

 WARNING: space prohibited between function name and open parenthesis '('
 #173: FILE: mount/fstab.c:173:
 +                     fnam, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #194: FILE: mount/fstab.c:194:
 +       mfp = my_setmntent (fnam, "r");

 WARNING: space prohibited between function name and open parenthesis '('
 #198: FILE: mount/fstab.c:198:
 +               mfp = my_setmntent (fnam, "r");

 WARNING: space prohibited between function name and open parenthesis '('
 #201: FILE: mount/fstab.c:201:
 +                             _PATH_MOUNTED, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #205: FILE: mount/fstab.c:205:
 +                       printf (_("mount: could not open %s - " \

 WARNING: space prohibited between function name and open parenthesis '('
 #222: FILE: mount/fstab.c:222:
 +       mfp = my_setmntent (fnam, "r");

 WARNING: space prohibited between function name and open parenthesis '('
 #226: FILE: mount/fstab.c:226:
 +                     _PATH_MNTTAB, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #235: FILE: mount/fstab.c:235:
 +getmntfile (const char *name) {

 WARNING: space prohibited between function name and open parenthesis '('
 #251: FILE: mount/fstab.c:251:
 +getmntdirbackward (const char *name, struct mntentchn *mcprev) {

 WARNING: space prohibited between function name and open parenthesis '('
 #268: FILE: mount/fstab.c:268:
 +getmntdevbackward (const char *name, struct mntentchn *mcprev) {

 WARNING: space prohibited between function name and open parenthesis '('
 #298: FILE: mount/fstab.c:298:
 +getmntoptfile (const char *file) {

 WARNING: space prohibited between function name and open parenthesis '('
 #337: FILE: mount/fstab.c:337:
 +handler (int sig) {

 WARNING: space prohibited between function name and open parenthesis '('
 #342: FILE: mount/fstab.c:342:
 +setlkw_timeout (int sig) {

 WARNING: space prohibited between function name and open parenthesis '('
 #348: FILE: mount/fstab.c:348:
 +unlock_mtab (void) {

 WARNING: space prohibited between function name and open parenthesis '('
 #352: FILE: mount/fstab.c:352:
 +               unlink (_PATH_MOUNTED_LOCK);

 WARNING: space prohibited between function name and open parenthesis '('
 #399: FILE: mount/fstab.c:399:
 +lock_mtab (void) {

 WARNING: space prohibited between function name and open parenthesis '('
 #411: FILE: mount/fstab.c:411:
 +               sigfillset (&sa.sa_mask);

 WARNING: space prohibited between function name and open parenthesis '('
 #413: FILE: mount/fstab.c:413:
 +               while (sigismember (&sa.sa_mask, ++sig) != -1

 WARNING: space prohibited between function name and open parenthesis '('
 #419: FILE: mount/fstab.c:419:
 +                       sigaction (sig, &sa, (struct sigaction *) 0);

 WARNING: space prohibited between function name and open parenthesis '('
 #424: FILE: mount/fstab.c:424:
 +       sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid ());

 WARNING: space prohibited between function name and open parenthesis '('
 #426: FILE: mount/fstab.c:426:
 +       i = open (linktargetfile, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);

 WARNING: space prohibited between function name and open parenthesis '('
 #433: FILE: mount/fstab.c:433:
 +               die (EX_FILEIO, _("can't create lock file %s: %s " \

 WARNING: space prohibited between function name and open parenthesis '('
 #435: FILE: mount/fstab.c:435:
 +                        linktargetfile, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #459: FILE: mount/fstab.c:459:
 +                       die (EX_FILEIO, _("can't link lock file %s: %s " \

 WARNING: space prohibited between function name and open parenthesis '('
 #461: FILE: mount/fstab.c:461:
 +                            _PATH_MOUNTED_LOCK, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #464: FILE: mount/fstab.c:464:
 +               lockfile_fd = open (_PATH_MOUNTED_LOCK, O_WRONLY);

 WARNING: space prohibited between function name and open parenthesis '('
 #475: FILE: mount/fstab.c:475:
 +                       die (EX_FILEIO, _("can't open lock file %s: %s " \

 WARNING: space prohibited between function name and open parenthesis '('
 #477: FILE: mount/fstab.c:477:
 +                            _PATH_MOUNTED_LOCK, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #487: FILE: mount/fstab.c:487:
 +                       if (fcntl (lockfile_fd, F_SETLK, &flock) == -1) {

 WARNING: space prohibited between function name and open parenthesis '('
 #491: FILE: mount/fstab.c:491:
 +                                          _PATH_MOUNTED_LOCK, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #501: FILE: mount/fstab.c:501:
 +                               if (fcntl (lockfile_fd, F_SETLKW, &flock) == -1) {

 WARNING: space prohibited between function name and open parenthesis '('
 #504: FILE: mount/fstab.c:504:
 +                                       die (EX_FILEIO, _("can't lock lock file %s: %s"),

 WARNING: space prohibited between function name and open parenthesis '('
 #506: FILE: mount/fstab.c:506:
 +                                            _("timed out") : strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #513: FILE: mount/fstab.c:513:
 +                               die (EX_FILEIO,

 WARNING: space prohibited between function name and open parenthesis '('
 #534: FILE: mount/fstab.c:534:
 +update_mtab (const char *dir, struct my_mntent *instead) {

 WARNING: space prohibited between function name and open parenthesis '('
 #554: FILE: mount/fstab.c:554:
 +               error (_("cannot open %s (%s) - mtab not updated"),

 WARNING: space prohibited between function name and open parenthesis '('
 #555: FILE: mount/fstab.c:555:
 +                      fnam, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #600: FILE: mount/fstab.c:600:
 +       mftmp = my_setmntent (_PATH_MOUNTED_TMP, "w");

 WARNING: space prohibited between function name and open parenthesis '('
 #603: FILE: mount/fstab.c:603:
 +               error (_("cannot open %s (%s) - mtab not updated"),

 WARNING: space prohibited between function name and open parenthesis '('
 #604: FILE: mount/fstab.c:604:
 +                      _PATH_MOUNTED_TMP, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #612: FILE: mount/fstab.c:612:
 +                       die (EX_FILEIO, _("error writing %s: %s"),

 WARNING: space prohibited between function name and open parenthesis '('
 #613: FILE: mount/fstab.c:613:
 +                            _PATH_MOUNTED_TMP, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #631: FILE: mount/fstab.c:631:
 +                       _PATH_MOUNTED_TMP, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #643: FILE: mount/fstab.c:643:
 +                       fprintf (stderr, _("error changing owner of %s: %s\n"),

 WARNING: space prohibited between function name and open parenthesis '('
 #649: FILE: mount/fstab.c:649:
 +       my_endmntent (mftmp);

 WARNING: space prohibited between function name and open parenthesis '('
 #652: FILE: mount/fstab.c:652:
 +       if (rename (_PATH_MOUNTED_TMP, _PATH_MOUNTED) < 0) {

 WARNING: space prohibited between function name and open parenthesis '('
 #144: FILE: mount/mount.nilfs2.c:144:
 +static void print_one (const struct my_mntent *me)

 WARNING: space prohibited between function name and open parenthesis '('
 #148: FILE: mount/mount.nilfs2.c:148:
 +       printf ("%s on %s", me->mnt_fsname, me->mnt_dir);

 WARNING: space prohibited between function name and open parenthesis '('
 #150: FILE: mount/mount.nilfs2.c:150:
 +               printf (" type %s", me->mnt_type);

 WARNING: space prohibited between function name and open parenthesis '('
 #152: FILE: mount/mount.nilfs2.c:152:
 +               printf (" (%s)", me->mnt_opts);

 WARNING: space prohibited between function name and open parenthesis '('
 #158: FILE: mount/mount.nilfs2.c:158:
 +                       printf (" [%s]", label);

 WARNING: space prohibited between function name and open parenthesis '('
 #163: FILE: mount/mount.nilfs2.c:163:
 +       printf ("\n");

 WARNING: space prohibited between function name and open parenthesis '('
 #308: FILE: mount/mount.nilfs2.c:308:
 +       mnt.mnt_fsname = canonicalize (spec);

 WARNING: space prohibited between function name and open parenthesis '('
 #309: FILE: mount/mount.nilfs2.c:309:
 +       mnt.mnt_dir = canonicalize (node);

 WARNING: space prohibited between function name and open parenthesis '('
 #318: FILE: mount/mount.nilfs2.c:318:
 +               print_one (&mnt);

 WARNING: space prohibited between function name and open parenthesis '('
 #321: FILE: mount/mount.nilfs2.c:321:
 +               update_mtab (mnt.mnt_dir, &mnt);

 WARNING: space prohibited between function name and open parenthesis '('
 #332: FILE: mount/mount.nilfs2.c:332:
 +                       if ((my_addmntent (mfp, &mnt)) == 1) {

 WARNING: space prohibited between function name and open parenthesis '('
 #112: FILE: mount/mount_mntent.c:112:
 +my_setmntent (const char *file, char *mode) {

 WARNING: space prohibited between function name and open parenthesis '('
 #126: FILE: mount/mount_mntent.c:126:
 +my_endmntent (mntFILE *mfp) {

 WARNING: space prohibited between function name and open parenthesis '('
 #137: FILE: mount/mount_mntent.c:137:
 +my_addmntent (mntFILE *mfp, struct my_mntent *mnt) {

 WARNING: space prohibited between function name and open parenthesis '('
 #141: FILE: mount/mount_mntent.c:141:
 +       if (fseek (mfp->mntent_fp, 0, SEEK_END))

 WARNING: space prohibited between function name and open parenthesis '('
 #149: FILE: mount/mount_mntent.c:149:
 +       res = fprintf (mfp->mntent_fp, "%s %s %s %s %d %d\n",

 WARNING: space prohibited between function name and open parenthesis '('
 #161: FILE: mount/mount_mntent.c:161:
 +my_getmntent (mntFILE *mfp) {

 WARNING: space prohibited between function name and open parenthesis '('
 #172: FILE: mount/mount_mntent.c:172:
 +               if (fgets (buf, sizeof(buf), mfp->mntent_fp) == NULL)

 WARNING: space prohibited between function name and open parenthesis '('
 #176: FILE: mount/mount_mntent.c:176:
 +               s = index (buf, '\n');

 WARNING: space prohibited between function name and open parenthesis '('
 #185: FILE: mount/mount_mntent.c:185:
 +                               s = index (buf, 0);

 WARNING: space prohibited between function name and open parenthesis '('
 #197: FILE: mount/mount_opts.c:197:
 +               die (EX_USAGE, _("%s: improperly quoted option string '%s'"),

 WARNING: space prohibited between function name and open parenthesis '('
 #253: FILE: mount/mount_opts.c:253:
 +               if (streq (opt, om->opt)) {

 WARNING: space prohibited between function name and open parenthesis '('
 #40: FILE: mount/sundries.c:40:
 +xstrndup (const char *s, int n) {

 WARNING: space prohibited between function name and open parenthesis '('
 #44: FILE: mount/sundries.c:44:
 +         die (EX_SOFTWARE, _("bug in xstrndup call"));

 WARNING: space prohibited between function name and open parenthesis '('
 #55: FILE: mount/sundries.c:55:
 +xstrconcat3 (char *s, const char *t, const char *u) {

 WARNING: space prohibited between function name and open parenthesis '('
 #77: FILE: mount/sundries.c:77:
 +xstrconcat4 (char *s, const char *t, const char *u, const char *v) {

 WARNING: space prohibited between function name and open parenthesis '('
 #104: FILE: mount/sundries.c:104:
 +block_signals (int how) {

 WARNING: space prohibited between function name and open parenthesis '('
 #107: FILE: mount/sundries.c:107:
 +     sigfillset (&sigs);

 WARNING: space prohibited between function name and open parenthesis '('
 #110: FILE: mount/sundries.c:110:
 +     sigprocmask (how, &sigs, (sigset_t *) 0);

 WARNING: space prohibited between function name and open parenthesis '('
 #118: FILE: mount/sundries.c:118:
 +error (const char *fmt, ...) {

 WARNING: space prohibited between function name and open parenthesis '('
 #123: FILE: mount/sundries.c:123:
 +     va_start (args, fmt);

 WARNING: space prohibited between function name and open parenthesis '('
 #124: FILE: mount/sundries.c:124:
 +     vfprintf (stderr, fmt, args);

 WARNING: space prohibited between function name and open parenthesis '('
 #125: FILE: mount/sundries.c:125:
 +     va_end (args);

 WARNING: space prohibited between function name and open parenthesis '('
 #134: FILE: mount/sundries.c:134:
 +matching_type (const char *type, const char *types) {

 WARNING: space prohibited between function name and open parenthesis '('
 #139: FILE: mount/sundries.c:139:
 +     if (streq (type, MNTTYPE_SWAP))

 WARNING: space prohibited between function name and open parenthesis '('
 #209: FILE: mount/sundries.c:209:
 +matching_opts (const char *options, const char *test_opts) {

 WARNING: space prohibited between function name and open parenthesis '('
 #220: FILE: mount/sundries.c:220:
 +          die (EX_SYSERR, _("not enough memory"));

 WARNING: space prohibited between function name and open parenthesis '('
 #244: FILE: mount/sundries.c:244:
 +canonicalize (const char *path) {

 WARNING: space prohibited between function name and open parenthesis '('
 #256: FILE: mount/sundries.c:256:
 +       if (myrealpath (path, canonical, PATH_MAX+1))

 WARNING: space prohibited between function name and open parenthesis '('
 #282: FILE: mount/umount.nilfs2.c:282:
 +                     device, strerror (errsv));

 WARNING: space prohibited between function name and open parenthesis '('
 #285: FILE: mount/umount.nilfs2.c:285:
 +       if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {

 WARNING: space prohibited between function name and open parenthesis '('
 #286: FILE: mount/umount.nilfs2.c:286:
 +               perror ("ioctl: LOOP_CLR_FD");

 WARNING: space prohibited between function name and open parenthesis '('
 #289: FILE: mount/umount.nilfs2.c:289:
 +       close (fd);

 WARNING: space prohibited between function name and open parenthesis '('
 #388: FILE: mount/umount.nilfs2.c:388:
 +       if (streq (node, "/") || streq (node, "root"))

 WARNING: space prohibited between function name and open parenthesis '('
 #388: FILE: mount/umount.nilfs2.c:388:
 +       if (streq (node, "/") || streq (node, "root"))

 WARNING: space prohibited between function name and open parenthesis '('
 #462: FILE: mount/umount.nilfs2.c:462:
 +                       for (optl = strtok (optl, ","); optl;

 WARNING: space prohibited between function name and open parenthesis '('
 #463: FILE: mount/umount.nilfs2.c:463:
 +                            optl = strtok (NULL, ",")) {

 WARNING: space prohibited between function name and open parenthesis '('
 #50: FILE: mount/xmalloc.c:50:
 +xmalloc (size_t size) {

 WARNING: space prohibited between function name and open parenthesis '('
 #63: FILE: mount/xmalloc.c:63:
 +xrealloc (void *p, size_t size) {

 WARNING: space prohibited between function name and open parenthesis '('
 #73: FILE: mount/xmalloc.c:73:
 +xstrdup (const char *s) {

 WARNING: space prohibited between function name and open parenthesis '('
 #19: FILE: mount/fstab.h:19:
 +struct mntentchn *mtab_head (void);

 WARNING: space prohibited between function name and open parenthesis '('
 #20: FILE: mount/fstab.h:20:
 +struct mntentchn *getmntfile (const char *name);

 WARNING: space prohibited between function name and open parenthesis '('
 #21: FILE: mount/fstab.h:21:
 +struct mntentchn *getmntoptfile (const char *file);

 WARNING: space prohibited between function name and open parenthesis '('
 #22: FILE: mount/fstab.h:22:
 +struct mntentchn *getmntdirbackward (const char *dir, struct mntentchn *mc);

 WARNING: space prohibited between function name and open parenthesis '('
 #23: FILE: mount/fstab.h:23:
 +struct mntentchn *getmntdevbackward (const char *dev, struct mntentchn *mc);

 WARNING: space prohibited between function name and open parenthesis '('
 #25: FILE: mount/fstab.h:25:
 +struct mntentchn *fstab_head (void);

 WARNING: space prohibited between function name and open parenthesis '('
 #26: FILE: mount/fstab.h:26:
 +struct mntentchn *getfsfile (const char *file);

 WARNING: space prohibited between function name and open parenthesis '('
 #27: FILE: mount/fstab.h:27:
 +struct mntentchn *getfsspec (const char *spec);

 WARNING: space prohibited between function name and open parenthesis '('
 #28: FILE: mount/fstab.h:28:
 +struct mntentchn *getfsspecfile (const char *spec, const char *file);

 WARNING: space prohibited between function name and open parenthesis '('
 #29: FILE: mount/fstab.h:29:
 +struct mntentchn *getfsuuidspec (const char *uuid);

 WARNING: space prohibited between function name and open parenthesis '('
 #30: FILE: mount/fstab.h:30:
 +struct mntentchn *getfsvolspec (const char *label);

 WARNING: space prohibited between function name and open parenthesis '('
 #32: FILE: mount/fstab.h:32:
 +void lock_mtab (void);

 WARNING: space prohibited between function name and open parenthesis '('
 #33: FILE: mount/fstab.h:33:
 +void unlock_mtab (void);

 WARNING: space prohibited between function name and open parenthesis '('
 #34: FILE: mount/fstab.h:34:
 +void update_mtab (const char *special, struct my_mntent *with);

 WARNING: space prohibited between function name and open parenthesis '('
 #28: FILE: mount/mount_mntent.h:28:
 +mntFILE *my_setmntent (const char *file, char *mode);

 WARNING: space prohibited between function name and open parenthesis '('
 #29: FILE: mount/mount_mntent.h:29:
 +void my_endmntent (mntFILE *mfp);

 WARNING: space prohibited between function name and open parenthesis '('
 #30: FILE: mount/mount_mntent.h:30:
 +int my_addmntent (mntFILE *mfp, struct my_mntent *mnt);

 WARNING: space prohibited between function name and open parenthesis '('
 #31: FILE: mount/mount_mntent.h:31:
 +struct my_mntent *my_getmntent (mntFILE *mfp);

 WARNING: space prohibited between function name and open parenthesis '('
 #24: FILE: mount/sundries.h:24:
 +#define streq(s, t)    (strcmp ((s), (t)) == 0)

 WARNING: space prohibited between function name and open parenthesis '('
 #27: FILE: mount/sundries.h:27:
 +void block_signals (int how);

 WARNING: space prohibited between function name and open parenthesis '('
 #28: FILE: mount/sundries.h:28:
 +char *canonicalize (const char *path);

 WARNING: space prohibited between function name and open parenthesis '('
 #29: FILE: mount/sundries.h:29:
 +void error (const char *fmt, ...);

 WARNING: space prohibited between function name and open parenthesis '('
 #30: FILE: mount/sundries.h:30:
 +int matching_type (const char *type, const char *types);

 WARNING: space prohibited between function name and open parenthesis '('
 #31: FILE: mount/sundries.h:31:
 +int matching_opts (const char *options, const char *test_opts);

 WARNING: space prohibited between function name and open parenthesis '('
 #32: FILE: mount/sundries.h:32:
 +void *xmalloc (size_t size);

 WARNING: space prohibited between function name and open parenthesis '('
 #33: FILE: mount/sundries.h:33:
 +char *xstrdup (const char *s);

 WARNING: space prohibited between function name and open parenthesis '('
 #34: FILE: mount/sundries.h:34:
 +char *xstrndup (const char *s, int n);

 WARNING: space prohibited between function name and open parenthesis '('
 #35: FILE: mount/sundries.h:35:
 +char *xstrconcat3 (char *, const char *, const char *);

 WARNING: space prohibited between function name and open parenthesis '('
 #36: FILE: mount/sundries.h:36:
 +char *xstrconcat4 (char *, const char *, const char *, const char *);

 WARNING: space prohibited between function name and open parenthesis '('
 #38: FILE: mount/sundries.h:38:
 +void die (int errcode, const char *fmt, ...);

 WARNING: space prohibited between function name and open parenthesis '('
 #41: FILE: mount/sundries.h:41:
 +int nfsmount (const char *spec, const char *node, int *flags,

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
mount/sundires.c: fix indent

Fix the following checkpatch warnings:

 WARNING: please, no spaces at the start of a line
 #41: FILE: mount/sundries.c:41:
 +     char *t;$

 WARNING: please, no spaces at the start of a line
 #43: FILE: mount/sundries.c:43:
 +     if (s == NULL)$

 WARNING: suspect code indent for conditional statements (5, 10)
 #43: FILE: mount/sundries.c:43:
 +     if (s == NULL)
 +         die(EX_SOFTWARE, _("bug in xstrndup call"));

 WARNING: please, no spaces at the start of a line
 #46: FILE: mount/sundries.c:46:
 +     t = xmalloc(n+1);$

 WARNING: please, no spaces at the start of a line
 #47: FILE: mount/sundries.c:47:
 +     strncpy(t, s, n);$

 WARNING: please, no spaces at the start of a line
 #48: FILE: mount/sundries.c:48:
 +     t[n] = 0;$

 WARNING: please, no spaces at the start of a line
 #50: FILE: mount/sundries.c:50:
 +     return t;$
 ...

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: add missing space chars

Fix the following checkpatch errors:

 ERROR: spaces required around that '==' (ctx:VxV)
 #219: FILE: mount/mount_opts.c:219:
 +       if (optdata==NULL || *optdata=='\0' || optname==NULL)
                    ^

 ERROR: spaces required around that '==' (ctx:VxV)
 #219: FILE: mount/mount_opts.c:219:
 +       if (optdata==NULL || *optdata=='\0' || optname==NULL)
                                      ^

 ERROR: spaces required around that '==' (ctx:VxV)
 #219: FILE: mount/mount_opts.c:219:
 +       if (optdata==NULL || *optdata=='\0' || optname==NULL)
                                                       ^

 ERROR: spaces required around that '==' (ctx:WxV)
 #223: FILE: mount/mount_opts.c:223:
 +       data = *optdata =='"' ? strip_quotes(optdata) : optdata;
                         ^

 ERROR: spaces required around that '=' (ctx:VxV)
 #328: FILE: mount/mount_opts.c:328:
 +               for (p=opts, opt=NULL; p && *p; p++) {
                       ^

 ERROR: spaces required around that '=' (ctx:VxV)
 #328: FILE: mount/mount_opts.c:328:
 +               for (p=opts, opt=NULL; p && *p; p++) {
                                 ^
 ...

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: remove unnecessary externs

Fix the following checkpatch warnings:

 WARNING: externs should be avoided in .c files
 #102: FILE: mkfs/mkfs.c:102:
 +extern char *optarg;

 WARNING: externs should be avoided in .c files
 #103: FILE: mkfs/mkfs.c:103:
 +extern int optind;

 WARNING: externs should be avoided in .c files
 #106: FILE: mount/mount.nilfs2.c:106:
 +extern char *optarg;

 WARNING: externs should be avoided in .c files
 #107: FILE: mount/mount.nilfs2.c:107:
 +extern int optind;

 WARNING: externs should be avoided in .c files
 #104: FILE: mount/umount.nilfs2.c:104:
 +extern char *optarg;

 WARNING: externs should be avoided in .c files
 #105: FILE: mount/umount.nilfs2.c:105:
 +extern int optind;

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>