2 * This file contains the ini and command liner parser main.
12 #include "compiler/compiler.h"
19 #include "lib/ieee754.h"
22 #ifdef CONFIG_ARITHMETIC
26 static const char *opt_type_names[] = {
39 "OPT_SOFT_DEPRECATED",
43 static const struct fio_option *__fio_options;
45 static int vp_cmp(const void *p1, const void *p2)
47 const struct value_pair *vp1 = p1;
48 const struct value_pair *vp2 = p2;
50 return strlen(vp2->ival) - strlen(vp1->ival);
53 static void posval_sort(const struct fio_option *o, struct value_pair *vpmap)
55 const struct value_pair *vp;
58 memset(vpmap, 0, PARSE_MAX_VP * sizeof(struct value_pair));
60 for (entries = 0; entries < PARSE_MAX_VP; entries++) {
61 vp = &o->posval[entries];
62 if (!vp->ival || vp->ival[0] == '\0')
65 memcpy(&vpmap[entries], vp, sizeof(*vp));
68 qsort(vpmap, entries, sizeof(struct value_pair), vp_cmp);
71 static void show_option_range(const struct fio_option *o,
72 ssize_t (*logger)(const char *format, ...))
74 if (o->type == FIO_OPT_FLOAT_LIST) {
76 if (!o->minfp && !o->maxfp)
79 logger("%20s: ", "range");
80 if (o->minfp != DBL_MIN) {
81 logger("min=%f", o->minfp);
84 if (o->maxfp != DBL_MAX)
85 logger("%smax=%f", sep, o->maxfp);
87 } else if (!o->posval[0].ival) {
88 if (!o->minval && !o->maxval)
91 logger("%20s: min=%d", "range", o->minval);
93 logger(", max=%d", o->maxval);
98 static void show_option_values(const struct fio_option *o)
102 for (i = 0; i < PARSE_MAX_VP; i++) {
103 const struct value_pair *vp = &o->posval[i];
108 log_info("%20s: %-10s", i == 0 ? "valid values" : "", vp->ival);
110 log_info(" %s", vp->help);
118 static void show_option_help(const struct fio_option *o, int is_err)
120 const char *typehelp[] = {
124 "string with possible k/m/g postfix (opt=4k)",
125 "string with time postfix (opt=10s)",
127 "string with dual range (opt=1k-4k,4k-8k)",
128 "integer value (opt=100)",
129 "boolean value (opt=1)",
130 "list of floating point values separated by ':' (opt=5.9:7.8)",
135 ssize_t (*logger)(const char *format, ...);
143 logger("%20s: %s\n", "alias", o->alias);
145 logger("%20s: %s\n", "type", typehelp[o->type]);
146 logger("%20s: %s\n", "default", o->def ? o->def : "no default");
148 logger("%20s: only for profile '%s'\n", "valid", o->prof_name);
149 show_option_range(o, logger);
150 show_option_values(o);
153 static unsigned long long get_mult_time(const char *str, int len,
158 unsigned long long mult = 1;
162 * Go forward until we hit a non-digit, or +/- sign
164 while ((p - str) <= len) {
165 if (!isdigit((int) *p) && (*p != '+') && (*p != '-'))
170 if (!isalpha((int) *p)) {
178 for (i = 0; i < strlen(c); i++)
179 c[i] = tolower((unsigned char)c[i]);
181 if (!strncmp("us", c, 2) || !strncmp("usec", c, 4))
183 else if (!strncmp("ms", c, 2) || !strncmp("msec", c, 4))
185 else if (!strcmp("s", c))
187 else if (!strcmp("m", c))
188 mult = 60 * 1000000UL;
189 else if (!strcmp("h", c))
190 mult = 60 * 60 * 1000000UL;
191 else if (!strcmp("d", c))
192 mult = 24 * 60 * 60 * 1000000ULL;
198 static int is_separator(char c)
211 static unsigned long long __get_mult_bytes(const char *p, void *data,
214 unsigned int kb_base = fio_get_kb_base(data);
215 unsigned long long ret = 1;
216 unsigned int i, pow = 0, mult = kb_base;
224 for (i = 0; i < strlen(c); i++) {
225 c[i] = tolower((unsigned char)c[i]);
226 if (is_separator(c[i])) {
232 /* If kb_base is 1000, use true units.
233 * If kb_base is 1024, use opposite units.
235 if (!strncmp("pib", c, 3)) {
239 else if (kb_base == 1024)
241 } else if (!strncmp("tib", c, 3)) {
245 else if (kb_base == 1024)
247 } else if (!strncmp("gib", c, 3)) {
251 else if (kb_base == 1024)
253 } else if (!strncmp("mib", c, 3)) {
257 else if (kb_base == 1024)
259 } else if (!strncmp("kib", c, 3)) {
263 else if (kb_base == 1024)
265 } else if (!strncmp("p", c, 1) || !strncmp("pb", c, 2)) {
267 } else if (!strncmp("t", c, 1) || !strncmp("tb", c, 2)) {
269 } else if (!strncmp("g", c, 1) || !strncmp("gb", c, 2)) {
271 } else if (!strncmp("m", c, 1) || !strncmp("mb", c, 2)) {
273 } else if (!strncmp("k", c, 1) || !strncmp("kb", c, 2)) {
275 } else if (!strncmp("%", c, 1)) {
282 ret *= (unsigned long long) mult;
288 static unsigned long long get_mult_bytes(const char *str, int len, void *data,
295 return __get_mult_bytes(str, data, percent);
298 * Go forward until we hit a non-digit, or +/- sign
300 while ((p - str) <= len) {
301 if (!isdigit((int) *p) &&
302 (((*p != '+') && (*p != '-')) || digit_seen))
304 digit_seen |= isdigit((int) *p);
308 if (!isalpha((int) *p) && (*p != '%'))
311 return __get_mult_bytes(p, data, percent);
314 extern int evaluate_arithmetic_expression(const char *buffer, long long *ival,
315 double *dval, double implied_units,
319 * Convert string into a floating number. Return 1 for success and 0 otherwise.
321 int str_to_float(const char *str, double *val, int is_time)
323 #ifdef CONFIG_ARITHMETIC
329 rc = evaluate_arithmetic_expression(str, &ival, &dval, 1.0, is_time);
336 return 1 == sscanf(str, "%lf", val);
340 * convert string into decimal value, noting any size suffix
342 int str_to_decimal(const char *str, long long *val, int kilo, void *data,
343 int is_seconds, int is_time)
347 #ifdef CONFIG_ARITHMETIC
350 double implied_units = 1.0;
357 #ifdef CONFIG_ARITHMETIC
359 implied_units = 1000000.0;
361 rc = evaluate_arithmetic_expression(str, &ival, &dval, implied_units, is_time);
362 if (str[0] == '(' && !rc) {
363 if (!kilo && is_seconds)
364 *val = ival / 1000000LL;
371 if (strstr(str, "0x") || strstr(str, "0X"))
376 *val = strtoll(str, NULL, base);
377 if (*val == LONG_MAX && errno == ERANGE)
382 unsigned long long mult;
385 mult = get_mult_bytes(str, len, data, &perc);
391 *val *= get_mult_time(str, len, is_seconds);
396 int check_str_bytes(const char *p, long long *val, void *data)
398 return str_to_decimal(p, val, 1, data, 0, 0);
401 int check_str_time(const char *p, long long *val, int is_seconds)
403 return str_to_decimal(p, val, 0, NULL, is_seconds, 1);
406 void strip_blank_front(char **p)
412 while (isspace((int) *s))
418 void strip_blank_end(char *p)
435 while ((isspace((int) *s) || iscntrl((int) *s)) && (s > start))
441 static int check_range_bytes(const char *str, long *val, void *data)
445 if (!str_to_decimal(str, &__val, 1, data, 0, 0)) {
453 static int check_int(const char *p, int *val)
457 if (strstr(p, "0x") || strstr(p, "0X")) {
458 if (sscanf(p, "%x", val) == 1)
461 if (sscanf(p, "%u", val) == 1)
468 static size_t opt_len(const char *str)
472 postfix = strchr(str, ':');
476 return (int)(postfix - str);
479 static int str_match_len(const struct value_pair *vp, const char *str)
481 return max(strlen(vp->ival), opt_len(str));
484 #define val_store(ptr, val, off, or, data, o) \
486 ptr = td_var((data), (o), (off)); \
493 static const char *opt_type_name(const struct fio_option *o)
495 compiletime_assert(ARRAY_SIZE(opt_type_names) - 1 == FIO_OPT_UNSUPPORTED,
496 "opt_type_names[] index");
498 if (o->type <= FIO_OPT_UNSUPPORTED)
499 return opt_type_names[o->type];
501 return "OPT_UNKNOWN?";
504 static int __handle_option(const struct fio_option *o, const char *ptr,
505 void *data, int first, int more, int curr)
509 long long ull, *ullp;
513 int ret = 0, is_time = 0;
514 const struct value_pair *vp;
515 struct value_pair posval[PARSE_MAX_VP];
516 int i, all_skipped = 1;
518 dprint(FD_PARSE, "__handle_option=%s, type=%s, ptr=%s\n", o->name,
519 opt_type_name(o), ptr);
521 if (!ptr && o->type != FIO_OPT_STR_SET && o->type != FIO_OPT_STR) {
522 log_err("Option %s requires an argument\n", o->name);
528 case FIO_OPT_STR_MULTI: {
529 fio_opt_str_fn *fn = o->cb;
531 posval_sort(o, posval);
534 for (i = 0; i < PARSE_MAX_VP; i++) {
536 if (!vp->ival || vp->ival[0] == '\0')
541 if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) {
544 val_store(ilp, vp->oval, o->off1, vp->orval, data, o);
549 if (ret && !all_skipped)
550 show_option_values(o);
555 case FIO_OPT_STR_VAL_TIME:
558 case FIO_OPT_STR_VAL: {
559 fio_opt_str_val_fn *fn = o->cb;
562 if (!is_time && o->is_time)
563 is_time = o->is_time;
565 tmp[sizeof(tmp) - 1] = '\0';
566 strncpy(tmp, ptr, sizeof(tmp) - 1);
567 p = strchr(tmp, ',');
572 ret = check_str_time(tmp, &ull, o->is_seconds);
574 ret = check_str_bytes(tmp, &ull, data);
576 dprint(FD_PARSE, " ret=%d, out=%llu\n", ret, ull);
580 if (o->pow2 && !is_power_of_2(ull)) {
581 log_err("%s: must be a power-of-2\n", o->name);
585 if (o->maxval && ull > o->maxval) {
586 log_err("max value out of range: %llu"
587 " (%u max)\n", ull, o->maxval);
590 if (o->minval && ull < o->minval) {
591 log_err("min value out of range: %lld"
592 " (%d min)\n", ull, o->minval);
595 if (o->posval[0].ival) {
596 posval_sort(o, posval);
599 for (i = 0; i < PARSE_MAX_VP; i++) {
601 if (!vp->ival || vp->ival[0] == '\0')
603 if (vp->oval == ull) {
609 log_err("fio: value %llu not allowed:\n", ull);
610 show_option_values(o);
616 ret = fn(data, &ull);
618 if (o->type == FIO_OPT_INT) {
620 val_store(ilp, ull, o->off1, 0, data, o);
623 val_store(ilp, ull, o->off2, 0, data, o);
627 val_store(ilp, ull, o->off3, 0, data, o);
632 val_store(ilp, ull, o->off2, 0, data, o);
636 val_store(ilp, ull, o->off3, 0, data, o);
641 val_store(ullp, ull, o->off1, 0, data, o);
644 val_store(ullp, ull, o->off2, 0, data, o);
650 case FIO_OPT_FLOAT_LIST: {
655 ** Initialize precision to 0 and zero out list
656 ** in case specified list is shorter than default
660 ilp = td_var(data, o, o->off2);
664 flp = td_var(data, o, o->off1);
665 for(i = 0; i < o->maxlen; i++)
668 if (curr >= o->maxlen) {
669 log_err("the list exceeding max length %d\n",
673 if (!str_to_float(ptr, &uf, 0)) { /* this breaks if we ever have lists of times */
674 log_err("not a floating point value: %s\n", ptr);
677 if (o->minfp || o->maxfp) {
679 log_err("value out of range: %f"
680 " (range max: %f)\n", uf, o->maxfp);
684 log_err("value out of range: %f"
685 " (range min: %f)\n", uf, o->minfp);
690 flp = td_var(data, o, o->off1);
693 dprint(FD_PARSE, " out=%f\n", uf);
696 ** Calculate precision for output by counting
697 ** number of digits after period. Find first
698 ** period in entire remaining list each time
700 cp2 = strchr(ptr, '.');
704 while (*++cp2 != '\0' && *cp2 >= '0' && *cp2 <= '9')
708 ilp = td_var(data, o, o->off2);
716 case FIO_OPT_STR_STORE: {
717 fio_opt_str_fn *fn = o->cb;
723 cp = td_var(data, o, o->off1);
729 else if (o->posval[0].ival) {
730 posval_sort(o, posval);
733 for (i = 0; i < PARSE_MAX_VP; i++) {
735 if (!vp->ival || vp->ival[0] == '\0' || !cp)
738 if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) {
744 rest = strstr(*cp ?: ptr, ":");
758 show_option_values(o);
767 case FIO_OPT_RANGE: {
771 tmp[sizeof(tmp) - 1] = '\0';
772 strncpy(tmp, ptr, sizeof(tmp) - 1);
774 /* Handle bsrange with separate read,write values: */
775 p1 = strchr(tmp, ',');
779 p1 = strchr(tmp, '-');
781 p1 = strchr(tmp, ':');
793 if (!check_range_bytes(p1, &ul1, data) &&
794 !check_range_bytes(p2, &ul2, data)) {
797 unsigned long foo = ul1;
804 val_store(ilp, ul1, o->off1, 0, data, o);
805 val_store(ilp, ul2, o->off2, 0, data, o);
808 if (o->off3 && o->off4) {
809 val_store(ilp, ul1, o->off3, 0, data, o);
810 val_store(ilp, ul2, o->off4, 0, data, o);
814 if (o->off5 && o->off6) {
815 val_store(ilp, ul1, o->off5, 0, data, o);
816 val_store(ilp, ul2, o->off6, 0, data, o);
821 if (o->off3 && o->off4) {
822 val_store(ilp, ul1, o->off3, 0, data, o);
823 val_store(ilp, ul2, o->off4, 0, data, o);
827 if (o->off5 && o->off6) {
828 val_store(ilp, ul1, o->off5, 0, data, o);
829 val_store(ilp, ul2, o->off6, 0, data, o);
838 case FIO_OPT_STR_SET: {
839 fio_opt_int_fn *fn = o->cb;
842 ret = check_int(ptr, &il);
843 else if (o->type == FIO_OPT_BOOL)
848 dprint(FD_PARSE, " ret=%d, out=%d\n", ret, il);
853 if (o->maxval && il > (int) o->maxval) {
854 log_err("max value out of range: %d (%d max)\n",
858 if (o->minval && il < o->minval) {
859 log_err("min value out of range: %d (%d min)\n",
871 val_store(ilp, il, o->off1, 0, data, o);
874 val_store(ilp, il, o->off2, 0, data, o);
879 case FIO_OPT_DEPRECATED:
881 case FIO_OPT_SOFT_DEPRECATED:
882 log_info("Option %s is deprecated\n", o->name);
885 log_err("Bad option type %u\n", o->type);
893 ret = o->verify(o, data);
895 log_err("Correct format for offending option\n");
896 log_err("%20s: %s\n", o->name, o->help);
897 show_option_help(o, 1);
904 static int handle_option(const struct fio_option *o, const char *__ptr,
907 char *o_ptr, *ptr, *ptr2;
910 dprint(FD_PARSE, "handle_option=%s, ptr=%s\n", o->name, __ptr);
914 o_ptr = ptr = strdup(__ptr);
917 * See if we have another set of parameters, hidden after a comma.
918 * Do this before parsing this round, to check if we should
919 * copy set 1 options to set 2.
928 (o->type != FIO_OPT_STR_STORE) &&
929 (o->type != FIO_OPT_STR) &&
930 (o->type != FIO_OPT_FLOAT_LIST)) {
931 ptr2 = strchr(ptr, ',');
932 if (ptr2 && *(ptr2 + 1) == '\0')
934 if (o->type != FIO_OPT_STR_MULTI && o->type != FIO_OPT_RANGE) {
936 ptr2 = strchr(ptr, ':');
938 ptr2 = strchr(ptr, '-');
940 } else if (ptr && o->type == FIO_OPT_FLOAT_LIST) {
941 ptr2 = strchr(ptr, ':');
945 * Don't return early if parsing the first option fails - if
946 * we are doing multiple arguments, we can allow the first one
949 __ret = __handle_option(o, ptr, data, !done, !!ptr2, done);
965 struct fio_option *find_option(struct fio_option *options, const char *opt)
967 struct fio_option *o;
969 for (o = &options[0]; o->name; o++) {
970 if (!o_match(o, opt))
972 if (o->type == FIO_OPT_UNSUPPORTED) {
973 log_err("Option <%s>: %s\n", o->name, o->help);
983 const struct fio_option *
984 find_option_c(const struct fio_option *options, const char *opt)
986 return find_option((struct fio_option *)options, opt);
989 static const struct fio_option *
990 get_option(char *opt, const struct fio_option *options, char **post)
992 const struct fio_option *o;
995 ret = strchr(opt, '=');
1001 strip_blank_end(ret);
1002 o = find_option_c(options, ret);
1004 o = find_option_c(options, opt);
1011 static int opt_cmp(const void *p1, const void *p2)
1013 const struct fio_option *o;
1020 s = strdup(*((char **) p1));
1021 o = get_option(s, __fio_options, &foo);
1027 s = strdup(*((char **) p2));
1028 o = get_option(s, __fio_options, &foo);
1034 return prio2 - prio1;
1037 void sort_options(char **opts, const struct fio_option *options, int num_opts)
1039 __fio_options = options;
1040 qsort(opts, num_opts, sizeof(char *), opt_cmp);
1041 __fio_options = NULL;
1044 static void add_to_dump_list(const struct fio_option *o,
1045 struct flist_head *dump_list, const char *post)
1047 struct print_option *p;
1052 p = malloc(sizeof(*p));
1053 p->name = strdup(o->name);
1055 p->value = strdup(post);
1059 flist_add_tail(&p->list, dump_list);
1062 int parse_cmd_option(const char *opt, const char *val,
1063 const struct fio_option *options, void *data,
1064 struct flist_head *dump_list)
1066 const struct fio_option *o;
1068 o = find_option_c(options, opt);
1070 log_err("Bad option <%s>\n", opt);
1074 if (handle_option(o, val, data)) {
1075 log_err("fio: failed parsing %s=%s\n", opt, val);
1079 add_to_dump_list(o, dump_list, val);
1083 int parse_option(char *opt, const char *input, const struct fio_option *options,
1084 const struct fio_option **o, void *data,
1085 struct flist_head *dump_list)
1090 log_err("fio: failed parsing %s\n", input);
1095 *o = get_option(opt, options, &post);
1098 int len = strlen(opt);
1099 if (opt + len + 1 != post)
1100 memmove(opt + len + 1, post, strlen(post));
1106 if (handle_option(*o, post, data)) {
1107 log_err("fio: failed parsing %s\n", input);
1111 add_to_dump_list(*o, dump_list, post);
1116 * Option match, levenshtein distance. Handy for not quite remembering what
1117 * the option name is.
1119 int string_distance(const char *s1, const char *s2)
1121 unsigned int s1_len = strlen(s1);
1122 unsigned int s2_len = strlen(s2);
1123 unsigned int *p, *q, *r;
1126 p = malloc(sizeof(unsigned int) * (s2_len + 1));
1127 q = malloc(sizeof(unsigned int) * (s2_len + 1));
1130 for (i = 1; i <= s2_len; i++)
1131 p[i] = p[i - 1] + 1;
1133 for (i = 1; i <= s1_len; i++) {
1135 for (j = 1; j <= s2_len; j++) {
1136 unsigned int sub = p[j - 1];
1139 if (s1[i - 1] != s2[j - 1])
1142 pmin = min(q[j - 1] + 1, sub);
1143 q[j] = min(p[j] + 1, pmin);
1157 * Make a guess of whether the distance from 's1' is significant enough
1158 * to warrant printing the guess. We set this to a 1/2 match.
1160 int string_distance_ok(const char *opt, int distance)
1165 len = (len + 1) / 2;
1166 return distance <= len;
1169 static const struct fio_option *find_child(const struct fio_option *options,
1170 const struct fio_option *o)
1172 const struct fio_option *__o;
1174 for (__o = options + 1; __o->name; __o++)
1175 if (__o->parent && !strcmp(__o->parent, o->name))
1181 static void __print_option(const struct fio_option *o,
1182 const struct fio_option *org,
1194 p += sprintf(p, "%s", " ");
1196 sprintf(p, "%s", o->name);
1198 log_info("%-24s: %s\n", name, o->help);
1201 static void print_option(const struct fio_option *o)
1203 const struct fio_option *parent;
1204 const struct fio_option *__o;
1205 unsigned int printed;
1208 __print_option(o, NULL, 0);
1215 while ((__o = find_child(o, parent)) != NULL) {
1216 __print_option(__o, o, level);
1225 int show_cmd_help(const struct fio_option *options, const char *name)
1227 const struct fio_option *o, *closest;
1228 unsigned int best_dist = -1U;
1232 if (!name || !strcmp(name, "all"))
1237 for (o = &options[0]; o->name; o++) {
1240 if (o->type == FIO_OPT_DEPRECATED ||
1241 o->type == FIO_OPT_SOFT_DEPRECATED)
1243 if (!exec_profile && o->prof_name)
1245 if (exec_profile && !(o->prof_name && !strcmp(exec_profile, o->prof_name)))
1249 if (!strcmp(name, o->name) ||
1250 (o->alias && !strcmp(name, o->alias)))
1255 dist = string_distance(name, o->name);
1256 if (dist < best_dist) {
1263 if (show_all || match) {
1266 log_info("%20s: %s\n", o->name, o->help);
1277 show_option_help(o, 0);
1283 log_err("No such command: %s", name);
1286 * Only print an appropriately close option, one where the edit
1287 * distance isn't too big. Otherwise we get crazy matches.
1289 if (closest && best_dist < 3) {
1290 log_info(" - showing closest match\n");
1291 log_info("%20s: %s\n", closest->name, closest->help);
1292 show_option_help(closest, 0);
1300 * Handle parsing of default parameters.
1302 void fill_default_options(void *data, const struct fio_option *options)
1304 const struct fio_option *o;
1306 dprint(FD_PARSE, "filling default options\n");
1308 for (o = &options[0]; o->name; o++)
1310 handle_option(o, o->def, data);
1313 static void option_init(struct fio_option *o)
1315 if (o->type == FIO_OPT_DEPRECATED || o->type == FIO_OPT_UNSUPPORTED ||
1316 o->type == FIO_OPT_SOFT_DEPRECATED)
1318 if (o->name && !o->lname)
1319 log_err("Option %s: missing long option name\n", o->name);
1320 if (o->type == FIO_OPT_BOOL) {
1324 if (o->type == FIO_OPT_INT) {
1326 o->maxval = UINT_MAX;
1328 if (o->type == FIO_OPT_STR_SET && o->def && !o->no_warn_def) {
1329 log_err("Option %s: string set option with"
1330 " default will always be true\n", o->name);
1332 if (!o->cb && !o->off1)
1333 log_err("Option %s: neither cb nor offset given\n", o->name);
1335 log_info("Option %s: no category defined. Setting to misc\n", o->name);
1336 o->category = FIO_OPT_C_GENERAL;
1337 o->group = FIO_OPT_G_INVALID;
1339 if (o->type == FIO_OPT_STR || o->type == FIO_OPT_STR_STORE ||
1340 o->type == FIO_OPT_STR_MULTI)
1345 * Sanitize the options structure. For now it just sets min/max for bool
1346 * values and whether both callback and offsets are given.
1348 void options_init(struct fio_option *options)
1350 struct fio_option *o;
1352 dprint(FD_PARSE, "init options\n");
1354 for (o = &options[0]; o->name; o++) {
1357 o->inv_opt = find_option(options, o->inverse);
1361 void options_mem_dupe(const struct fio_option *options, void *data)
1363 const struct fio_option *o;
1366 dprint(FD_PARSE, "dup options\n");
1368 for (o = &options[0]; o->name; o++) {
1369 if (o->type != FIO_OPT_STR_STORE)
1372 ptr = td_var(data, o, o->off1);
1374 *ptr = strdup(*ptr);
1378 void options_free(const struct fio_option *options, void *data)
1380 const struct fio_option *o;
1383 dprint(FD_PARSE, "free options\n");
1385 for (o = &options[0]; o->name; o++) {
1386 if (o->type != FIO_OPT_STR_STORE || !o->off1 || o->no_free)
1389 ptr = td_var(data, o, o->off1);