X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=parse.c;h=7dc5fcc869ff05b21accb95257bb4fa473d188f3;hp=d653f5e489458236a6d441a1157fab15396314ed;hb=5bfc35d7abe2582dc54127ca1d6e03792c9d62f5;hpb=853ee7fc686293cd45fbb177c75114ed2489144d diff --git a/parse.c b/parse.c index d653f5e4..7dc5fcc8 100644 --- a/parse.c +++ b/parse.c @@ -112,13 +112,18 @@ static unsigned long get_mult_bytes(char c) */ int str_to_decimal(const char *str, long long *val, int kilo) { - int len; + int len, base; len = strlen(str); if (!len) return 1; - *val = strtoll(str, NULL, 10); + if (strstr(str, "0x") || strstr(str, "0X")) + base = 16; + else + base = 10; + + *val = strtoll(str, NULL, base); if (*val == LONG_MAX && errno == ERANGE) return 1; @@ -272,6 +277,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, } case FIO_OPT_STR_VAL_TIME: is_time = 1; + case FIO_OPT_INT: case FIO_OPT_STR_VAL: case FIO_OPT_STR_VAL_INT: { fio_opt_str_val_fn *fn = o->cb; @@ -298,7 +304,8 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, if (fn) ret = fn(data, &ull); else { - if (o->type == FIO_OPT_STR_VAL_INT) { + if (o->type == FIO_OPT_STR_VAL_INT || + o->type == FIO_OPT_INT) { if (first) val_store(ilp, ull, o->off1, data); if (!more && o->off2) @@ -368,7 +375,6 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, break; } - case FIO_OPT_INT: case FIO_OPT_BOOL: { fio_opt_int_fn *fn = o->cb;