fio: allow arithmetic expressions to be used in job files
authorStephen M. Cameron <stephenmcameron@gmail.com>
Mon, 29 Sep 2014 18:10:49 +0000 (12:10 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 29 Sep 2014 18:18:33 +0000 (12:18 -0600)
commitb470a02cade02049509d22442addfbc88d10116e
tree24cee0fe610335c4aa90ef97dee9d6a86ef31f83
parent423adcc7a434abbae0547f9bed78d62f0060bac9
fio: allow arithmetic expressions to be used in job files

However, the arithmetic expressions must be enclosed in parentheses.
That is not a hard requirement, I just did it that way to enable the old
code to be used for the existing job files, to reduce risk of breaking
something that previously worked.

Known issues:

1) if overflow or underflow occurs during the evaluation of arithmetic
expressions, it is not detected.  Likewise, detection of floating point
divide by zero is a bit iffy.  Calculations are carried out both as long
longs and as integers.  If at any point, a double precision floating
point value is used, floating point values are used, and for the final
long long calculation the double is cast to a long long.

There may be other numeric subtleties lurking as well.  These kind of
things are why I require the parentheses to invoke the arithmetic
processing.

2) I made no effort to work this code into the autoconf system.  Have no
idea how to do that, esp. with lex and yacc involved in this.

3) Suffixes (k, M, GiB, etc.) do not work with expressions.  It is
probably not very difficult to fix this.

Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Modified by me to make configure auto-detect presence of yacc/lex and
enable the arithmetic only if those conditions are met. Also got rid
of the Makefile in exp/ and added the targets to the general Makefile,
since this makes it easier to do properly.

Signed-off-by: Jens Axboe <axboe@fb.com>
Makefile
configure
exp/README.md [new file with mode: 0644]
exp/expression-parser.l [new file with mode: 0644]
exp/expression-parser.y [new file with mode: 0644]
exp/fixup-buggy-yacc-output.c [new file with mode: 0644]
exp/test-expression-parser.c [new file with mode: 0644]
fio.1
parse.c