projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
poll: break on EINTR without complaining
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index efb5e3d0d9228a68606dda3cb312040943095620..239e37141c0fb5be468d9f841844c0ca4c64ba19 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-26,14
+26,11
@@
static int vp_cmp(const void *p1, const void *p2)
return strlen(vp2->ival) - strlen(vp1->ival);
}
return strlen(vp2->ival) - strlen(vp1->ival);
}
-static
int
posval_sort(struct fio_option *o, struct value_pair *vpmap)
+static
void
posval_sort(struct fio_option *o, struct value_pair *vpmap)
{
const struct value_pair *vp;
int entries;
{
const struct value_pair *vp;
int entries;
- if (!o->posval[0].ival)
- return 0;
-
memset(vpmap, 0, PARSE_MAX_VP * sizeof(struct value_pair));
for (entries = 0; entries < PARSE_MAX_VP; entries++) {
memset(vpmap, 0, PARSE_MAX_VP * sizeof(struct value_pair));
for (entries = 0; entries < PARSE_MAX_VP; entries++) {
@@
-45,7
+42,6
@@
static int posval_sort(struct fio_option *o, struct value_pair *vpmap)
}
qsort(vpmap, entries, sizeof(struct value_pair), vp_cmp);
}
qsort(vpmap, entries, sizeof(struct value_pair), vp_cmp);
- return 1;
}
static void show_option_range(struct fio_option *o, FILE *out)
}
static void show_option_range(struct fio_option *o, FILE *out)
@@
-191,16
+187,19
@@
static unsigned long long get_mult_bytes(const char *str, int len, void *data,
int *percent)
{
const char *p = str;
int *percent)
{
const char *p = str;
+ int digit_seen = 0;
if (len < 2)
return __get_mult_bytes(str, data, percent);
/*
if (len < 2)
return __get_mult_bytes(str, data, percent);
/*
- * Go forward until we hit a non-digit
+ * Go forward until we hit a non-digit
, or +/- sign
*/
while ((p - str) <= len) {
*/
while ((p - str) <= len) {
- if (!isdigit((int) *p))
+ if (!isdigit((int) *p) &&
+ (((*p != '+') && (*p != '-')) || digit_seen))
break;
break;
+ digit_seen |= isdigit((int) *p);
p++;
}
p++;
}
@@
-491,17
+490,11
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
case FIO_OPT_STR_STORE: {
fio_opt_str_fn *fn = o->cb;
case FIO_OPT_STR_STORE: {
fio_opt_str_fn *fn = o->cb;
- if (!posval_sort(o, posval)) {
- if (o->roff1)
- cp = (char **) o->roff1;
- else
- cp = td_var(data, o->off1);
- *cp = strdup(ptr);
-
- if (fn)
- ret = fn(data, ptr);
+ posval_sort(o, posval);
- return ret;
+ if (!o->posval[0].ival) {
+ vp = NULL;
+ goto match;
}
ret = 1;
}
ret = 1;
@@
-516,6
+509,7
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
ret = 0;
if (vp->cb)
fn = vp->cb;
ret = 0;
if (vp->cb)
fn = vp->cb;
+match:
if (o->roff1)
cp = (char **) o->roff1;
else
if (o->roff1)
cp = (char **) o->roff1;
else
@@
-525,7
+519,7
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
if (rest) {
*rest = '\0';
ptr = rest + 1;
if (rest) {
*rest = '\0';
ptr = rest + 1;
- } else
+ } else
if (vp && vp->cb)
ptr = NULL;
break;
}
ptr = NULL;
break;
}