Add terse version output format command line parameter
authorJens Axboe <jaxboe@fusionio.com>
Fri, 9 Sep 2011 19:01:37 +0000 (21:01 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Fri, 9 Sep 2011 19:01:37 +0000 (21:01 +0200)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
README
fio.1
fio.h
init.c

diff --git a/README b/README
index 7c93d1fce13b1d02994faf302cfa0f7b0a5d931c..ede4c81452fd8ca248752a981db582a71636d92c 100644 (file)
--- a/README
+++ b/README
@@ -134,6 +134,7 @@ $ fio
        --bandwidth-log Generate per-job bandwidth logs
        --minimal               Minimal (terse) output
        --version               Print version info and exit
        --bandwidth-log Generate per-job bandwidth logs
        --minimal               Minimal (terse) output
        --version               Print version info and exit
+       --terse-version=type    Terse version output format
        --help                  Print this page
        --cmdhelp=cmd   Print command help, "all" for all of them
        --showcmd               Turn a job file into command line options
        --help                  Print this page
        --cmdhelp=cmd   Print command help, "all" for all of them
        --showcmd               Turn a job file into command line options
diff --git a/fio.1 b/fio.1
index ffc97c989b705844a78962e3e8b0de17fb7465b4..7eb20498eef7b035ff37a0ca8fe814ef307784a1 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -53,6 +53,9 @@ Display usage information and exit.
 .TP
 .B \-\-version
 Display version information and exit.
 .TP
 .B \-\-version
 Display version information and exit.
+.TP
+.B \-\-terse\-version\fR=\fPtype
+Terse version output format
 .SH "JOB FILE FORMAT"
 Job files are in `ini' format. They consist of one or more
 job definitions, which begin with a job name in square brackets and
 .SH "JOB FILE FORMAT"
 Job files are in `ini' format. They consist of one or more
 job definitions, which begin with a job name in square brackets and
diff --git a/fio.h b/fio.h
index 6eb270d2a8e802b6607b43c0e992454ac8e68d56..e93e8f3d31edcaf53feed39d1b74701fe11a59f8 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -648,6 +648,7 @@ extern int fio_gtod_offload;
 extern int fio_gtod_cpu;
 extern enum fio_cs fio_clock_source;
 extern int warnings_fatal;
 extern int fio_gtod_cpu;
 extern enum fio_cs fio_clock_source;
 extern int warnings_fatal;
+extern int terse_version;
 
 extern struct thread_data *threads;
 
 
 extern struct thread_data *threads;
 
diff --git a/init.c b/init.c
index ed3426936a9fb84b26b4b9567b853cb592819490..f55e5d71b3abcdfd6c03a3a0d0ff5bffdab62cc3 100644 (file)
--- a/init.c
+++ b/init.c
@@ -43,6 +43,7 @@ char **job_sections = NULL;
 int nr_job_sections = 0;
 char *exec_profile = NULL;
 int warnings_fatal = 0;
 int nr_job_sections = 0;
 char *exec_profile = NULL;
 int warnings_fatal = 0;
+int terse_version = 2;
 
 int write_bw_log = 0;
 int read_only = 0;
 
 int write_bw_log = 0;
 int read_only = 0;
@@ -147,6 +148,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
                .has_arg        = required_argument,
                .val            = 'j',
        },
                .has_arg        = required_argument,
                .val            = 'j',
        },
+       {
+               .name           = (char *) "terse-version",
+               .has_arg        = required_argument,
+               .val            = 'V',
+       },
        {
                .name           = NULL,
        },
        {
                .name           = NULL,
        },
@@ -1038,6 +1044,7 @@ static void usage(const char *name)
        printf("\t--bandwidth-log\tGenerate per-job bandwidth logs\n");
        printf("\t--minimal\tMinimal (terse) output\n");
        printf("\t--version\tPrint version info and exit\n");
        printf("\t--bandwidth-log\tGenerate per-job bandwidth logs\n");
        printf("\t--minimal\tMinimal (terse) output\n");
        printf("\t--version\tPrint version info and exit\n");
+       printf("\t--terse-version=x Terse version output format\n");
        printf("\t--help\t\tPrint this page\n");
        printf("\t--cmdhelp=cmd\tPrint command help, \"all\" for all of"
                " them\n");
        printf("\t--help\t\tPrint this page\n");
        printf("\t--cmdhelp=cmd\tPrint command help, \"all\" for all of"
                " them\n");
@@ -1199,6 +1206,14 @@ static int parse_cmd_line(int argc, char *argv[])
                case 'v':
                        log_info("%s\n", fio_version_string);
                        exit(0);
                case 'v':
                        log_info("%s\n", fio_version_string);
                        exit(0);
+               case 'V':
+                       terse_version = atoi(optarg);
+                       if (terse_version != 2) {
+                               log_err("fio: bad terse version format\n");
+                               exit_val = 1;
+                               do_exit++;
+                       }
+                       break;
                case 'e':
                        if (!strcmp("always", optarg))
                                eta_print = FIO_ETA_ALWAYS;
                case 'e':
                        if (!strcmp("always", optarg))
                                eta_print = FIO_ETA_ALWAYS;