X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=options.c;h=76146a71e09a824b8fc326765c61d57fb26e8764;hb=7a717ac6e6f154deebfe2af75a82ca0a76025453;hp=ede7cda6f018f614374184b9b31a570294fbfa95;hpb=332dab7091640eebcb2414c4e8d7f4921e9ec3e2;p=fio.git diff --git a/options.c b/options.c index ede7cda6..76146a71 100644 --- a/options.c +++ b/options.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "fio.h" #include "verify.h" @@ -17,7 +18,7 @@ #include "crc/crc32c.h" -char client_sockaddr_str[INET6_ADDRSTRLEN] = {0}; +char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 }; /* * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. @@ -822,7 +823,7 @@ static int get_max_name_idx(char *input) * Returns the directory at the index, indexes > entires will be * assigned via modulo division of the index */ -int set_name_idx(char *target, char *input, int index) +int set_name_idx(char *target, size_t tlen, char *input, int index) { unsigned int cur_idx; int len; @@ -835,11 +836,12 @@ int set_name_idx(char *target, char *input, int index) fname = get_next_name(&str); if (client_sockaddr_str[0]) { - len = sprintf(target, "%s/%s.", fname, client_sockaddr_str); - } else { - len = sprintf(target, "%s/", fname); - } + len = snprintf(target, tlen, "%s/%s.", fname, + client_sockaddr_str); + } else + len = snprintf(target, tlen, "%s/", fname); + target[tlen - 1] = '\0'; free(p); return len; @@ -915,7 +917,7 @@ static int str_opendir_cb(void *data, const char fio_unused *str) static int pattern_cb(char *pattern, unsigned int max_size, const char *input, unsigned int *pattern_bytes) { - long off; + long off = 0; int i = 0, j = 0, len, k, base = 10; uint32_t pattern_length; char *loc1, *loc2; @@ -981,6 +983,8 @@ static int pattern_cb(char *pattern, unsigned int max_size, */ fill: pattern_length = i; + if (!i && !off) + i = 1; while (i > 1 && i * 2 <= max_size) { memcpy(&pattern[i], &pattern[0], i); i *= 2; @@ -1060,7 +1064,7 @@ static int str_verify_pattern_cb(void *data, const char *input) /* * VERIFY_META could already be set */ - if (!ret && td->o.verify == VERIFY_NONE) + if (!ret && !fio_option_is_set(&td->o, verify)) td->o.verify = VERIFY_PATTERN; return ret; @@ -1843,6 +1847,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .type = FIO_OPT_STR_VAL, .off1 = td_var_offset(rand_seed), .help = "Set the random generator seed value", + .def = "0x89", .parent = "rw", .category = FIO_OPT_C_IO, .group = FIO_OPT_G_RANDOM, @@ -1894,6 +1899,11 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .oval = FIO_RAND_GEN_LFSR, .help = "Variable length LFSR", }, + { + .ival = "tausworthe64", + .oval = FIO_RAND_GEN_TAUSWORTHE64, + .help = "64-bit Tausworthe variant", + }, }, .category = FIO_OPT_C_IO, .group = FIO_OPT_G_RANDOM, @@ -2392,6 +2402,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .oval = VERIFY_META, .help = "Use io information", }, + { .ival = "pattern", + .oval = VERIFY_PATTERN_NO_HDR, + .help = "Verify strict pattern", + }, { .ival = "null", .oval = VERIFY_NULL, @@ -3036,6 +3050,26 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .category = FIO_OPT_C_FILE, .def = "0", }, + { + .name = "allow_file_create", + .lname = "Allow file create", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(allow_create), + .help = "Permit fio to create files, if they don't exist", + .def = "1", + .category = FIO_OPT_C_FILE, + .group = FIO_OPT_G_FILENAME, + }, + { + .name = "allow_mounted_write", + .lname = "Allow mounted write", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(allow_mounted_write), + .help = "Allow writes to a mounted partition", + .def = "0", + .category = FIO_OPT_C_FILE, + .group = FIO_OPT_G_FILENAME, + }, { .name = "pre_read", .lname = "Pre-read files", @@ -3180,6 +3214,15 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { .category = FIO_OPT_C_GENERAL, .group = FIO_OPT_G_PROCESS, }, + { + .name = "per_job_logs", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(per_job_logs), + .help = "Include job number in generated log files or not", + .def = "1", + .category = FIO_OPT_C_LOG, + .group = FIO_OPT_G_INVALID, + }, { .name = "write_bw_log", .lname = "Write bandwidth log", @@ -3820,6 +3863,18 @@ static struct fio_keyword fio_keywords[] = { }, }; +void fio_keywords_exit(void) +{ + struct fio_keyword *kw; + + kw = &fio_keywords[0]; + while (kw->word) { + free(kw->replace); + kw->replace = NULL; + kw++; + } +} + void fio_keywords_init(void) { unsigned long long mb_memory;