Discussion:
[PATCH 04/10] nilfs-utils: remove unnecessary whitespace before quoted newlines
Ryusuke Konishi
2014-02-13 18:24:04 UTC
Permalink
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-***@public.gmane.org>
---
sbin/mkfs/mkfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index 4d6c375..f4be411 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -1163,9 +1163,10 @@ static void parse_options(int argc, char *argv[])
static void usage(void)
{
fprintf(stderr,
- "Usage: %s [-b block-size] [-B blocks-per-segment] [-c] [-f] \n"
- " [-L volume-label] [-m reserved-segments-percentage] \n"
- " [-O feature[,...]] \n"
+ "Usage: %s [-b block-size] [-B blocks-per-segment] [-c] " \
+ "[-f]\n" \
+ " [-L volume-label] [-m reserved-segments-percentage]\n" \
+ " [-O feature[,...]]\n" \
" [-hnqvKV] device\n",
progname);
}
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:06 UTC
Permalink
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-***@public.gmane.org>
---
lib/nilfs.c | 2 +-
sbin/mkfs/bitops.c | 2 +-
sbin/mkfs/mkfs.c | 4 ++--
sbin/mount/fstab.c | 2 +-
sbin/mount/mount_mntent.c | 2 +-
sbin/nilfs-resize/nilfs-resize.c | 6 +++---
6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/nilfs.c b/lib/nilfs.c
index 60b51b0..65bf7d5 100644
--- a/lib/nilfs.c
+++ b/lib/nilfs.c
@@ -81,7 +81,7 @@ extern __u32 crc32_le(__u32 seed, unsigned char const *data, size_t length);

static inline int iseol(int c)
{
- return (c == '\n' || c == '\0');
+ return c == '\n' || c == '\0';
}

static size_t tokenize(char *line, char **tokens, size_t ntoks)
diff --git a/sbin/mkfs/bitops.c b/sbin/mkfs/bitops.c
index d7efece..6262884 100644
--- a/sbin/mkfs/bitops.c
+++ b/sbin/mkfs/bitops.c
@@ -47,7 +47,7 @@ int ext2fs_test_bit(int nr, const void *addr)

ADDR += nr >> 3;
mask = 1 << (nr & 0x07);
- return (mask & *ADDR);
+ return mask & *ADDR;
}

#endif /* !_EXT2_HAVE_ASM_BITOPS_ */
diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index 9f03c07..d17dabe 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -219,8 +219,8 @@ static void init_disk_layout(struct nilfs_disk_info *di, int fd,

static inline blocknr_t count_free_blocks(struct nilfs_disk_info *di)
{
- return (di->blocks_per_segment *
- (di->nsegments - di->nsegments_to_write));
+ return di->blocks_per_segment *
+ (di->nsegments - di->nsegments_to_write);
}

static inline blocknr_t
diff --git a/sbin/mount/fstab.c b/sbin/mount/fstab.c
index e8d88c0..b9feb7c 100644
--- a/sbin/mount/fstab.c
+++ b/sbin/mount/fstab.c
@@ -290,7 +290,7 @@ is_mounted_once(const char *name) {
if (streq(mc->m.mnt_dir, name) ||
streq(mc->m.mnt_fsname, name))
ct++;
- return (ct == 1);
+ return ct == 1;
}

/* Given the name FILE, try to find the option "loop=FILE" in mtab. */
diff --git a/sbin/mount/mount_mntent.c b/sbin/mount/mount_mntent.c
index ad05183..ea44d0c 100644
--- a/sbin/mount/mount_mntent.c
+++ b/sbin/mount/mount_mntent.c
@@ -63,7 +63,7 @@ next:

static int
is_space_or_tab (char c) {
- return (c == ' ' || c == '\t');
+ return c == ' ' || c == '\t';
}

static char *
diff --git a/sbin/nilfs-resize/nilfs-resize.c b/sbin/nilfs-resize/nilfs-resize.c
index be89f8c..c7ed910 100644
--- a/sbin/nilfs-resize/nilfs-resize.c
+++ b/sbin/nilfs-resize/nilfs-resize.c
@@ -405,7 +405,7 @@ nilfs_resize_find_movable_segments(struct nilfs *nilfs, __u64 start,
rest--;
}
}
- return (snp - segnumv); /* return the number of found segments */
+ return snp - segnumv; /* return the number of found segments */
}

#if 0
@@ -476,7 +476,7 @@ nilfs_resize_find_active_segments(struct nilfs *nilfs, __u64 start, __u64 end,
}
}
}
- return (snp - segnumv); /* return the number of found segments */
+ return snp - segnumv; /* return the number of found segments */
}

static ssize_t
@@ -506,7 +506,7 @@ nilfs_resize_find_inuse_segments(struct nilfs *nilfs, __u64 start, __u64 end,
}
}
}
- return (snp - segnumv); /* return the number of found segments */
+ return snp - segnumv; /* return the number of found segments */
}

static ssize_t
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:01 UTC
Permalink
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-***@public.gmane.org>
---
bin/chcp.c | 2 +-
bin/dumpseg.c | 2 +-
bin/lscp.c | 2 +-
bin/lssu.c | 4 ++--
bin/mkcp.c | 2 +-
bin/rmcp.c | 2 +-
sbin/cleanerd/cleanerd.c | 2 +-
sbin/mkfs/mkfs.c | 2 +-
sbin/nilfs-clean/nilfs-clean.c | 2 +-
sbin/nilfs-resize/nilfs-resize.c | 6 +++---
sbin/nilfs-tune/nilfs-tune.c | 4 ++--
11 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/bin/chcp.c b/bin/chcp.c
index e1d31fd..837cf01 100644
--- a/bin/chcp.c
+++ b/bin/chcp.c
@@ -58,7 +58,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
diff --git a/bin/dumpseg.c b/bin/dumpseg.c
index abb1e7f..24a3624 100644
--- a/bin/dumpseg.c
+++ b/bin/dumpseg.c
@@ -51,7 +51,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
diff --git a/bin/lscp.c b/bin/lscp.c
index 7c51e70..c0a1b99 100644
--- a/bin/lscp.c
+++ b/bin/lscp.c
@@ -54,7 +54,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"all", no_argument, NULL, 'a'},
{"show-block-count", no_argument, NULL, 'b'},
{"show-increment", no_argument, NULL, 'g'},
diff --git a/bin/lssu.c b/bin/lssu.c
index e0cbd8d..add7252 100644
--- a/bin/lssu.c
+++ b/bin/lssu.c
@@ -58,7 +58,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"all", no_argument, NULL, 'a'},
{"index", required_argument, NULL, 'i'},
{"latest-usage", no_argument, NULL, 'l' },
@@ -97,7 +97,7 @@ struct lssu_format {
char *body;
};

