Skip to content

Commit 9050e48

Browse files
committed
nilfs-tune: do not display version information by default
Like other commands, add the "-V" option to display version information and suppress output during normal execution. Also update the manpage and help messages. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
1 parent a184151 commit 9050e48

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

man/nilfs-tune.8

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Copyright (C) 2010 Jiro SEKIBA <jir@unicus.jp>
22
.\"
3-
.TH NILFS-TUNE 8 "Apr 2014" "nilfs-utils version 2.2"
3+
.TH NILFS-TUNE 8 "Feb 2024" "nilfs-utils version 2.3"
44
.SH NAME
55
nilfs-tune \- adjust tunable file system parameters on NILFS file system
66
.SH SYNOPSIS
@@ -60,6 +60,9 @@ like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16".
6060
.TP
6161
.B \-h
6262
Display help message and exit.
63+
.TP
64+
.B \-V
65+
Display version and exit.
6366
.SH AUTHOR
6467
Jiro SEKIBA <jir@unicus.jp>
6568
.SH AVAILABILITY

sbin/nilfs-tune.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static void nilfs_tune_usage(void)
8989
printf("Usage: nilfs-tune -l device\n"
9090
" nilfs-tune [-f] [-i interval] [-m block_max] [-L volume_name]\n"
9191
" [-O [^]feature[,...]] [-U UUID] device\n"
92-
" nilfs-tune [-h]\n");
92+
" nilfs-tune [-h|-V]\n");
9393
}
9494

9595
static const uint64_t ok_features[NILFS_MAX_FEATURE_TYPES] = {
@@ -147,7 +147,7 @@ static void parse_options(int argc, char *argv[],
147147
opts->force = 0;
148148
opts->fs_features = NULL;
149149

150-
while ((c = getopt(argc, argv, "flhi:L:m:O:U:")) != EOF) {
150+
while ((c = getopt(argc, argv, "flhi:L:m:O:U:V")) != EOF) {
151151
switch (c) {
152152
case 'f':
153153
opts->force = 1;
@@ -201,6 +201,10 @@ static void parse_options(int argc, char *argv[],
201201
opts->mask |= NILFS_SB_UUID;
202202
opts->flags = O_RDWR;
203203
break;
204+
case 'V':
205+
printf("nilfs-tune (nilfs-utils %s)\n", VERSION);
206+
exit(0);
207+
break;
204208
default:
205209
nilfs_tune_usage();
206210
exit(EXIT_FAILURE);
@@ -580,7 +584,6 @@ int main(int argc, char *argv[])
580584
struct nilfs_tune_options opts;
581585
const char *device;
582586

583-
printf("nilfs-tune %s\n", VERSION);
584587
if (argc < 2) {
585588
nilfs_tune_usage();
586589
exit(EXIT_SUCCESS);

0 commit comments

Comments
 (0)