} else
perc = -1;
- if (str_to_decimal(fname, &val, 1)) {
+ if (str_to_decimal(fname, &val, 1, &td)) {
log_err("fio: bssplit conversion failed\n");
free(td->o.bssplit);
return 1;
return 0;
}
+/*
+ * Return next file in the string. Files are separated with ':'. If the ':'
+ * is escaped with a '\', then that ':' is part of the filename and does not
+ * indicate a new file.
+ */
+static char *get_next_file_name(char **ptr)
+{
+ char *str = *ptr;
+ char *p, *start;
+
+ if (!str || !strlen(str))
+ return NULL;
+
+ start = str;
+ do {
+ /*
+ * No colon, we are done
+ */
+ p = strchr(str, ':');
+ if (!p) {
+ *ptr = NULL;
+ break;
+ }
+
+ /*
+ * We got a colon, but it's the first character. Skip and
+ * continue
+ */
+ if (p == start) {
+ str = ++start;
+ continue;
+ }
+
+ if (*(p - 1) != '\\') {
+ *p = '\0';
+ *ptr = p + 1;
+ break;
+ }
+
+ memmove(p - 1, p, strlen(p) + 1);
+ str = p;
+ } while (1);
+
+ return start;
+}
+
static int str_filename_cb(void *data, const char *input)
{
struct thread_data *td = data;
if (!td->files_index)
td->o.nr_files = 0;
- while ((fname = strsep(&str, ":")) != NULL) {
+ while ((fname = get_next_file_name(&str)) != NULL) {
if (!strlen(fname))
break;
if (check_dir(td, fname)) {
return 0;
}
+static int kb_base_verify(struct fio_option *o, void *data)
+{
+ struct thread_data *td = data;
+
+ if (td->o.kb_base != 1024 && td->o.kb_base != 1000) {
+ log_err("fio: kb_base set to nonsensical value: %u\n",
+ td->o.kb_base);
+ return 1;
+ }
+
+ return 0;
+}
+
#define __stringify_1(x) #x
#define __stringify(x) __stringify_1(x)
.prio = -1, /* must come after "directory" */
.help = "File(s) to use for the workload",
},
+ {
+ .name = "kb_base",
+ .type = FIO_OPT_INT,
+ .off1 = td_var_offset(kb_base),
+ .verify = kb_base_verify,
+ .prio = 1,
+ .def = "1024",
+ .help = "How many bytes per KB for reporting (1000 or 1024)",
+ },
{
.name = "lockfile",
.type = FIO_OPT_STR,
__options_mem(td, 0);
#endif
}
+
+unsigned int fio_get_kb_base(void *data)
+{
+ struct thread_data *td = data;
+ unsigned int kb_base = 0;
+
+ if (td)
+ kb_base = td->o.kb_base;
+ if (!kb_base)
+ kb_base = 1024;
+
+ return kb_base;
+}