-const static struct lssu_format lssu_format[] = {
+static const struct lssu_format lssu_format[] = {
{
" SEGNUM DATE TIME STAT NBLOCKS\n",
"%20llu %s %c%c%c %10u\n"
diff --git a/bin/mkcp.c b/bin/mkcp.c
index a614784..57cf0c8 100644
--- a/bin/mkcp.c
+++ b/bin/mkcp.c
@@ -50,7 +50,7 @@
#ifdef _GNU_SOURCE
#include <getopt.h>

-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"snapshot", no_argument, NULL, 's'},
{"print", no_argument, NULL, 'p'},
{"help", no_argument, NULL, 'h'},
diff --git a/bin/rmcp.c b/bin/rmcp.c
index af9eeb0..a12faa1 100644
--- a/bin/rmcp.c
+++ b/bin/rmcp.c
@@ -54,7 +54,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_options[] = {
+static const struct option long_options[] = {
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
{"help", no_argument, NULL, 'h'},
diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c
index 6a0291c..f3f2acd 100644
--- a/sbin/cleanerd/cleanerd.c
+++ b/sbin/cleanerd/cleanerd.c
@@ -93,7 +93,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"conffile", required_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
/* nofork option is obsolete. It does nothing even if passed */
diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index dd2652f..bed7818 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -1057,7 +1057,7 @@ static inline void check_ctime(time_t ctime)
}
}

-const static __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {
+static const __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {
/* Compat */
0,
/* Read-only compat */
diff --git a/sbin/nilfs-clean/nilfs-clean.c b/sbin/nilfs-clean/nilfs-clean.c
index 4a92abf..de44c11 100644
--- a/sbin/nilfs-clean/nilfs-clean.c
+++ b/sbin/nilfs-clean/nilfs-clean.c
@@ -67,7 +67,7 @@

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"break", no_argument, NULL, 'b'},
{"reload", optional_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
diff --git a/sbin/nilfs-resize/nilfs-resize.c b/sbin/nilfs-resize/nilfs-resize.c
index 116b47f..a228c29 100644
--- a/sbin/nilfs-resize/nilfs-resize.c
+++ b/sbin/nilfs-resize/nilfs-resize.c
@@ -69,7 +69,7 @@ extern int check_mount(const char *device);

#ifdef _GNU_SOURCE
#include <getopt.h>
-const static struct option long_option[] = {
+static const struct option long_option[] = {
{"help", no_argument, NULL, 'h'},
{"verbose", no_argument, NULL, 'v'},
{"yes", no_argument, NULL, 'y'},
@@ -141,7 +141,7 @@ static __u64 pm_max;
static __u64 pm_done;
static int pm_curpos;
static int pm_in_progress = 0; /* 0: off, 1: on, -1: interrupted */
-const static char *pm_label;
+static const char *pm_label;

static void nilfs_resize_logger(int priority, const char *fmt, ...)
{
@@ -704,7 +704,7 @@ static int nilfs_resize_move_out_active_segments(struct nilfs *nilfs,
unsigned long long start,
unsigned long long end)
{
- const static struct timespec retry_interval = { 0, 500000000 };
+ static const struct timespec retry_interval = { 0, 500000000 };
/* 500 msec */
ssize_t nfound;
int retrycnt = 0;
diff --git a/sbin/nilfs-tune/nilfs-tune.c b/sbin/nilfs-tune/nilfs-tune.c
index 0698649..e651d2c 100644
--- a/sbin/nilfs-tune/nilfs-tune.c
+++ b/sbin/nilfs-tune/nilfs-tune.c
@@ -82,7 +82,7 @@ static void nilfs_tune_usage(void)
" [-U UUID] device\n");
}

-const static __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {
+static const __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {
/* Compat */
0,
/* Read-only compat */
@@ -91,7 +91,7 @@ const static __u64 ok_features[NILFS_MAX_FEATURE_TYPES] = {
0
};

-const static __u64 clear_ok_features[NILFS_MAX_FEATURE_TYPES] = {
+static const __u64 clear_ok_features[NILFS_MAX_FEATURE_TYPES] = {
/* Compat */
0,
/* Read-only compat */
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:08 UTC
Permalink
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-***@public.gmane.org>
---
sbin/mount/sundries.c | 278 ++++++++++++++++++++++++-------------------------
1 file changed, 138 insertions(+), 140 deletions(-)

diff --git a/sbin/mount/sundries.c b/sbin/mount/sundries.c
index 3c22106..381472b 100644
--- a/sbin/mount/sundries.c
+++ b/sbin/mount/sundries.c
@@ -38,76 +38,74 @@

char *xstrndup(const char *s, int n)
{
- char *t;
+ char *t;

- if (s == NULL)
- die(EX_SOFTWARE, _("bug in xstrndup call"));
+ if (s == NULL)
+ die(EX_SOFTWARE, _("bug in xstrndup call"));

- t = xmalloc(n+1);
- strncpy(t, s, n);
- t[n] = 0;
+ t = xmalloc(n+1);
+ strncpy(t, s, n);
+ t[n] = 0;

- return t;
+ return t;
}

/* reallocates its first arg - typical use: s = xstrconcat3(s,t,u); */
char *xstrconcat3(char *s, const char *t, const char *u)
{
- size_t len = 0;
-
- len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) + (u ? strlen(u) : 0);
-
- if (!len)
- return NULL;
- if (!s) {
- s = xmalloc(len + 1);
- *s = '\0';
- }
- else
- s = xrealloc(s, len + 1);
- if (t)
- strcat(s, t);
- if (u)
- strcat(s, u);
- return s;
+ size_t len = 0;
+
+ len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) + (u ? strlen(u) : 0);
+
+ if (!len)
+ return NULL;
+ if (!s) {
+ s = xmalloc(len + 1);
+ *s = '\0';
+ } else {
+ s = xrealloc(s, len + 1);
+ }
+ if (t)
+ strcat(s, t);
+ if (u)
+ strcat(s, u);
+ return s;
}

/* frees its first arg - typical use: s = xstrconcat4(s,t,u,v); */
char *xstrconcat4(char *s, const char *t, const char *u, const char *v)
{
- size_t len = 0;
+ size_t len = 0;

- len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) +
+ len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) +
(u ? strlen(u) : 0) + (v ? strlen(v) : 0);

- if (!len)
- return NULL;
- if (!s) {
- s = xmalloc(len + 1);
- *s = '\0';
- }
- else
- s = xrealloc(s, len + 1);
- if (t)
- strcat(s, t);
- if (u)
- strcat(s, u);
- if (v)
- strcat(s, v);
- return s;
-
-
+ if (!len)
+ return NULL;
+ if (!s) {
+ s = xmalloc(len + 1);
+ *s = '\0';
+ } else {
+ s = xrealloc(s, len + 1);
+ }
+ if (t)
+ strcat(s, t);
+ if (u)
+ strcat(s, u);
+ if (v)
+ strcat(s, v);
+ return s;
}

/* Call this with SIG_BLOCK to block and SIG_UNBLOCK to unblock. */
void block_signals(int how)
{
- sigset_t sigs;
+ sigset_t sigs;

- sigfillset(&sigs);
- sigdelset(&sigs, SIGTRAP);
- sigdelset(&sigs, SIGSEGV);
- sigprocmask(how, &sigs, (sigset_t *) 0);
+ sigfillset(&sigs);
+ sigdelset(&sigs, SIGTRAP);
+ sigdelset(&sigs, SIGSEGV);
+ sigprocmask(how, &sigs, (sigset_t *)0);
}


@@ -116,14 +114,14 @@ void block_signals(int how)
to avoid mixing output of several threads) */
void error(const char *fmt, ...)
{
- va_list args;
-
- if (mount_quiet)
- return;
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fputc('\n', stderr);
+ va_list args;
+
+ if (mount_quiet)
+ return;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fputc('\n', stderr);
}

/* True if fstypes match. Null *TYPES means match anything,
@@ -132,69 +130,69 @@ void error(const char *fmt, ...)
with the same meaning. */
int matching_type(const char *type, const char *types)
{
- int no; /* negated types list */
- int len;
- const char *p;
-
- if (streq(type, MNTTYPE_SWAP))
- return 0;
- if (types == NULL)
- return 1;
-
- no = 0;
- if (!strncmp(types, "no", 2)) {
- no = 1;
- types += 2;
- }
-
- /* Does type occur in types, separated by commas? */
- len = strlen(type);
- p = types;
- while (1) {
- if (!strncmp(p, "no", 2) && !strncmp(p+2, type, len) &&
- (p[len+2] == 0 || p[len+2] == ','))
- return 0;
- if (strncmp(p, type, len) == 0 &&
- (p[len] == 0 || p[len] == ','))
- return !no;
- p = index(p, ',');
- if (!p)
- break;
- p++;
- }
- return no;
+ int no; /* negated types list */
+ int len;
+ const char *p;
+
+ if (streq(type, MNTTYPE_SWAP))
+ return 0;
+ if (types == NULL)
+ return 1;
+
+ no = 0;
+ if (!strncmp(types, "no", 2)) {
+ no = 1;
+ types += 2;
+ }
+
+ /* Does type occur in types, separated by commas? */
+ len = strlen(type);
+ p = types;
+ while (1) {
+ if (!strncmp(p, "no", 2) && !strncmp(p+2, type, len) &&
+ (p[len+2] == 0 || p[len+2] == ','))
+ return 0;
+ if (strncmp(p, type, len) == 0 &&
+ (p[len] == 0 || p[len] == ','))
+ return !no;
+ p = index(p, ',');
+ if (!p)
+ break;
+ p++;
+ }
+ return no;
}

/* Returns 1 if needle found or noneedle not found in haystack
* Otherwise returns 0
*/
-static int
-check_option(const char *haystack, const char *needle) {
- const char *p, *r;
- int len, needle_len, this_len;
- int no;
-
- no = 0;
- if (!strncmp(needle, "no", 2)) {
- no = 1;
- needle += 2;
- }
- needle_len = strlen(needle);
- len = strlen(haystack);
-
- for (p = haystack; p < haystack+len; p++) {
- r = strchr(p, ',');
- this_len = r ? r - p : strlen(p);
- if (this_len != needle_len) {
- p += this_len;
- continue;
- }
- if (strncmp(p, needle, this_len) == 0)
- return !no; /* foo or nofoo was found */
- p += this_len;
- }
-
- return no; /* foo or nofoo was not found */
+static int check_option(const char *haystack, const char *needle)
+{
+ const char *p, *r;
+ int len, needle_len, this_len;
+ int no;
+
+ no = 0;
+ if (!strncmp(needle, "no", 2)) {
+ no = 1;
+ needle += 2;
+ }
+ needle_len = strlen(needle);
+ len = strlen(haystack);
+
+ for (p = haystack; p < haystack+len; p++) {
+ r = strchr(p, ',');
+ this_len = r ? r - p : strlen(p);
+ if (this_len != needle_len) {
+ p += this_len;
+ continue;
+ }
+ if (strncmp(p, needle, this_len) == 0)
+ return !no; /* foo or nofoo was found */
+ p += this_len;
+ }
+
+ return no; /* foo or nofoo was not found */
}


@@ -207,32 +205,32 @@ check_option(const char *haystack, const char *needle) {
*/
int matching_opts(const char *options, const char *test_opts)
{
- const char *p, *r;
- char *q;
- int len, this_len;
-
- if (test_opts == NULL)
- return 1;
-
- len = strlen(test_opts);
- q = alloca(len+1);
- if (q == NULL)
- die(EX_SYSERR, _("not enough memory"));
-
- for (p = test_opts; p < test_opts+len; p++) {
- r = strchr(p, ',');
- this_len = r ? r - p : strlen(p);
- if (!this_len)
- continue; /* if two ',' appear in a row */
- strncpy(q, p, this_len);
- q[this_len] = '\0';
- if (!check_option(options, q))
- return 0; /* any match failure means failure */
- p += this_len;
- }
-
- /* no match failures in list means success */
- return 1;
+ const char *p, *r;
+ char *q;
+ int len, this_len;
+
+ if (test_opts == NULL)
+ return 1;
+
+ len = strlen(test_opts);
+ q = alloca(len+1);
+ if (q == NULL)
+ die(EX_SYSERR, _("not enough memory"));
+
+ for (p = test_opts; p < test_opts+len; p++) {
+ r = strchr(p, ',');
+ this_len = r ? r - p : strlen(p);
+ if (!this_len)
+ continue; /* if two ',' appear in a row */
+ strncpy(q, p, this_len);
+ q[this_len] = '\0';
+ if (!check_option(options, q))
+ return 0; /* any match failure means failure */
+ p += this_len;
+ }
+
+ /* no match failures in list means success */
+ return 1;
}

/* Make a canonical pathname from PATH. Returns a freshly malloced string.
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:05 UTC
Permalink
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-***@public.gmane.org>
---
bin/lscp.c | 2 +-
bin/rmcp.c | 4 ++--
sbin/mkfs/mkfs.c | 16 ++++++++--------
sbin/mount/fstab.c | 14 +++++++-------
sbin/mount/mount.nilfs2.c | 14 +++++++-------
sbin/mount/mount_libmount.c | 8 ++++----
sbin/mount/umount.nilfs2.c | 10 +++++-----
sbin/mount/umount_libmount.c | 8 ++++----
sbin/nilfs-clean/nilfs-clean.c | 6 +++---
sbin/nilfs-resize/nilfs-resize.c | 8 ++++----
10 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/bin/lscp.c b/bin/lscp.c
index 6ddd003..52447e5 100644
--- a/bin/lscp.c
+++ b/bin/lscp.c
@@ -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)
{
diff --git a/bin/rmcp.c b/bin/rmcp.c
index a12faa1..92d672f 100644
--- a/bin/rmcp.c
+++ b/bin/rmcp.c
@@ -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)
{
diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index f4be411..9f03c07 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -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);
diff --git a/sbin/mount/fstab.c b/sbin/mount/fstab.c
index 194f000..e8d88c0 100644
--- a/sbin/mount/fstab.c
+++ b/sbin/mount/fstab.c
@@ -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> */
diff --git a/sbin/mount/mount.nilfs2.c b/sbin/mount/mount.nilfs2.c
index 4bc45ad..0588add 100644
--- a/sbin/mount/mount.nilfs2.c
+++ b/sbin/mount/mount.nilfs2.c
@@ -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;
diff --git a/sbin/mount/mount_libmount.c b/sbin/mount/mount_libmount.c
index c7e7e25..c518475 100644
--- a/sbin/mount/mount_libmount.c
+++ b/sbin/mount/mount_libmount.c
@@ -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;
diff --git a/sbin/mount/umount.nilfs2.c b/sbin/mount/umount.nilfs2.c
index 770c9d1..8947ddb 100644
--- a/sbin/mount/umount.nilfs2.c
+++ b/sbin/mount/umount.nilfs2.c
@@ -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;
diff --git a/sbin/mount/umount_libmount.c b/sbin/mount/umount_libmount.c
index ca4a917..c5f34d5 100644
--- a/sbin/mount/umount_libmount.c
+++ b/sbin/mount/umount_libmount.c
@@ -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 */
diff --git a/sbin/nilfs-clean/nilfs-clean.c b/sbin/nilfs-clean/nilfs-clean.c
index 0f011bd..e1446bd 100644
--- a/sbin/nilfs-clean/nilfs-clean.c
+++ b/sbin/nilfs-clean/nilfs-clean.c
@@ -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;
diff --git a/sbin/nilfs-resize/nilfs-resize.c b/sbin/nilfs-resize/nilfs-resize.c
index 0c5aca2..be89f8c 100644
--- a/sbin/nilfs-resize/nilfs-resize.c
+++ b/sbin/nilfs-resize/nilfs-resize.c
@@ -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, ...)
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:03 UTC
Permalink
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-***@public.gmane.org>
---
bin/lssu.c | 2 +-
sbin/cleanerd/cleanerd.c | 2 +-
sbin/mount/mount_mntent.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/lssu.c b/bin/lssu.c
index add7252..d19f7ba 100644
--- a/bin/lssu.c
+++ b/bin/lssu.c
@@ -215,7 +215,7 @@ static ssize_t lssu_print_suinfo(struct nilfs *nilfs, __u64 segnum,
exit(1);
}

- skip_scan:
+skip_scan:
printf(lssu_format[disp_mode].body,
(unsigned long long)segnum,
timebuf,
diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c
index 1f21f06..17de87b 100644
--- a/sbin/cleanerd/cleanerd.c
+++ b/sbin/cleanerd/cleanerd.c
@@ -1562,7 +1562,7 @@ static int nilfs_cleanerd_clean_loop(struct nilfs_cleanerd *cleanerd)
if (ret < 0)
return -1;

- sleep:
+sleep:
if (sigprocmask(SIG_UNBLOCK, &sigset, NULL) < 0) {
syslog(LOG_ERR, "cannot set signal mask: %m");
return -1;
diff --git a/sbin/mount/mount_mntent.c b/sbin/mount/mount_mntent.c
index d4d02f5..ad05183 100644
--- a/sbin/mount/mount_mntent.c
+++ b/sbin/mount/mount_mntent.c
@@ -55,7 +55,7 @@ mangle(const char *s) {
*sp++ = *s;
if (*s == 0)
break;
- next:
+next:
s++;
}
return ss;
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:07 UTC
Permalink
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-***@public.gmane.org>
---
include/nls.h | 4 +-
sbin/mount/fstab.c | 132 ++++++++++++++++++++++----------------------
sbin/mount/fstab.h | 28 +++++-----
sbin/mount/mount.nilfs2.c | 22 ++++----
sbin/mount/mount_mntent.c | 32 +++++------
sbin/mount/mount_mntent.h | 8 +--
sbin/mount/mount_opts.c | 6 +-
sbin/mount/sundries.c | 50 ++++++++---------
sbin/mount/sundries.h | 30 +++++-----
sbin/mount/umount.nilfs2.c | 14 ++---
sbin/mount/xmalloc.c | 12 ++--
11 files changed, 170 insertions(+), 168 deletions(-)

diff --git a/include/nls.h b/include/nls.h
index 0b47b7f..6ae0a02 100644
--- a/include/nls.h
+++ b/include/nls.h
@@ -20,9 +20,9 @@

#if defined MAY_ENABLE_NLS && !defined DISABLE_NLS
# include <libintl.h>
-# define _(Text) gettext (Text)
+# define _(Text) gettext(Text)
# ifdef gettext_noop
-# define N_(String) gettext_noop (String)
+# define N_(String) gettext_noop(String)
# else
# define N_(String) (String)
# endif
diff --git a/sbin/mount/fstab.c b/sbin/mount/fstab.c
index b9feb7c..b0addbe 100644
--- a/sbin/mount/fstab.c
+++ b/sbin/mount/fstab.c
@@ -46,7 +46,7 @@
#include "pathnames.h"
#include "nls.h"

-#define streq(s, t) (strcmp ((s), (t)) == 0)
+#define streq(s, t) (strcmp((s), (t)) == 0)

extern int verbose;

@@ -170,7 +170,7 @@ read_mntentchn(mntFILE *mfp, const char *fnam, struct mntentchn *mc0) {
if (ferror(mfp->mntent_fp)) {
int errsv = errno;
error(_("warning: error reading %s: %s"),
- fnam, strerror (errsv));
+ fnam, strerror(errsv));
mc0->nxt = mc0->prev = NULL;
}
my_endmntent(mfp);
@@ -191,20 +191,20 @@ read_mounttable() {
mc->nxt = mc->prev = NULL;

fnam = _PATH_MOUNTED;
- mfp = my_setmntent (fnam, "r");
+ mfp = my_setmntent(fnam, "r");
if (mfp == NULL || mfp->mntent_fp == NULL) {
int errsv = errno;
fnam = _PATH_PROC_MOUNTS;
- mfp = my_setmntent (fnam, "r");
+ mfp = my_setmntent(fnam, "r");
if (mfp == NULL || mfp->mntent_fp == NULL) {
error(_("warning: can't open %s: %s"),
- _PATH_MOUNTED, strerror (errsv));
+ _PATH_MOUNTED, strerror(errsv));
return;
}
if (verbose)
- printf (_("mount: could not open %s - " \
- "using %s instead\n"),
- _PATH_MOUNTED, _PATH_PROC_MOUNTS);
+ printf(_("mount: could not open %s - " \
+ "using %s instead\n"),
+ _PATH_MOUNTED, _PATH_PROC_MOUNTS);
}
read_mntentchn(mfp, fnam, mc);
}
@@ -219,11 +219,11 @@ read_fstab() {
mc->nxt = mc->prev = NULL;

fnam = _PATH_MNTTAB;
- mfp = my_setmntent (fnam, "r");
+ mfp = my_setmntent(fnam, "r");
if (mfp == NULL || mfp->mntent_fp == NULL) {
int errsv = errno;
error(_("warning: can't open %s: %s"),
- _PATH_MNTTAB, strerror (errsv));
+ _PATH_MNTTAB, strerror(errsv));
return;
}
read_mntentchn(mfp, fnam, mc);
@@ -231,8 +231,8 @@ read_fstab() {


/* Given the name NAME, try to find it in mtab. */
-struct mntentchn *
-getmntfile (const char *name) {
+struct mntentchn *getmntfile(const char *name)
+{
struct mntentchn *mc, *mc0;

mc0 = mtab_head();
@@ -247,8 +247,8 @@ getmntfile (const char *name) {
* Given the directory name NAME, and the place MCPREV we found it last time,
* try to find more occurrences.
*/
-struct mntentchn *
-getmntdirbackward (const char *name, struct mntentchn *mcprev) {
+struct mntentchn *getmntdirbackward(const char *name, struct mntentchn *mcprev)
+{
struct mntentchn *mc, *mc0;

mc0 = mtab_head();
@@ -264,8 +264,8 @@ getmntdirbackward (const char *name, struct mntentchn *mcprev) {
* Given the device name NAME, and the place MCPREV we found it last time,
* try to find more occurrences.
*/
-struct mntentchn *
-getmntdevbackward (const char *name, struct mntentchn *mcprev) {
+struct mntentchn *getmntdevbackward(const char *name, struct mntentchn *mcprev)
+{
struct mntentchn *mc, *mc0;

mc0 = mtab_head();
@@ -294,8 +294,8 @@ is_mounted_once(const char *name) {
}

/* Given the name FILE, try to find the option "loop=FILE" in mtab. */
-struct mntentchn *
-getmntoptfile (const char *file) {
+struct mntentchn *getmntoptfile(const char *file)
+{
struct mntentchn *mc, *mc0;
const char *opts, *s;
int l;
@@ -333,23 +333,23 @@ 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> */

-static void
-handler (int sig) {
+static void handler(int sig)
+{
die(EX_USER, "%s", strsignal(sig));
}

-static void
-setlkw_timeout (int sig) {
+static void setlkw_timeout(int sig)
+{
/* nothing, fcntl will fail anyway */
}

/* Remove lock file. */
-void
-unlock_mtab (void) {
+void unlock_mtab(void)
+{
if (we_created_lockfile) {
close(lockfile_fd);
lockfile_fd = -1;
- unlink (_PATH_MOUNTED_LOCK);
+ unlink(_PATH_MOUNTED_LOCK);
we_created_lockfile = 0;
}
}
@@ -395,8 +395,8 @@ unlock_mtab (void) {
/* sleep time (in microseconds, max=999999) between attempts */
#define MOUNTLOCK_WAITTIME 5000

-void
-lock_mtab (void) {
+void lock_mtab(void)
+{
int i;
struct timespec waittime;
struct timeval maxtime;
@@ -408,31 +408,31 @@ lock_mtab (void) {

sa.sa_handler = handler;
sa.sa_flags = 0;
- sigfillset (&sa.sa_mask);
+ sigfillset(&sa.sa_mask);

- while (sigismember (&sa.sa_mask, ++sig) != -1
+ while (sigismember(&sa.sa_mask, ++sig) != -1
&& sig != SIGCHLD) {
if (sig == SIGALRM)
sa.sa_handler = setlkw_timeout;
else
sa.sa_handler = handler;
- sigaction (sig, &sa, (struct sigaction *) 0);
+ sigaction(sig, &sa, (struct sigaction *) 0);
}
signals_have_been_setup = 1;
}

- sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid ());
+ sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid());

- i = open (linktargetfile, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
+ i = open(linktargetfile, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
if (i < 0) {
int errsv = errno;
/* linktargetfile does not exist (as a file)
and we cannot create it. Read-only filesystem?
Too many files open in the system?
Filesystem full? */
- die (EX_FILEIO, _("can't create lock file %s: %s " \
- "(use -n flag to override)"),
- linktargetfile, strerror (errsv));
+ die(EX_FILEIO, _("can't create lock file %s: %s " \
+ "(use -n flag to override)"),
+ linktargetfile, strerror(errsv));
}
close(i);

@@ -456,12 +456,12 @@ lock_mtab (void) {

if (j < 0 && errsv != EEXIST) {
(void) unlink(linktargetfile);
- die (EX_FILEIO, _("can't link lock file %s: %s " \
- "(use -n flag to override)"),
- _PATH_MOUNTED_LOCK, strerror (errsv));
+ die(EX_FILEIO, _("can't link lock file %s: %s " \
+ "(use -n flag to override)"),
+ _PATH_MOUNTED_LOCK, strerror(errsv));
}

- lockfile_fd = open (_PATH_MOUNTED_LOCK, O_WRONLY);
+ lockfile_fd = open(_PATH_MOUNTED_LOCK, O_WRONLY);

if (lockfile_fd < 0) {
/* Strange... Maybe the file was just deleted? */
@@ -472,9 +472,9 @@ lock_mtab (void) {
continue;
}
(void) unlink(linktargetfile);
- die (EX_FILEIO, _("can't open lock file %s: %s " \
- "(use -n flag to override)"),
- _PATH_MOUNTED_LOCK, strerror (errsv));
+ die(EX_FILEIO, _("can't open lock file %s: %s " \
+ "(use -n flag to override)"),
+ _PATH_MOUNTED_LOCK, strerror(errsv));
}

flock.l_type = F_WRLCK;
@@ -484,11 +484,11 @@ lock_mtab (void) {

if (j == 0) {
/* We made the link. Now claim the lock. */
- if (fcntl (lockfile_fd, F_SETLK, &flock) == -1) {
+ if (fcntl(lockfile_fd, F_SETLK, &flock) == -1) {
if (verbose) {
int errsv = errno;
printf(_("Can't lock lock file %s: %s\n"),
- _PATH_MOUNTED_LOCK, strerror (errsv));
+ _PATH_MOUNTED_LOCK, strerror(errsv));
}
/* proceed, since it was us who created the lockfile anyway */
}
@@ -498,22 +498,24 @@ lock_mtab (void) {
gettimeofday(&now, NULL);
if (now.tv_sec < maxtime.tv_sec) {
alarm(maxtime.tv_sec - now.tv_sec);
- if (fcntl (lockfile_fd, F_SETLKW, &flock) == -1) {
+ if (fcntl(lockfile_fd, F_SETLKW, &flock) == -1) {
int errsv = errno;
(void) unlink(linktargetfile);
- die (EX_FILEIO, _("can't lock lock file %s: %s"),
- _PATH_MOUNTED_LOCK, (errno == EINTR) ?
- _("timed out") : strerror (errsv));
+ die(EX_FILEIO,
+ _("can't lock lock file %s: %s"),
+ _PATH_MOUNTED_LOCK,
+ (errno == EINTR) ?
+ _("timed out") : strerror(errsv));
}
alarm(0);

nanosleep(&waittime, NULL);
} else {
(void) unlink(linktargetfile);
- die (EX_FILEIO,
- _("Cannot create link %s\n" \
- "Perhaps there is a stale lock file?\n"),
- _PATH_MOUNTED_LOCK);
+ die(EX_FILEIO,
+ _("Cannot create link %s\n" \
+ "Perhaps there is a stale lock file?\n"),
+ _PATH_MOUNTED_LOCK);
}
close(lockfile_fd);
}
@@ -530,8 +532,8 @@ lock_mtab (void) {
* the values given in INSTEAD.]
*/

-void
-update_mtab (const char *dir, struct my_mntent *instead) {
+void update_mtab(const char *dir, struct my_mntent *instead)
+{
mntFILE *mfp, *mftmp;
const char *fnam = _PATH_MOUNTED;
struct mntentchn mtabhead; /* dummy */
@@ -551,8 +553,8 @@ update_mtab (const char *dir, struct my_mntent *instead) {
mfp = my_setmntent(fnam, "r");
if (mfp == NULL || mfp->mntent_fp == NULL) {
int errsv = errno;
- error (_("cannot open %s (%s) - mtab not updated"),
- fnam, strerror (errsv));
+ error(_("cannot open %s (%s) - mtab not updated"),
+ fnam, strerror(errsv));
goto leave;
}

@@ -597,11 +599,11 @@ update_mtab (const char *dir, struct my_mntent *instead) {
}

/* write chain to mtemp */
- mftmp = my_setmntent (_PATH_MOUNTED_TMP, "w");
+ mftmp = my_setmntent(_PATH_MOUNTED_TMP, "w");
if (mftmp == NULL || mftmp->mntent_fp == NULL) {
int errsv = errno;
- error (_("cannot open %s (%s) - mtab not updated"),
- _PATH_MOUNTED_TMP, strerror (errsv));
+ error(_("cannot open %s (%s) - mtab not updated"),
+ _PATH_MOUNTED_TMP, strerror(errsv));
discard_mntentchn(mc0);
goto leave;
}
@@ -609,8 +611,8 @@ update_mtab (const char *dir, struct my_mntent *instead) {
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
if (my_addmntent(mftmp, &(mc->m)) == 1) {
int errsv = errno;
- die (EX_FILEIO, _("error writing %s: %s"),
- _PATH_MOUNTED_TMP, strerror (errsv));
+ die(EX_FILEIO, _("error writing %s: %s"),
+ _PATH_MOUNTED_TMP, strerror(errsv));
}
}

@@ -628,7 +630,7 @@ update_mtab (const char *dir, struct my_mntent *instead) {
if (fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
int errsv = errno;
fprintf(stderr, _("error changing mode of %s: %s\n"),
- _PATH_MOUNTED_TMP, strerror (errsv));
+ _PATH_MOUNTED_TMP, strerror(errsv));
goto leave;
}

@@ -640,16 +642,16 @@ update_mtab (const char *dir, struct my_mntent *instead) {
if (stat(_PATH_MOUNTED, &sbuf) == 0) {
if (fchown(fd, sbuf.st_uid, sbuf.st_gid) < 0) {
int errsv = errno;
- fprintf (stderr, _("error changing owner of %s: %s\n"),
+ fprintf(stderr, _("error changing owner of %s: %s\n"),
_PATH_MOUNTED_TMP, strerror(errsv));
goto leave;
}
}

- my_endmntent (mftmp);
+ my_endmntent(mftmp);

/* rename mtemp to mtab */
- if (rename (_PATH_MOUNTED_TMP, _PATH_MOUNTED) < 0) {
+ if (rename(_PATH_MOUNTED_TMP, _PATH_MOUNTED) < 0) {
int errsv = errno;
fprintf(stderr, _("can't rename %s to %s: %s\n"),
_PATH_MOUNTED_TMP, _PATH_MOUNTED, strerror(errsv));
diff --git a/sbin/mount/fstab.h b/sbin/mount/fstab.h
index 600ab4f..46a65a2 100644
--- a/sbin/mount/fstab.h
+++ b/sbin/mount/fstab.h
@@ -16,19 +16,19 @@ struct mntentchn {
struct my_mntent m;
};

-struct mntentchn *mtab_head (void);
-struct mntentchn *getmntfile (const char *name);
-struct mntentchn *getmntoptfile (const char *file);
-struct mntentchn *getmntdirbackward (const char *dir, struct mntentchn *mc);
-struct mntentchn *getmntdevbackward (const char *dev, struct mntentchn *mc);
+struct mntentchn *mtab_head(void);
+struct mntentchn *getmntfile(const char *name);
+struct mntentchn *getmntoptfile(const char *file);
+struct mntentchn *getmntdirbackward(const char *dir, struct mntentchn *mc);
+struct mntentchn *getmntdevbackward(const char *dev, struct mntentchn *mc);

-struct mntentchn *fstab_head (void);
-struct mntentchn *getfsfile (const char *file);
-struct mntentchn *getfsspec (const char *spec);
-struct mntentchn *getfsspecfile (const char *spec, const char *file);
-struct mntentchn *getfsuuidspec (const char *uuid);
-struct mntentchn *getfsvolspec (const char *label);
+struct mntentchn *fstab_head(void);
+struct mntentchn *getfsfile(const char *file);
+struct mntentchn *getfsspec(const char *spec);
+struct mntentchn *getfsspecfile(const char *spec, const char *file);
+struct mntentchn *getfsuuidspec(const char *uuid);
+struct mntentchn *getfsvolspec(const char *label);

-void lock_mtab (void);
-void unlock_mtab (void);
-void update_mtab (const char *special, struct my_mntent *with);
+void lock_mtab(void);
+void unlock_mtab(void);
+void update_mtab(const char *special, struct my_mntent *with);
diff --git a/sbin/mount/mount.nilfs2.c b/sbin/mount/mount.nilfs2.c
index 0588add..c20b298 100644
--- a/sbin/mount/mount.nilfs2.c
+++ b/sbin/mount/mount.nilfs2.c
@@ -141,26 +141,26 @@ static void nilfs_mount_logger(int priority, const char *fmt, ...)
}

/* Report on a single mount. */
-static void print_one (const struct my_mntent *me)
+static void print_one(const struct my_mntent *me)
{
if (mount_quiet)
return;
- printf ("%s on %s", me->mnt_fsname, me->mnt_dir);
+ printf("%s on %s", me->mnt_fsname, me->mnt_dir);
if (me->mnt_type != NULL && *(me->mnt_type) != '\0')
- printf (" type %s", me->mnt_type);
+ printf(" type %s", me->mnt_type);
if (me->mnt_opts != NULL)
- printf (" (%s)", me->mnt_opts);
+ printf(" (%s)", me->mnt_opts);
#if 0 /* XXX: volume label */
if (list_with_volumelabel) {
const char *label;
label = mount_get_volume_label_by_spec(me->mnt_fsname);
if (label) {
- printf (" [%s]", label);
+ printf(" [%s]", label);
/* free(label); */
}
}
#endif
- printf ("\n");
+ printf("\n");
}

/*
@@ -305,8 +305,8 @@ update_mtab_entry(const char *spec, const char *node, const char *type,
{
struct my_mntent mnt;

- mnt.mnt_fsname = canonicalize (spec);
- mnt.mnt_dir = canonicalize (node);
+ mnt.mnt_fsname = canonicalize(spec);
+ mnt.mnt_dir = canonicalize(node);
mnt.mnt_type = xstrdup(type);
mnt.mnt_opts = xstrdup(opts);
mnt.mnt_freq = freq;
@@ -315,10 +315,10 @@ update_mtab_entry(const char *spec, const char *node, const char *type,
/* We get chatty now rather than after the update to mtab since the
mount succeeded, even if the write to /etc/mtab should fail. */
if (verbose)
- print_one (&mnt);
+ print_one(&mnt);

if (!addnew)
- update_mtab (mnt.mnt_dir, &mnt);
+ update_mtab(mnt.mnt_dir, &mnt);
else {
mntFILE *mfp;

@@ -329,7 +329,7 @@ update_mtab_entry(const char *spec, const char *node, const char *type,
error(_("%s: can't open %s, %s"),
progname, _PATH_MOUNTED, strerror(errsv));
} else {
- if ((my_addmntent (mfp, &mnt)) == 1) {
+ if ((my_addmntent(mfp, &mnt)) == 1) {
int errsv = errno;
error(_("%s: error writing %s, %s"),
progname, _PATH_MOUNTED, strerror(errsv));
diff --git a/sbin/mount/mount_mntent.c b/sbin/mount/mount_mntent.c
index ea44d0c..f7a7349 100644
--- a/sbin/mount/mount_mntent.c
+++ b/sbin/mount/mount_mntent.c
@@ -61,8 +61,8 @@ next:
return ss;
}

-static int
-is_space_or_tab (char c) {
+static int is_space_or_tab(char c)
+{
return c == ' ' || c == '\t';
}

@@ -108,8 +108,8 @@ unmangle(char *s) {
* for /proc/mounts.)
*/

-mntFILE *
-my_setmntent (const char *file, char *mode) {
+mntFILE *my_setmntent(const char *file, char *mode)
+{
mntFILE *mfp = xmalloc(sizeof(*mfp));
mode_t old_umask = umask(077);

@@ -122,8 +122,8 @@ my_setmntent (const char *file, char *mode) {
return mfp;
}

-void
-my_endmntent (mntFILE *mfp) {
+void my_endmntent(mntFILE *mfp)
+{
if (mfp) {
if (mfp->mntent_fp)
fclose(mfp->mntent_fp);
@@ -133,12 +133,12 @@ my_endmntent (mntFILE *mfp) {
}
}

-int
-my_addmntent (mntFILE *mfp, struct my_mntent *mnt) {
+int my_addmntent(mntFILE *mfp, struct my_mntent *mnt)
+{
char *m1, *m2, *m3, *m4;
int res;

- if (fseek (mfp->mntent_fp, 0, SEEK_END))
+ if (fseek(mfp->mntent_fp, 0, SEEK_END))
return 1; /* failure */

m1 = mangle(mnt->mnt_fsname);
@@ -146,8 +146,8 @@ my_addmntent (mntFILE *mfp, struct my_mntent *mnt) {
m3 = mangle(mnt->mnt_type);
m4 = mangle(mnt->mnt_opts);

- res = fprintf (mfp->mntent_fp, "%s %s %s %s %d %d\n",
- m1, m2, m3, m4, mnt->mnt_freq, mnt->mnt_passno);
+ res = fprintf(mfp->mntent_fp, "%s %s %s %s %d %d\n",
+ m1, m2, m3, m4, mnt->mnt_freq, mnt->mnt_passno);

free(m1);
free(m2);
@@ -157,8 +157,8 @@ my_addmntent (mntFILE *mfp, struct my_mntent *mnt) {
}

/* Read the next entry from the file fp. Stop reading at an incorrect entry. */
-struct my_mntent *
-my_getmntent (mntFILE *mfp) {
+struct my_mntent *my_getmntent(mntFILE *mfp)
+{
static char buf[4096];
static struct my_mntent me;
char *s;
@@ -169,11 +169,11 @@ my_getmntent (mntFILE *mfp) {

/* read the next non-blank non-comment line */
do {
- if (fgets (buf, sizeof(buf), mfp->mntent_fp) == NULL)
+ if (fgets(buf, sizeof(buf), mfp->mntent_fp) == NULL)
return NULL;

mfp->mntent_lineno++;
- s = index (buf, '\n');
+ s = index(buf, '\n');
if (s == NULL) {
/* Missing final newline? Otherwise extremely */
/* long line - assume file was corrupted */
@@ -182,7 +182,7 @@ my_getmntent (mntFILE *mfp) {
_("[mntent]: warning: no final " \
"newline at the end of %s\n"),
mfp->mntent_file);
- s = index (buf, 0);
+ s = index(buf, 0);
} else {
mfp->mntent_errs = 1;
goto err;
diff --git a/sbin/mount/mount_mntent.h b/sbin/mount/mount_mntent.h
index f859664..4f09ebb 100644
--- a/sbin/mount/mount_mntent.h
+++ b/sbin/mount/mount_mntent.h
@@ -25,9 +25,9 @@ typedef struct mntFILEstruct {
int mntent_softerrs;
} mntFILE;

-mntFILE *my_setmntent (const char *file, char *mode);
-void my_endmntent (mntFILE *mfp);
-int my_addmntent (mntFILE *mfp, struct my_mntent *mnt);
-struct my_mntent *my_getmntent (mntFILE *mfp);
+mntFILE *my_setmntent(const char *file, char *mode);
+void my_endmntent(mntFILE *mfp);
+int my_addmntent(mntFILE *mfp, struct my_mntent *mnt);
+struct my_mntent *my_getmntent(mntFILE *mfp);

#endif /* MOUNT_MNTENT_H */
diff --git a/sbin/mount/mount_opts.c b/sbin/mount/mount_opts.c
index 4b712b2..274eb4b 100644
--- a/sbin/mount/mount_opts.c
+++ b/sbin/mount/mount_opts.c
@@ -194,8 +194,8 @@ strip_quotes(char *str)

end = strrchr(str, '"');
if (end == NULL || end == str)
- die (EX_USAGE, _("%s: improperly quoted option string '%s'"),
- progname, str);
+ die(EX_USAGE, _("%s: improperly quoted option string '%s'"),
+ progname, str);

*end = '\0';
return str+1;
@@ -250,7 +250,7 @@ parse_opt(char *opt, int *mask, char **extra_opts)
const struct opt_map *om;

for (om = opt_map; om->opt != NULL; om++)
- if (streq (opt, om->opt)) {
+ if (streq(opt, om->opt)) {
if (om->inv)
*mask &= ~om->mask;
else
diff --git a/sbin/mount/sundries.c b/sbin/mount/sundries.c
index 5c3a100..3c22106 100644
--- a/sbin/mount/sundries.c
+++ b/sbin/mount/sundries.c
@@ -36,12 +36,12 @@
#include "xmalloc.h"
#include "nls.h"

-char *
-xstrndup (const char *s, int n) {
+char *xstrndup(const char *s, int n)
+{
char *t;

if (s == NULL)
- die (EX_SOFTWARE, _("bug in xstrndup call"));
+ die(EX_SOFTWARE, _("bug in xstrndup call"));

t = xmalloc(n+1);
strncpy(t, s, n);
@@ -51,8 +51,8 @@ xstrndup (const char *s, int n) {
}

/* reallocates its first arg - typical use: s = xstrconcat3(s,t,u); */
-char *
-xstrconcat3 (char *s, const char *t, const char *u) {
+char *xstrconcat3(char *s, const char *t, const char *u)
+{
size_t len = 0;

len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) + (u ? strlen(u) : 0);
@@ -73,8 +73,8 @@ xstrconcat3 (char *s, const char *t, const char *u) {
}

/* frees its first arg - typical use: s = xstrconcat4(s,t,u,v); */
-char *
-xstrconcat4 (char *s, const char *t, const char *u, const char *v) {
+char *xstrconcat4(char *s, const char *t, const char *u, const char *v)
+{
size_t len = 0;

len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) +
@@ -100,29 +100,29 @@ xstrconcat4 (char *s, const char *t, const char *u, const char *v) {
}

/* Call this with SIG_BLOCK to block and SIG_UNBLOCK to unblock. */
-void
-block_signals (int how) {
+void block_signals(int how)
+{
sigset_t sigs;

- sigfillset (&sigs);
+ sigfillset(&sigs);
sigdelset(&sigs, SIGTRAP);
sigdelset(&sigs, SIGSEGV);
- sigprocmask (how, &sigs, (sigset_t *) 0);
+ sigprocmask(how, &sigs, (sigset_t *) 0);
}


/* Non-fatal error. Print message and return. */
/* (print the message in a single printf, in an attempt
to avoid mixing output of several threads) */
-void
-error (const char *fmt, ...) {
+void error(const char *fmt, ...)
+{
va_list args;

if (mount_quiet)
return;
- va_start (args, fmt);
- vfprintf (stderr, fmt, args);
- va_end (args);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
fputc('\n', stderr);
}

@@ -130,13 +130,13 @@ error (const char *fmt, ...) {
except that swap types always return false. */
/* Accept nonfs,proc,devpts and nonfs,noproc,nodevpts
with the same meaning. */
-int
-matching_type (const char *type, const char *types) {
+int matching_type(const char *type, const char *types)
+{
int no; /* negated types list */
int len;
const char *p;

- if (streq (type, MNTTYPE_SWAP))
+ if (streq(type, MNTTYPE_SWAP))
return 0;
if (types == NULL)
return 1;
@@ -205,8 +205,8 @@ check_option(const char *haystack, const char *needle) {
* Unlike fs type matching, nonetdev,user and nonetdev,nouser have
* DIFFERENT meanings; each option is matched explicitly as specified.
*/
-int
-matching_opts (const char *options, const char *test_opts) {
+int matching_opts(const char *options, const char *test_opts)
+{
const char *p, *r;
char *q;
int len, this_len;
@@ -217,7 +217,7 @@ matching_opts (const char *options, const char *test_opts) {
len = strlen(test_opts);
q = alloca(len+1);
if (q == NULL)
- die (EX_SYSERR, _("not enough memory"));
+ die(EX_SYSERR, _("not enough memory"));

for (p = test_opts; p < test_opts+len; p++) {
r = strchr(p, ',');
@@ -240,8 +240,8 @@ matching_opts (const char *options, const char *test_opts) {
canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
is not a legal pathname for ``/dev/fd0''. Anything we cannot parse
we return unmodified. */
-char *
-canonicalize (const char *path) {
+char *canonicalize(const char *path)
+{
char canonical[PATH_MAX+2];

if (path == NULL)
@@ -253,7 +253,7 @@ canonicalize (const char *path) {
streq(path, "devpts"))
return xstrdup(path);
#endif
- if (myrealpath (path, canonical, PATH_MAX+1))
+ if (myrealpath(path, canonical, PATH_MAX+1))
return xstrdup(canonical);

return xstrdup(path);
diff --git a/sbin/mount/sundries.h b/sbin/mount/sundries.h
index df462ee..b3064a7 100644
--- a/sbin/mount/sundries.h
+++ b/sbin/mount/sundries.h
@@ -21,25 +21,25 @@

extern int mount_quiet;

-#define streq(s, t) (strcmp ((s), (t)) == 0)
+#define streq(s, t) (strcmp((s), (t)) == 0)

/* Functions in sundries.c that are used in mount.c and umount.c */
-void block_signals (int how);
-char *canonicalize (const char *path);
-void error (const char *fmt, ...);
-int matching_type (const char *type, const char *types);
-int matching_opts (const char *options, const char *test_opts);
-void *xmalloc (size_t size);
-char *xstrdup (const char *s);
-char *xstrndup (const char *s, int n);
-char *xstrconcat3 (char *, const char *, const char *);
-char *xstrconcat4 (char *, const char *, const char *, const char *);
-
-void die (int errcode, const char *fmt, ...);
+void block_signals(int how);
+char *canonicalize(const char *path);
+void error(const char *fmt, ...);
+int matching_type(const char *type, const char *types);
+int matching_opts(const char *options, const char *test_opts);
+void *xmalloc(size_t size);
+char *xstrdup(const char *s);
+char *xstrndup(const char *s, int n);
+char *xstrconcat3(char *, const char *, const char *);
+char *xstrconcat4(char *, const char *, const char *, const char *);
+
+void die(int errcode, const char *fmt, ...);

#ifdef HAVE_NFS
-int nfsmount (const char *spec, const char *node, int *flags,
- char **orig_opts, char **opt_args, int *version, int running_bg);
+int nfsmount(const char *spec, const char *node, int *flags,
+ char **orig_opts, char **opt_args, int *version, int running_bg);
#endif

/* exit status - bits below are ORed */
diff --git a/sbin/mount/umount.nilfs2.c b/sbin/mount/umount.nilfs2.c
index 8947ddb..756dbe8 100644
--- a/sbin/mount/umount.nilfs2.c
+++ b/sbin/mount/umount.nilfs2.c
@@ -279,14 +279,14 @@ static int del_loop(const char *device)
if (fd < 0) {
int errsv = errno;
error(_("loop: can't delete device %s: %s\n"),
- device, strerror (errsv));
+ device, strerror(errsv));
return 1;
}
- if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
- perror ("ioctl: LOOP_CLR_FD");
+ if (ioctl(fd, LOOP_CLR_FD, 0) < 0) {
+ perror("ioctl: LOOP_CLR_FD");
return 1;
}
- close (fd);
+ close(fd);
if (verbose > 1)
printf(_("del_loop(%s): success\n"), device);
return 0;
@@ -385,7 +385,7 @@ umount_one(const char *spec, const char *node, const char *type,
pid_t pid;
pp_opt_t prot_period;

- if (streq (node, "/") || streq (node, "root"))
+ if (streq(node, "/") || streq(node, "root"))
nomtab++;

if (mc) {
@@ -459,8 +459,8 @@ umount_one(const char *spec, const char *node, const char *type,

/* new style mtab line? */
optl = mc->m.mnt_opts ? xstrdup(mc->m.mnt_opts) : "";
- for (optl = strtok (optl, ","); optl;
- optl = strtok (NULL, ",")) {
+ for (optl = strtok(optl, ","); optl;
+ optl = strtok(NULL, ",")) {
if (!strncmp(optl, "loop=", 5)) {
loopdev = optl+5;
goto gotloop;
diff --git a/sbin/mount/xmalloc.c b/sbin/mount/xmalloc.c
index 60ee375..69b3966 100644
--- a/sbin/mount/xmalloc.c
+++ b/sbin/mount/xmalloc.c
@@ -46,8 +46,8 @@ die_if_null(void *t) {
die(EX_SYSERR, _("not enough memory"));
}

-void *
-xmalloc (size_t size) {
+void *xmalloc(size_t size)
+{
void *t;

if (size == 0)
@@ -59,8 +59,8 @@ xmalloc (size_t size) {
return t;
}

-void *
-xrealloc (void *p, size_t size) {
+void *xrealloc(void *p, size_t size)
+{
void *t;

t = realloc(p, size);
@@ -69,8 +69,8 @@ xrealloc (void *p, size_t size) {
return t;
}

-char *
-xstrdup (const char *s) {
+char *xstrdup(const char *s)
+{
char *t;

if (s == NULL)
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:10 UTC
Permalink
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-***@public.gmane.org>
---
sbin/mkfs/mkfs.c | 3 ---
sbin/mount/mount.nilfs2.c | 3 ---
sbin/mount/umount.nilfs2.c | 3 ---
3 files changed, 9 deletions(-)

diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index d17dabe..c122375 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -99,9 +99,6 @@ static const char badblocks[] = "/sbin/" BADBLOCKS_NAME;
/*
* Command interface primitives
*/
-extern char *optarg;
-extern int optind;
-
char *progname = "mkfs.nilfs2";

/* Options */
diff --git a/sbin/mount/mount.nilfs2.c b/sbin/mount/mount.nilfs2.c
index c20b298..72aa07a 100644
--- a/sbin/mount/mount.nilfs2.c
+++ b/sbin/mount/mount.nilfs2.c
@@ -103,9 +103,6 @@ static int devro;
static int fake;

/* global variables */
-extern char *optarg;
-extern int optind;
-
const char fstype[] = NILFS2_FS_NAME;
char *progname = "mount." NILFS2_FS_NAME;

diff --git a/sbin/mount/umount.nilfs2.c b/sbin/mount/umount.nilfs2.c
index 756dbe8..1fc17d3 100644
--- a/sbin/mount/umount.nilfs2.c
+++ b/sbin/mount/umount.nilfs2.c
@@ -101,9 +101,6 @@ int readonly;
int readwrite;
static int nomtab;

-extern char *optarg;
-extern int optind;
-
const char fstype[] = NILFS2_FS_NAME;
char *progname = "umount." NILFS2_FS_NAME;
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:09 UTC
Permalink
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-***@public.gmane.org>
---
sbin/mount/mount_opts.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sbin/mount/mount_opts.c b/sbin/mount/mount_opts.c
index 274eb4b..8588106 100644
--- a/sbin/mount/mount_opts.c
+++ b/sbin/mount/mount_opts.c
@@ -216,11 +216,11 @@ append_context(const char *optname, char *optdata, char **extra_opts)
/* ignore the option if we running without selinux */
return 0;

- if (optdata==NULL || *optdata=='\0' || optname==NULL)
+ if (optdata == NULL || *optdata == '\0' || optname == NULL)
return -1;

/* TODO: use strip_quotes() for all mount options? */
- data = *optdata =='"' ? strip_quotes(optdata) : optdata;
+ data = *optdata == '"' ? strip_quotes(optdata) : optdata;

if (selinux_trans_to_raw_context(
(security_context_t) data, &raw) == -1 ||
@@ -325,7 +325,7 @@ void parse_opts(const char *options, int *flags, char **extra_opts)
int open_quote = 0;
char *opt, *p;

- for (p=opts, opt=NULL; p && *p; p++) {
+ for (p = opts, opt = NULL; p && *p; p++) {
if (!opt)
opt = p; /* begin of the option item */
if (*p == '"')
@@ -335,7 +335,7 @@ void parse_opts(const char *options, int *flags, char **extra_opts)
if (*p == ',')
*p = '\0'; /* terminate the option item */
/* end of option item or last item */
- if (*p == '\0' || *(p+1) == '\0') {
+ if (*p == '\0' || *(p + 1) == '\0') {
if (!parse_string_opt(opt))
parse_opt(opt, flags, extra_opts);
opt = NULL;
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ryusuke Konishi
2014-02-13 18:24:02 UTC
Permalink
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-***@public.gmane.org>
---
bin/lscp.c | 2 +-
lib/cleaner_ctl.c | 12 ++++-----
lib/cleaner_exec.c | 2 +-
sbin/cleanerd/cleanerd.c | 7 ++---
sbin/mkfs/mkfs.c | 22 ++++++++--------
sbin/mount/fstab.c | 15 ++++++-----
sbin/mount/mount.nilfs2.c | 4 +--
sbin/mount/mount_libmount.c | 6 ++---
sbin/mount/mount_mntent.c | 3 ++-
sbin/nilfs-clean/nilfs-clean.c | 4 +--
sbin/nilfs-resize/nilfs-resize.c | 52 +++++++++++++++++++-------------------
sbin/nilfs-tune/nilfs-tune.c | 20 +++++++--------
12 files changed, 76 insertions(+), 73 deletions(-)

diff --git a/bin/lscp.c b/bin/lscp.c
index c0a1b99..6ddd003 100644
--- a/bin/lscp.c
+++ b/bin/lscp.c
@@ -93,7 +93,7 @@ static int show_all = 0;

static void lscp_print_header(void)
{
- printf(" CNO DATE TIME MODE FLG %s"
+ printf(" CNO DATE TIME MODE FLG %s" \
" ICNT\n",
show_block_count ? " BLKCNT" : "NBLKINC");
}
diff --git a/lib/cleaner_ctl.c b/lib/cleaner_ctl.c
index ae36c8b..fa41ac1 100644
--- a/lib/cleaner_ctl.c
+++ b/lib/cleaner_ctl.c
@@ -253,7 +253,7 @@ static int nilfs_cleaner_find_fs(struct nilfs_cleaner *cleaner,
}
if (nfound == 0) {
nilfs_cleaner_logger(LOG_ERR,
- _("Error: no valid nilfs mountpoint "
+ _("Error: no valid nilfs mountpoint " \
"found."));
goto abort;
}
@@ -304,7 +304,7 @@ static int nilfs_cleaner_open_queue(struct nilfs_cleaner *cleaner)
&attr);
if (cleaner->recvq < 0) {
nilfs_cleaner_logger(LOG_ERR,
- _("Error: cannot create receive queue: "
+ _("Error: cannot create receive queue: " \
"%s."),
strerror(errno));
free(cleaner->recvq_name);
@@ -333,10 +333,10 @@ static int nilfs_cleaner_open_queue(struct nilfs_cleaner *cleaner)
_("No cleaner found on %s."),
cleaner->device);
} else {
- nilfs_cleaner_logger(LOG_ERR,
- _("Error: cannot open cleaner on "
- "%s: %s."),
- cleaner->device, strerror(errno));
+ nilfs_cleaner_logger(
+ LOG_ERR,
+ _("Error: cannot open cleaner on %s: %s."),
+ cleaner->device, strerror(errno));
}
goto abort;
}
diff --git a/lib/cleaner_exec.c b/lib/cleaner_exec.c
index 5a5dd8f..689880e 100644
--- a/lib/cleaner_exec.c
+++ b/lib/cleaner_exec.c
@@ -286,7 +286,7 @@ static int nilfs_wait_cleanerd(const char *device, pid_t pid)
recalc_backoff_time(&waittime);
}

- nilfs_cleaner_printf(_("cleanerd (pid=%ld) still exists on %d. "
+ nilfs_cleaner_printf(_("cleanerd (pid=%ld) still exists on %d. " \
"waiting."),
(long)pid, device);
nilfs_cleaner_flush();
diff --git a/sbin/cleanerd/cleanerd.c b/sbin/cleanerd/cleanerd.c
index f3f2acd..1f21f06 100644
--- a/sbin/cleanerd/cleanerd.c
+++ b/sbin/cleanerd/cleanerd.c
@@ -376,8 +376,8 @@ nilfs_cleanerd_create(const char *dev, const char *dir, const char *conffile)

cleanerd->cnoconv = nilfs_cnoconv_create(cleanerd->nilfs);
if (cleanerd->cnoconv == NULL) {
- syslog(LOG_ERR, "failed to create checkpoint number converter "
- ": %m");
+ syslog(LOG_ERR,
+ "failed to create checkpoint number converter: %m");
goto out_nilfs;
}

@@ -1393,7 +1393,8 @@ static int nilfs_cleanerd_clean_segments(struct nilfs_cleanerd *cleanerd,
ret = nilfs_cnoconv_time2cno(cleanerd->cnoconv, prottime,
&params.protcno);
if (ret < 0) {
- syslog(LOG_ERR, "cannot convert protection time to checkpoint "
+ syslog(LOG_ERR,
+ "cannot convert protection time to checkpoint " \
"number: %m");
goto out;
}
diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index bed7818..4d6c375 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -726,7 +726,7 @@ static void check_mount(int fd, const char *device)
if (strncmp(strtok(line, " "), device, strlen(device)) == 0) {
fclose(fp);
close(fd);
- perr("Error: %s is currently mounted. "
+ perr("Error: %s is currently mounted. " \
"You cannot make a filesystem on this device.",
device);
}
@@ -768,18 +768,18 @@ static void check_safety_of_device_overwrite(int fd, const char *device)

if (!blkid_probe_lookup_value(pr, "TYPE",
&type, NULL)) {
- pinfo("WARNING: Device %s appears to contain "
- "an existing %s superblock.",
- device, type);
+ pinfo("WARNING: Device %s appears to contain" \
+ " an existing %s superblock.",
+ device, type);
} else if (!blkid_probe_lookup_value(pr, "PTTYPE",
&type, NULL)) {
- pinfo("WARNING: Device %s appears to contain "
- "an partition table (%s).",
- device, type);
+ pinfo("WARNING: Device %s appears to contain" \
+ " an partition table (%s).",
+ device, type);
} else {
if (quiet == 0) {
- pinfo("Device %s appears to contain "
- "something weird.", device);
+ pinfo("Device %s appears to contain" \
+ " something weird.", device);
}
goto end_check;
}
@@ -856,7 +856,7 @@ static void init_disk_buffer(long max_blocks)
static void *map_disk_buffer(blocknr_t blocknr, int clear_flag)
{
if (blocknr >= disk_buffer_size)
- perr("Internal error: illegal disk buffer access "
+ perr("Internal error: illegal disk buffer access " \
"(blocknr=%llu)", blocknr);

if (!disk_buffer[blocknr]) {
@@ -942,7 +942,7 @@ static int erase_disk(int fd, struct nilfs_disk_info *di)
ret = nilfs_mkfs_discard_range(fd, start, end - start);
if (!ret && nilfs_mkfs_discard_zeroes_data(fd)) {
if (verbose)
- pinfo("Discard succeeded and will return 0s "
+ pinfo("Discard succeeded and will return 0s " \
" - skip wiping");
goto out;
}
diff --git a/sbin/mount/fstab.c b/sbin/mount/fstab.c
index c17f1ee..194f000 100644
--- a/sbin/mount/fstab.c
+++ b/sbin/mount/fstab.c
@@ -202,7 +202,7 @@ read_mounttable() {
return;
}
if (verbose)
- printf (_("mount: could not open %s - "
+ printf (_("mount: could not open %s - " \
"using %s instead\n"),
_PATH_MOUNTED, _PATH_PROC_MOUNTS);
}
@@ -430,8 +430,8 @@ lock_mtab (void) {
and we cannot create it. Read-only filesystem?
Too many files open in the system?
Filesystem full? */
- die (EX_FILEIO, _("can't create lock file %s: %s "
- "(use -n flag to override)"),
+ die (EX_FILEIO, _("can't create lock file %s: %s " \
+ "(use -n flag to override)"),
linktargetfile, strerror (errsv));
}
close(i);
@@ -456,7 +456,7 @@ lock_mtab (void) {

if (j < 0 && errsv != EEXIST) {
(void) unlink(linktargetfile);
- die (EX_FILEIO, _("can't link lock file %s: %s "
+ die (EX_FILEIO, _("can't link lock file %s: %s " \
"(use -n flag to override)"),
_PATH_MOUNTED_LOCK, strerror (errsv));
}
@@ -472,7 +472,7 @@ lock_mtab (void) {
continue;
}
(void) unlink(linktargetfile);
- die (EX_FILEIO, _("can't open lock file %s: %s "
+ die (EX_FILEIO, _("can't open lock file %s: %s " \
"(use -n flag to override)"),
_PATH_MOUNTED_LOCK, strerror (errsv));
}
@@ -510,8 +510,9 @@ lock_mtab (void) {
nanosleep(&waittime, NULL);
} else {
(void) unlink(linktargetfile);
- die (EX_FILEIO, _("Cannot create link %s\n"
- "Perhaps there is a stale lock file?\n"),
+ die (EX_FILEIO,
+ _("Cannot create link %s\n" \
+ "Perhaps there is a stale lock file?\n"),
_PATH_MOUNTED_LOCK);
}
close(lockfile_fd);
diff --git a/sbin/mount/mount.nilfs2.c b/sbin/mount/mount.nilfs2.c
index e1d32a2..4bc45ad 100644
--- a/sbin/mount/mount.nilfs2.c
+++ b/sbin/mount/mount.nilfs2.c
@@ -426,7 +426,7 @@ prepare_mount(struct nilfs_mount_info *mi, const struct mount_options *mo)

switch (mo->flags & (MS_RDONLY | MS_REMOUNT)) {
case 0: /* overlapping rw-mount */
- error(_("%s: the device already has a rw-mount on %s."
+ error(_("%s: the device already has a rw-mount on %s." \
"\n\t\tmultiple rw-mount is not allowed."),
progname, mc->m.mnt_dir);
goto failed;
@@ -442,7 +442,7 @@ prepare_mount(struct nilfs_mount_info *mi, const struct mount_options *mo)
pid = 0;
if (find_opt(mc->m.mnt_opts, gcpid_opt_fmt, &pid) >= 0 &&
nilfs_shutdown_cleanerd(mi->device, (pid_t)pid) < 0) {
- error(_("%s: remount failed due to %s shutdown "
+ error(_("%s: remount failed due to %s shutdown " \
"failure"), progname, NILFS_CLEANERD_NAME);
goto failed;
}
diff --git a/sbin/mount/mount_libmount.c b/sbin/mount/mount_libmount.c
index 1a579df..c7e7e25 100644
--- a/sbin/mount/mount_libmount.c
+++ b/sbin/mount/mount_libmount.c
@@ -297,7 +297,7 @@ static int nilfs_prepare_mount(struct nilfs_mount_info *mi)

switch (mi->mflags & (MS_RDONLY | MS_REMOUNT)) {
case 0: /* overlapping rw-mount */
- error(_("%s: the device already has a rw-mount on %s."
+ error(_("%s: the device already has a rw-mount on %s." \
"\n\t\tmultiple rw-mount is not allowed."),
progname, mnt_fs_get_target(fs));
goto failed;
@@ -320,7 +320,7 @@ static int nilfs_prepare_mount(struct nilfs_mount_info *mi)

if (!mnt_fs_match_target(fs, mnt_context_get_target(cxt),
mnt_table_get_cache(mtab))) {
- error(_("%s: different mount point (%s). "
+ error(_("%s: different mount point (%s). " \
"remount failed."),
progname, mnt_context_get_target(cxt));
goto failed;
@@ -330,7 +330,7 @@ static int nilfs_prepare_mount(struct nilfs_mount_info *mi)
res = nilfs_shutdown_cleanerd(
mnt_fs_get_source(fs), mi->old_attrs.gcpid);
if (res < 0) {
- error(_("%s: remount failed due to %s "
+ error(_("%s: remount failed due to %s " \
"shutdown failure"), progname,
NILFS_CLEANERD_NAME);
goto failed;
diff --git a/sbin/mount/mount_mntent.c b/sbin/mount/mount_mntent.c
index 459cb54..d4d02f5 100644
--- a/sbin/mount/mount_mntent.c
+++ b/sbin/mount/mount_mntent.c
@@ -178,7 +178,8 @@ my_getmntent (mntFILE *mfp) {
/* Missing final newline? Otherwise extremely */
/* long line - assume file was corrupted */
if (feof(mfp->mntent_fp)) {
- fprintf(stderr, _("[mntent]: warning: no final "
+ fprintf(stderr,
+ _("[mntent]: warning: no final " \
"newline at the end of %s\n"),
mfp->mntent_file);
s = index (buf, 0);
diff --git a/sbin/nilfs-clean/nilfs-clean.c b/sbin/nilfs-clean/nilfs-clean.c
index de44c11..0f011bd 100644
--- a/sbin/nilfs-clean/nilfs-clean.c
+++ b/sbin/nilfs-clean/nilfs-clean.c
@@ -462,8 +462,8 @@ static void nilfs_clean_parse_options(int argc, char *argv[])
myprintf(_("Error: too large period: %s\n"),
optarg);
} else {
- myprintf(_("Error: invalid protection period: "
- "%s\n"), optarg);
+ myprintf(_("Error: invalid protection " \
+ "period: %s\n"), optarg);
}
exit(EXIT_FAILURE);
case 'q':
diff --git a/sbin/nilfs-resize/nilfs-resize.c b/sbin/nilfs-resize/nilfs-resize.c
index a228c29..0c5aca2 100644
--- a/sbin/nilfs-resize/nilfs-resize.c
+++ b/sbin/nilfs-resize/nilfs-resize.c
@@ -349,16 +349,16 @@ static int nilfs_resize_check_free_space(struct nilfs *nilfs, __u64 newnsegs)
nsegs = (sustat.ss_nsegs - newnsegs) - sustat.ss_ncleansegs
+ nrsvsegs;
nbytes = (nsegs * blocks_per_segment) << blocksize_bits;
- myprintf("Error: the filesystem does not have enough free "
- "space.\n"
- " At least %llu more segments (%llu bytes) "
+ myprintf("Error: the filesystem does not have enough free " \
+ "space.\n" \
+ " At least %llu more segments (%llu bytes) " \
"are required.\n", nsegs, nbytes);
return -1;
} else if (verbose) {
nsegs = sustat.ss_ncleansegs - (sustat.ss_nsegs - newnsegs)
- nrsvsegs;
nbytes = (nsegs * blocks_per_segment) << blocksize_bits;
- myprintf("%llu free segments (%llu bytes) will be left "
+ myprintf("%llu free segments (%llu bytes) will be left " \
"after shrinkage.\n", nsegs, nbytes);
}
return 0;
@@ -389,7 +389,7 @@ nilfs_resize_find_movable_segments(struct nilfs *nilfs, __u64 start,
count = min_t(unsigned long, rest, NILFS_RESIZE_NSUINFO);
nsi = nilfs_get_suinfo(nilfs, segnum, suinfo, count);
if (nsi < 0) {
- myprintf("Error: operation failed during searching "
+ myprintf("Error: operation failed during searching " \
"movable segments: %s\n", strerror(errno));
return -1;
}
@@ -426,7 +426,7 @@ nilfs_resize_get_latest_segment(struct nilfs *nilfs, __u64 start, __u64 end,
NILFS_RESIZE_NSUINFO);
nsi = nilfs_get_suinfo(nilfs, segnum, suinfo, count);
if (nsi < 0) {
- myprintf("Error: operation failed during searching "
+ myprintf("Error: operation failed during searching " \
"latest segment: %s\n", strerror(errno));
return -1;
}
@@ -464,7 +464,7 @@ nilfs_resize_find_active_segments(struct nilfs *nilfs, __u64 start, __u64 end,
count = min_t(unsigned long, rest, NILFS_RESIZE_NSUINFO);
nsi = nilfs_get_suinfo(nilfs, segnum, suinfo, count);
if (nsi < 0) {
- myprintf("Error: operation failed during searching "
+ myprintf("Error: operation failed during searching " \
"active segments: %s\n", strerror(errno));
return -1;
}
@@ -495,7 +495,7 @@ nilfs_resize_find_inuse_segments(struct nilfs *nilfs, __u64 start, __u64 end,
count = min_t(unsigned long, rest, NILFS_RESIZE_NSUINFO);
nsi = nilfs_get_suinfo(nilfs, segnum, suinfo, count);
if (nsi < 0) {
- myprintf("Error: operation failed during searching "
+ myprintf("Error: operation failed during searching " \
"in-use segments: %s\n", strerror(errno));
return -1;
}
@@ -525,7 +525,7 @@ nilfs_resize_count_inuse_segments(struct nilfs *nilfs, __u64 start, __u64 end)
count = min_t(unsigned long, rest, NILFS_RESIZE_NSUINFO);
nsi = nilfs_get_suinfo(nilfs, segnum, suinfo, count);
if (nsi < 0) {
- myprintf("Error: operation failed during counting "
+ myprintf("Error: operation failed during counting " \
"in-use segments: %s\n", strerror(errno));
return -1;
}
@@ -721,12 +721,12 @@ static int nilfs_resize_move_out_active_segments(struct nilfs *nilfs,
break;

if (retrycnt >= 6) {
- myprintf("Error: Failed to move active segments -- "
+ myprintf("Error: Failed to move active segments -- " \
"give up.\n");
return -1;
}
if (verbose && !retrycnt) {
- myprintf("Active segments are found in the range.\n"
+ myprintf("Active segments are found in the range.\n" \
"Trying to move them.\n");
}
if (nilfs_resize_reclaim_nibble(
@@ -748,7 +748,7 @@ static int nilfs_resize_reclaim_range(struct nilfs *nilfs, __u64 newnsegs)
return -1;

if (newnsegs > sustat.ss_nsegs) {
- myprintf("Error: Confused. Number of segments became larger "
+ myprintf("Error: Confused. Number of segments became larger " \
"than requested size.\n");
return -1;
}
@@ -794,7 +794,7 @@ static int nilfs_resize_reclaim_range(struct nilfs *nilfs, __u64 newnsegs)
nmoved = nilfs_resize_move_segments(
nilfs, segnums, nfound, &reason);
if (nmoved < 0) {
- myprintf("Error: operation failed during moving "
+ myprintf("Error: operation failed during moving " \
"in-use segments: %s\n", strerror(errno));
goto out;
}
@@ -854,7 +854,7 @@ static int nilfs_shrink_online(struct nilfs *nilfs, const char *device,
newsb2off = NILFS_SB2_OFFSET_BYTES(newsize);
newnsegs = (newsb2off >> blocksize_bits) / blocks_per_segment;

- myprintf("Partition size = %llu bytes.\n"
+ myprintf("Partition size = %llu bytes.\n" \
"Shrink the filesystem size from %llu bytes to %llu bytes.\n",
devsize, fs_devsize, newsize);

@@ -862,15 +862,15 @@ static int nilfs_shrink_online(struct nilfs *nilfs, const char *device,
goto out;

if (newnsegs < sustat.ss_nsegs) {
- myprintf("%llu segments will be truncated from "
+ myprintf("%llu segments will be truncated from " \
"segnum %llu.\n",
(unsigned long long)sustat.ss_nsegs - newnsegs,
(unsigned long long)newnsegs);
} else if (newnsegs == sustat.ss_nsegs) {
myprintf("No segments will be truncated.\n");
} else {
- myprintf("Error: Confused. Number of segments "
- "became larger than requested size:\n"
+ myprintf("Error: Confused. Number of segments " \
+ "became larger than requested size:\n" \
" old-nsegs=%llu new-nsegs=%llu\n",
(unsigned long long)sustat.ss_nsegs,
(unsigned long long)newnsegs);
@@ -884,7 +884,7 @@ static int nilfs_shrink_online(struct nilfs *nilfs, const char *device,
myprintf("Error: failed to limit allocation range: %s\n",
strerror(errno));
if (errno == ENOTTY) {
- myprintf(" This kernel does not support the "
+ myprintf(" This kernel does not support the " \
"set allocation range API.\n");
}
goto out;
@@ -936,7 +936,7 @@ static int nilfs_shrink_online(struct nilfs *nilfs, const char *device,
goto restore_alloc_range;

if (verbose) {
- myprintf("In-use segment found again. "
+ myprintf("In-use segment found again. " \
"will retry moving them.. (retry = %d)\n",
retry + 1);
}
@@ -957,8 +957,8 @@ static int nilfs_extend_online(struct nilfs *nilfs, const char *device,
int status = EXIT_FAILURE;
sigset_t sigset;

- myprintf("Partition size = %llu bytes.\n"
- "Extend the filesystem size from %llu bytes to %llu "
+ myprintf("Partition size = %llu bytes.\n" \
+ "Extend the filesystem size from %llu bytes to %llu " \
"bytes.\n", devsize, fs_devsize, newsize);
if (!assume_yes && nilfs_resize_prompt(newsize) < 0)
goto out;
@@ -998,7 +998,7 @@ static int nilfs_resize_online(const char *device, unsigned long long newsize)
nilfs_resize_update_super(sb);

if (newsize == fs_devsize) {
- myprintf("No need to resize the filesystem on %s.\n"
+ myprintf("No need to resize the filesystem on %s.\n" \
"It already fits the device.\n", device);
status = EXIT_SUCCESS;
goto out_unlock;
@@ -1171,7 +1171,7 @@ int main(int argc, char *argv[])
goto out;
}
if (size > devsize) {
- myprintf("Error: size larger than partition "
+ myprintf("Error: size larger than partition " \
"size (%llu bytes).\n", devsize);
goto out;
}
@@ -1186,7 +1186,7 @@ int main(int argc, char *argv[])
unsigned long long size2;

size2 = size & ~(sector_size - 1);
- myprintf("size %llu is not alinged to sector "
+ myprintf("size %llu is not alinged to sector " \
"size. truncated to %llu.\n",
size, size2);
size = size2;
@@ -1197,8 +1197,8 @@ int main(int argc, char *argv[])


if (check_mount(device) == 0) {
- myprintf("Error: %s is not currently mounted. Offline resising"
- "\n"
+ myprintf("Error: %s is not currently mounted. Offline " \
+ "resizing\n" \
" is not supported at present.\n", device);
goto out;
} else {
diff --git a/sbin/nilfs-tune/nilfs-tune.c b/sbin/nilfs-tune/nilfs-tune.c
index e651d2c..60f1d39 100644
--- a/sbin/nilfs-tune/nilfs-tune.c
+++ b/sbin/nilfs-tune/nilfs-tune.c
@@ -77,8 +77,8 @@ struct nilfs_tune_options {

static void nilfs_tune_usage(void)
{
- printf("Usage: nilfs-tune [-h] [-l] [-i interval] [-L volume_name]\n"
- " [-m block_max] [-O [^]feature[,...]]\n"
+ printf("Usage: nilfs-tune [-h] [-l] [-i interval] [-L volume_name]\n" \
+ " [-m block_max] [-O [^]feature[,...]]\n" \
" [-U UUID] device\n");
}

@@ -284,7 +284,7 @@ static const char *uuid_string(const unsigned char *uuid)
{
static char buf[256];

- sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+ sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-" \
"%02x%02x-%02x%02x%02x%02x%02x%02x", uuid[0], uuid[1],
uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12],
@@ -523,13 +523,13 @@ static int modify_nilfs(const char *device, struct nilfs_tune_options *opts)

features = le64_to_cpu(sbp->s_feature_incompat);
if (features & ~NILFS_FEATURE_INCOMPAT_SUPP)
- fprintf(stderr, "Warning: %s: unknown incompatible "
+ fprintf(stderr, "Warning: %s: unknown incompatible " \
"features: 0x%llx\n", device, features);

features = le64_to_cpu(sbp->s_feature_compat_ro);
if (opts->flags == O_RDWR &&
(features & ~NILFS_FEATURE_COMPAT_RO_SUPP))
- fprintf(stderr, "Warning: %s: unknown read-only compatible "
+ fprintf(stderr, "Warning: %s: unknown read-only compatible " \
"features: 0x%llx\n", device, features);

if (opts->mask & NILFS_SB_LABEL)
@@ -587,11 +587,11 @@ int main(int argc, char *argv[])
}

if (!opts.force && opts.flags == O_RDWR && (check_mount(device) < 0)) {
- fprintf(stderr, "ERROR: %s is currently mounted. "
- "Aborting execution.\n"
- "Running nilfs-tune on a mounted file system "
- "may cause SEVERE damage.\n"
- "You can use the \"-f\" option to force this "
+ fprintf(stderr, "ERROR: %s is currently mounted. " \
+ "Aborting execution.\n" \
+ "Running nilfs-tune on a mounted file system " \
+ "may cause SEVERE damage.\n" \
+ "You can use the \"-f\" option to force this " \
"operation.\n",
device);
exit(EXIT_SUCCESS);
--
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...