#include "filehash.h"
#include "verify.h"
#include "profile.h"
+#include "server.h"
#include "lib/getopt.h"
-static char fio_version_string[] = "fio 1.57";
+static char fio_version_string[] = "fio 1.58";
#define FIO_RANDSEED (0xb1899bedUL)
int nr_job_sections = 0;
char *exec_profile = NULL;
int warnings_fatal = 0;
+int terse_version = 2;
+int is_backend = 0;
int write_bw_log = 0;
int read_only = 0;
.has_arg = required_argument,
.val = 'j',
},
+ {
+ .name = (char *) "terse-version",
+ .has_arg = required_argument,
+ .val = 'V',
+ },
+ {
+ .name = (char *) "server",
+ .has_arg = no_argument,
+ .val = 'S',
+ },
{
.name = NULL,
},
td_fill_rand_seeds_os(td);
else
td_fill_rand_seeds_internal(td);
+
+ init_rand_seed(&td->buf_state, td->rand_seeds[7]);
}
/*
/*
* This is our [ini] type file parser.
*/
-static int parse_jobs_ini(char *file, int stonewall_flag)
+int parse_jobs_ini(char *file, int is_buf, int stonewall_flag)
{
unsigned int global;
struct thread_data *td;
char **opts;
int i, alloc_opts, num_opts;
- if (!strcmp(file, "-"))
- f = stdin;
- else
- f = fopen(file, "r");
+ if (is_buf)
+ f = NULL;
+ else {
+ if (!strcmp(file, "-"))
+ f = stdin;
+ else
+ f = fopen(file, "r");
- if (!f) {
- perror("fopen job file");
- return 1;
+ if (!f) {
+ perror("fopen job file");
+ return 1;
+ }
}
string = malloc(4096);
* haven't handled.
*/
if (!skip_fgets) {
- p = fgets(string, 4095, f);
+ if (is_buf)
+ p = strsep(&file, "\n");
+ else
+ p = fgets(string, 4095, f);
if (!p)
break;
}
num_opts = 0;
memset(opts, 0, alloc_opts * sizeof(char *));
- while ((p = fgets(string, 4096, f)) != NULL) {
+ while (1) {
+ if (is_buf)
+ p = strsep(&file, "\n");
+ else
+ p = fgets(string, 4096, f);
+ if (!p)
+ break;
+
if (is_empty_or_comment(p))
continue;
free(string);
free(name);
free(opts);
- if (f != stdin)
+ if (!is_buf && f != stdin)
fclose(f);
return ret;
}
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");
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;
exit_val = 1;
}
break;
+ case 'S':
+ is_backend = 1;
+ break;
default:
do_exit++;
exit_val = 1;
if (do_exit)
exit(exit_val);
+ if (is_backend)
+ fio_server();
+
if (td) {
if (!ret)
ret = add_job(td, td->o.name ?: "fio", 0);
for (i = 0; i < job_files; i++) {
if (fill_def_thread())
return 1;
- if (parse_jobs_ini(ini_file[i], i))
+ if (parse_jobs_ini(ini_file[i], 0, i))
return 1;
free(ini_file[i]);
}