projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gfio: correctly input stored FIO_OPT_STR_STORE options
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index 6ea7c103c0973a259ec6227355161e5139a63025..9891974d57bca8bd62752f78e421a8b6978d62f3 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-15,7
+15,7
@@
#include "debug.h"
#include "options.h"
#include "debug.h"
#include "options.h"
-static struct fio_option *fio_options;
+static struct fio_option *
__
fio_options;
extern unsigned int fio_get_kb_base(void *);
static int vp_cmp(const void *p1, const void *p2)
extern unsigned int fio_get_kb_base(void *);
static int vp_cmp(const void *p1, const void *p2)
@@
-153,32
+153,32
@@
static unsigned long long __get_mult_bytes(const char *p, void *data,
for (i = 0; i < strlen(c); i++)
c[i] = tolower(c[i]);
for (i = 0; i < strlen(c); i++)
c[i] = tolower(c[i]);
- if (!str
cmp("pib", c
)) {
+ if (!str
ncmp("pib", c, 3
)) {
pow = 5;
mult = 1000;
pow = 5;
mult = 1000;
- } else if (!str
cmp("tib", c
)) {
+ } else if (!str
ncmp("tib", c, 3
)) {
pow = 4;
mult = 1000;
pow = 4;
mult = 1000;
- } else if (!str
cmp("gib", c
)) {
+ } else if (!str
ncmp("gib", c, 3
)) {
pow = 3;
mult = 1000;
pow = 3;
mult = 1000;
- } else if (!str
cmp("mib", c
)) {
+ } else if (!str
ncmp("mib", c, 3
)) {
pow = 2;
mult = 1000;
pow = 2;
mult = 1000;
- } else if (!str
cmp("kib", c
)) {
+ } else if (!str
ncmp("kib", c, 3
)) {
pow = 1;
mult = 1000;
pow = 1;
mult = 1000;
- } else if (!str
cmp("p", c) || !strcmp("pb", c
))
+ } else if (!str
ncmp("p", c, 1) || !strncmp("pb", c, 2
))
pow = 5;
pow = 5;
- else if (!str
cmp("t", c) || !strcmp("tb", c
))
+ else if (!str
ncmp("t", c, 1) || !strncmp("tb", c, 2
))
pow = 4;
pow = 4;
- else if (!str
cmp("g", c) || !strcmp("gb", c
))
+ else if (!str
ncmp("g", c, 1) || !strncmp("gb", c, 2
))
pow = 3;
pow = 3;
- else if (!str
cmp("m", c) || !strcmp("mb", c
))
+ else if (!str
ncmp("m", c, 1) || !strncmp("mb", c, 2
))
pow = 2;
pow = 2;
- else if (!str
cmp("k", c) || !strcmp("kb", c
))
+ else if (!str
ncmp("k", c, 1) || !strncmp("kb", c, 2
))
pow = 1;
pow = 1;
- else if (!str
cmp("%", c
)) {
+ else if (!str
ncmp("%", c, 1
)) {
*percent = 1;
free(c);
return ret;
*percent = 1;
free(c);
return ret;
@@
-220,7
+220,7
@@
static unsigned long long get_mult_bytes(const char *str, int len, void *data,
/*
* Convert string into a floating number. Return 1 for success and 0 otherwise.
*/
/*
* Convert string into a floating number. Return 1 for success and 0 otherwise.
*/
-int str_to_float(const char *str, double *val)
+
static
int str_to_float(const char *str, double *val)
{
return (1 == sscanf(str, "%lf", val));
}
{
return (1 == sscanf(str, "%lf", val));
}
@@
-260,7
+260,7
@@
int str_to_decimal(const char *str, long long *val, int kilo, void *data)
return 0;
}
return 0;
}
-
static
int check_str_bytes(const char *p, long long *val, void *data)
+int check_str_bytes(const char *p, long long *val, void *data)
{
return str_to_decimal(p, val, 1, data);
}
{
return str_to_decimal(p, val, 1, data);
}
@@
-770,14
+770,14
@@
static int opt_cmp(const void *p1, const void *p2)
if (*(char **)p1) {
s = strdup(*((char **) p1));
if (*(char **)p1) {
s = strdup(*((char **) p1));
- o = get_option(s, fio_options, &foo);
+ o = get_option(s,
__
fio_options, &foo);
if (o)
prio1 = o->prio;
free(s);
}
if (*(char **)p2) {
s = strdup(*((char **) p2));
if (o)
prio1 = o->prio;
free(s);
}
if (*(char **)p2) {
s = strdup(*((char **) p2));
- o = get_option(s, fio_options, &foo);
+ o = get_option(s,
__
fio_options, &foo);
if (o)
prio2 = o->prio;
free(s);
if (o)
prio2 = o->prio;
free(s);
@@
-788,9
+788,9
@@
static int opt_cmp(const void *p1, const void *p2)
void sort_options(char **opts, struct fio_option *options, int num_opts)
{
void sort_options(char **opts, struct fio_option *options, int num_opts)
{
- fio_options = options;
+
__
fio_options = options;
qsort(opts, num_opts, sizeof(char *), opt_cmp);
qsort(opts, num_opts, sizeof(char *), opt_cmp);
- fio_options = NULL;
+
__
fio_options = NULL;
}
int parse_cmd_option(const char *opt, const char *val,
}
int parse_cmd_option(const char *opt, const char *val,