X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=ee6c139db28c03da7f77727e403c5d6c3acb36a8;hp=e8fef21edf567e645fef1d95a5cc83c532ba9d7b;hb=83881283564820dabaa07c1bdea0e75e686efcaa;hpb=402668f3e05259bfc135fc097136428feda01006 diff --git a/init.c b/init.c index e8fef21e..ee6c139d 100644 --- a/init.c +++ b/init.c @@ -26,11 +26,11 @@ #include "fio_version.h" #if FIO_PATCH > 0 -static char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ +const char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ __fio_stringify(FIO_MINOR) "." \ __fio_stringify(FIO_PATCH); #else -static char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ +const char fio_version_string[] = __fio_stringify(FIO_MAJOR) "." \ __fio_stringify(FIO_MINOR); #endif @@ -54,7 +54,7 @@ char **job_sections = NULL; int nr_job_sections = 0; char *exec_profile = NULL; int warnings_fatal = 0; -int terse_version = 2; +int terse_version = 3; int is_backend = 0; int nr_clients = 0; int log_syslog = 0; @@ -318,6 +318,8 @@ static void put_job(struct thread_data *td) if (td->error) log_info("fio: %s\n", td->verror); + fio_options_free(td); + memset(&threads[td->thread_number - 1], 0, sizeof(*td)); thread_number--; } @@ -962,7 +964,7 @@ int parse_jobs_ini(char *file, int is_buf, int stonewall_flag) if (is_buf) p = strsep(&file, "\n"); else - p = fgets(string, 4095, f); + p = fgets(string, 4096, f); if (!p) break; } @@ -1070,6 +1072,12 @@ int parse_jobs_ini(char *file, int is_buf, int stonewall_flag) if (dump_cmdline) log_info("\n"); + i = 0; + while (i < nr_job_sections) { + free(job_sections[i]); + i++; + } + for (i = 0; i < num_opts; i++) free(opts[i]); @@ -1099,32 +1107,34 @@ static void usage(const char *name) { printf("fio %s\n", fio_version_string); printf("%s [options] [job options] \n", name); - printf("\t--debug=options\tEnable debug logging\n"); - printf("\t--output\tWrite output to file\n"); - printf("\t--timeout\tRuntime in seconds\n"); - printf("\t--latency-log\tGenerate per-job latency logs\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" + printf(" --debug=options\tEnable debug logging. May be one/more of:\n" + "\t\t\tprocess,file,io,mem,blktrace,verify,random,parse,\n" + "\t\t\tdiskutil,job,mutex,profile,time,net\n"); + printf(" --output\t\tWrite output to file\n"); + printf(" --timeout\t\tRuntime in seconds\n"); + printf(" --latency-log\t\tGenerate per-job latency logs\n"); + printf(" --bandwidth-log\tGenerate per-job bandwidth logs\n"); + printf(" --minimal\t\tMinimal (terse) output\n"); + printf(" --version\t\tPrint version info and exit\n"); + printf(" --terse-version=x\tTerse version output format to 'x'\n"); + printf(" --help\t\tPrint this page\n"); + printf(" --cmdhelp=cmd\t\tPrint command help, \"all\" for all of" " them\n"); - printf("\t--showcmd\tTurn a job file into command line options\n"); - printf("\t--eta=when\tWhen ETA estimate should be printed\n"); - printf("\t \tMay be \"always\", \"never\" or \"auto\"\n"); - printf("\t--readonly\tTurn on safety read-only checks, preventing" + printf(" --showcmd\t\tTurn a job file into command line options\n"); + printf(" --eta=when\t\tWhen ETA estimate should be printed\n"); + printf(" \t\tMay be \"always\", \"never\" or \"auto\"\n"); + printf(" --readonly\t\tTurn on safety read-only checks, preventing" " writes\n"); - printf("\t--section=name\tOnly run specified section in job file\n"); - printf("\t--alloc-size=kb\tSet smalloc pool to this size in kb" + printf(" --section=name\tOnly run specified section in job file\n"); + printf(" --alloc-size=kb\tSet smalloc pool to this size in kb" " (def 1024)\n"); - 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--daemonize=pidfile Background fio server, write pid to file\n"); - printf("\t--client=hostname Talk to remote backend fio server at hostname\n"); + printf(" --warnings-fatal\tFio parser warnings are fatal\n"); + printf(" --max-jobs=nr\t\tMaximum number of threads/processes to support\n"); + printf(" --server=args\t\tStart a backend fio server\n"); + printf(" --daemonize=pidfile\tBackground fio server, write pid to file\n"); + printf(" --client=hostname\tTalk to remote backend fio server at hostname\n"); printf("\nFio was written by Jens Axboe "); - printf("\n Jens Axboe \n"); + printf("\n Jens Axboe \n"); } #ifdef FIO_INC_DEBUG @@ -1322,7 +1332,7 @@ int parse_cmd_line(int argc, char *argv[]) break; case 'V': terse_version = atoi(optarg); - if (terse_version != 2) { + if (!(terse_version == 2 || terse_version == 3)) { log_err("fio: bad terse version format\n"); exit_val = 1; do_exit++; @@ -1497,7 +1507,7 @@ int parse_options(int argc, char *argv[]) } free(ini_file); - options_mem_free(&def_thread); + fio_options_free(&def_thread); if (!thread_number) { if (dump_cmdline) @@ -1525,6 +1535,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; }