Fix parsing of ioengine strings
authorSteven Lang <tirea@google.com>
Wed, 16 Nov 2011 09:33:51 +0000 (10:33 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 Nov 2011 09:33:51 +0000 (10:33 +0100)
commit184b4098cccb8392eb8ecdd23cdc6597b540df36
tree06b4d51557a2844832976e2e82a41dbba986343d
parent468a9476c27142fbb9be64ae1d570254125d16cc
Fix parsing of ioengine strings

This cleans up parsing of FIO_OPT_STR_STORE options which have defined
values (IE ioengine).  I made a few assumptions here...

1. If FIO_OPT_STR_STORE was used, that means a copy of the string is
desired, so it is always copied if the offset is non-zero.
2. If the values were the only allowed values, then FIO_OPT_STR would
have been used; therefore it is not an error to give a value not in
the list.
3. If an option callback is defined, then any values are ignored and
the callback is called to parse the string.  (Don't think this
currently applies, anywhere, but there is precendent in other options
skipping normal parsing if a callback is used.)
4. If no offsets are defined, and no callback is given, the behavior
is undefined - though this patch handles it cleanly and still calls
value callbacks; though I believe fio will still complain about a bad
options structure.

This fixes two cases (Restores it to previous behavior without
breaking new functionality).
1. External ioengines (The patch to a .so is never in the list of
possible values, so was never matching)
2. IO engines compiled in but not in the list in options.c

This patch should be applied to the 1.5x stable branch as well, though
it doesn't apply cleanly due to one line difference from my last
options patch.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
parse.c