X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=parse.c;h=e09b1bbe42998655125d23b00c3b0b7d35214489;hp=21fb3c2eeda611fd6ab1b43010ec5c36f868fbc3;hb=af52b3455ad892322aab2791282b6bd4efdfdbf3;hpb=6612a27b284aec20c137e3e6b267685b8a4c824c;ds=inline diff --git a/parse.c b/parse.c index 21fb3c2e..e09b1bbe 100644 --- a/parse.c +++ b/parse.c @@ -257,10 +257,20 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, } break; } - case FIO_OPT_STR_STORE: + case FIO_OPT_STR_STORE: { + fio_opt_str_fn *fn = o->cb; + cp = td_var(data, o->off1); *cp = strdup(ptr); + if (fn) { + ret = fn(data, ptr); + if (ret) { + free(*cp); + *cp = NULL; + } + } break; + } case FIO_OPT_RANGE: { char tmp[128]; char *p1, *p2; @@ -579,7 +589,7 @@ void options_init(struct fio_option *options) } if (!o->cb && !o->off1) fprintf(stderr, "Option %s: neither cb nor offset given\n", o->name); - if (o->type == FIO_OPT_STR) + if (o->type == FIO_OPT_STR || o->type == FIO_OPT_STR_STORE) continue; if (o->cb && (o->off1 || o->off2 || o->off3 || o->off4)) fprintf(stderr, "Option %s: both cb and offset given\n", o->name);