projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixup some of the time (usec) based conversions
[fio.git]
/
exp
/
expression-parser.l
diff --git
a/exp/expression-parser.l
b/exp/expression-parser.l
index 856596acfa21aee603f0dc81fba70b7ca5ee03af..50bd38320bbaedc2eec487d0e8d09b95d95faa7b 100644
(file)
--- a/
exp/expression-parser.l
+++ b/
exp/expression-parser.l
@@
-42,6
+42,9
@@
extern int yyerror(long long *result, double *dresult,
static void __attribute__((unused)) yyunput(int c, char *buf_ptr);
static int __attribute__((unused)) input(void);
static void __attribute__((unused)) yyunput(int c, char *buf_ptr);
static int __attribute__((unused)) input(void);
+/* set by parser -- this is another thing which makes the parser thread-unsafe :(. */
+int lexer_value_is_time = 0; /* for determining if "m" suffix means mega- or minutes */
+
#define set_suffix_value(yylval, i_val, d_val, has_d_val) \
(yylval).v.dval = (d_val); \
(yylval).v.ival = (i_val); \
#define set_suffix_value(yylval, i_val, d_val, has_d_val) \
(yylval).v.dval = (d_val); \
(yylval).v.ival = (i_val); \
@@
-57,7
+60,7
@@
static int __attribute__((unused)) input(void);
set_suffix_value(yylval, 1024, 1024.0, 0);
return SUFFIX;
}
set_suffix_value(yylval, 1024, 1024.0, 0);
return SUFFIX;
}
-[Mm]
|[Mm][bB]
{
+[Mm]
[bB]
{
set_suffix_value(yylval, 1024 * 1024, 1024.0 * 1024.0, 0);
return SUFFIX;
}
set_suffix_value(yylval, 1024 * 1024, 1024.0 * 1024.0, 0);
return SUFFIX;
}
@@
-103,6
+106,14
@@
static int __attribute__((unused)) input(void);
set_suffix_value(yylval, 1000000LL, 1000000.0 , 0);
return SUFFIX;
}
set_suffix_value(yylval, 1000000LL, 1000000.0 , 0);
return SUFFIX;
}
+[mM] {
+ if (!lexer_value_is_time) {
+ set_suffix_value(yylval, 1024 * 1024, 1024.0 * 1024.0, 0);
+ } else {
+ set_suffix_value(yylval, 60LL * 1000000LL, 60.0 * 1000000.0, 0);
+ }
+ return SUFFIX;
+ }
[dD] {
set_suffix_value(yylval, 60LL * 60LL * 24LL * 1000000LL,
60.0 * 60.0 * 24.0 * 1000000.0, 0);
[dD] {
set_suffix_value(yylval, 60LL * 60LL * 24LL * 1000000LL,
60.0 * 60.0 * 24.0 * 1000000.0, 0);