t/read-to-pipe-async: Complain if option -f is specified multiple times
[fio.git] / options.c
index 9508607438a5149df800322f6c081ea6348d39bc..287f0435b73cff776328787407f3dc8097911d92 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1235,7 +1235,8 @@ int set_name_idx(char *target, size_t tlen, char *input, int index,
                len = snprintf(target, tlen, "%s/%s.", fname,
                                client_sockaddr_str);
        } else
-               len = snprintf(target, tlen, "%s/", fname);
+               len = snprintf(target, tlen, "%s%c", fname,
+                               FIO_OS_PATH_SEPARATOR);
 
        target[tlen - 1] = '\0';
        free(p);
@@ -1434,6 +1435,22 @@ static int str_offset_cb(void *data, unsigned long long *__val)
        return 0;
 }
 
+static int str_offset_increment_cb(void *data, unsigned long long *__val)
+{
+       struct thread_data *td = cb_data_to_td(data);
+       unsigned long long v = *__val;
+
+       if (parse_is_percent(v)) {
+               td->o.offset_increment = 0;
+               td->o.offset_increment_percent = -1ULL - v;
+               dprint(FD_PARSE, "SET offset_increment_percent %d\n",
+                                       td->o.offset_increment_percent);
+       } else
+               td->o.offset_increment = v;
+
+       return 0;
+}
+
 static int str_size_cb(void *data, unsigned long long *__val)
 {
        struct thread_data *td = cb_data_to_td(data);
@@ -1899,6 +1916,9 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .help = "HTTP (WebDAV/S3) IO engine",
                          },
 #endif
+                         { .ival = "nbd",
+                           .help = "Network Block Device (NBD) IO engine"
+                         },
                },
        },
        {
@@ -2081,6 +2101,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .name   = "offset_increment",
                .lname  = "IO offset increment",
                .type   = FIO_OPT_STR_VAL,
+               .cb     = str_offset_increment_cb,
                .off1   = offsetof(struct thread_options, offset_increment),
                .help   = "What is the increment from one offset to the next",
                .parent = "offset",
@@ -2392,14 +2413,17 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .parent = "nrfiles",
                .hide   = 1,
        },
-#ifdef FIO_HAVE_ANY_FALLOCATE
        {
                .name   = "fallocate",
                .lname  = "Fallocate",
                .type   = FIO_OPT_STR,
                .off1   = offsetof(struct thread_options, fallocate_mode),
                .help   = "Whether pre-allocation is performed when laying out files",
+#ifdef FIO_HAVE_DEFAULT_FALLOCATE
                .def    = "native",
+#else
+               .def    = "none",
+#endif
                .category = FIO_OPT_C_FILE,
                .group  = FIO_OPT_G_INVALID,
                .posval = {
@@ -2423,6 +2447,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
                          },
 #endif
+                         { .ival = "truncate",
+                           .oval = FIO_FALLOCATE_TRUNCATE,
+                           .help = "Truncate file to final size instead of allocating"
+                         },
                          /* Compatibility with former boolean values */
                          { .ival = "0",
                            .oval = FIO_FALLOCATE_NONE,
@@ -2436,14 +2464,6 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 #endif
                },
        },
-#else  /* FIO_HAVE_ANY_FALLOCATE */
-       {
-               .name   = "fallocate",
-               .lname  = "Fallocate",
-               .type   = FIO_OPT_UNSUPPORTED,
-               .help   = "Your platform does not support fallocate",
-       },
-#endif /* FIO_HAVE_ANY_FALLOCATE */
        {
                .name   = "fadvise_hint",
                .lname  = "Fadvise hint",
@@ -3921,6 +3941,30 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_PROCESS,
        },
+       {
+               .name   = "exit_what",
+               .lname  = "What jobs to quit on terminate",
+               .type   = FIO_OPT_STR,
+               .off1   = offsetof(struct thread_options, exit_what),
+               .help   = "Fine-grained control for exitall",
+               .def    = "group",
+               .category = FIO_OPT_C_GENERAL,
+               .group  = FIO_OPT_G_PROCESS,
+               .posval = {
+                         { .ival = "group",
+                           .oval = TERMINATE_GROUP,
+                           .help = "exit_all=1 default behaviour",
+                         },
+                         { .ival = "stonewall",
+                           .oval = TERMINATE_STONEWALL,
+                           .help = "quit all currently running jobs; continue with next stonewall",
+                         },
+                         { .ival = "all",
+                           .oval = TERMINATE_ALL,
+                           .help = "Quit everything",
+                         },
+               },
+       },
        {
                .name   = "exitall_on_error",
                .lname  = "Exit-all on terminate in error",
@@ -4899,8 +4943,7 @@ char *fio_option_dup_subs(const char *opt)
                return NULL;
        }
 
-       in[OPT_LEN_MAX] = '\0';
-       strncpy(in, opt, OPT_LEN_MAX);
+       snprintf(in, sizeof(in), "%s", opt);
 
        while (*inptr && nchr > 0) {
                if (inptr[0] == '$' && inptr[1] == '{') {