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>
9 files changed