Don't output version for terse output
[fio.git] / init.c
diff --git a/init.c b/init.c
index e3ff39c01d0bdd78c450d9ee2b321982f0b14a4a..5bea9488627f85a461c3c2709f57155b3e8248c1 100644 (file)
--- a/init.c
+++ b/init.c
@@ -194,7 +194,7 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
                .val            = 'S',
        },
        {       .name           = (char *) "daemonize",
-               .has_arg        = no_argument,
+               .has_arg        = required_argument,
                .val            = 'D',
        },
        {
@@ -1121,7 +1121,8 @@ static void usage(const char *name)
        printf("\t--warnings-fatal Fio parser warnings are fatal\n");
        printf("\t--max-jobs\tMaximum number of threads/processes to support\n");
        printf("\t--server=args\tStart a backend fio server\n");
-       printf("\t--client=hostname Talk to remove backend fio server at hostname\n");
+       printf("\t--daemonize=pidfile Background fio server, write pid to file\n");
+       printf("\t--client=hostname Talk to remote backend fio server at hostname\n");
        printf("\nFio was written by Jens Axboe <jens.axboe@oracle.com>");
        printf("\n                   Jens Axboe <jaxboe@fusionio.com>\n");
 }
@@ -1243,9 +1244,9 @@ static int client_flag_set(char c)
        return 0;
 }
 
-int parse_cmd_client(void *client, char *opt)
+void parse_cmd_client(void *client, char *opt)
 {
-       return fio_client_add_cmd_option(client, opt);
+       fio_client_add_cmd_option(client, opt);
 }
 
 int parse_cmd_line(int argc, char *argv[])
@@ -1253,7 +1254,7 @@ int parse_cmd_line(int argc, char *argv[])
        struct thread_data *td = NULL;
        int c, ini_idx = 0, lidx, ret = 0, do_exit = 0, exit_val = 0;
        char *ostr = cmd_optstr;
-       int daemonize_server = 0;
+       void *pid_file = NULL;
        void *cur_client = NULL;
        int backend = 0;
 
@@ -1267,11 +1268,7 @@ int parse_cmd_line(int argc, char *argv[])
                did_arg = 1;
 
                if ((c & FIO_CLIENT_FLAG) || client_flag_set(c)) {
-                       if (parse_cmd_client(cur_client, argv[optind - 1])) {
-                               exit_val = 1;
-                               do_exit++;
-                               break;
-                       }
+                       parse_cmd_client(cur_client, argv[optind - 1]);
                        c &= ~FIO_CLIENT_FLAG;
                }
 
@@ -1325,7 +1322,7 @@ int parse_cmd_line(int argc, char *argv[])
                        break;
                case 'V':
                        terse_version = atoi(optarg);
-                       if (terse_version != 2) {
+                       if (terse_version != 3) {
                                log_err("fio: bad terse version format\n");
                                exit_val = 1;
                                do_exit++;
@@ -1412,7 +1409,7 @@ int parse_cmd_line(int argc, char *argv[])
                        backend = 1;
                        break;
                case 'D':
-                       daemonize_server = 1;
+                       pid_file = strdup(optarg);
                        break;
                case 'C':
                        if (is_backend) {
@@ -1449,7 +1446,7 @@ int parse_cmd_line(int argc, char *argv[])
        }
 
        if (is_backend && backend)
-               return fio_start_server(daemonize_server);
+               return fio_start_server(pid_file);
 
        if (td) {
                if (!ret)
@@ -1528,6 +1525,8 @@ int parse_options(int argc, char *argv[])
                fio_gtod_cpu = def_thread.o.gtod_cpu;
        }
 
-       log_info("fio %s\n", fio_version_string);
+       if (!terse_output)
+               log_info("fio %s\n", fio_version_string);
+
        return 0;
 }