summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-05-06 14:15:35 -0600
committerJens Axboe <axboe@fb.com>2015-05-06 14:15:35 -0600
commit0f38bbef532ef9da0d43382dca58a20e57c63dc1 (patch)
tree3f59105701d759277cbccde9e2aad301777f2508 /parse.c
parent92330695e64a42fd5dc54a6970a4b8122d3cd80e (diff)
downloadfio-0f38bbef532ef9da0d43382dca58a20e57c63dc1.tar.gz
fio-0f38bbef532ef9da0d43382dca58a20e57c63dc1.tar.bz2
Add support for options being a power-of-2
Split out the is_power_of_2() from fio.h and make it independent. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 7912212e..745056bd 100644
--- a/parse.c
+++ b/parse.c
@@ -17,6 +17,7 @@
#include "options.h"
#include "minmax.h"
#include "lib/ieee754.h"
+#include "lib/pow2.h"
#ifdef CONFIG_ARITHMETIC
#include "y.tab.h"
@@ -521,6 +522,10 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
if (ret)
break;
+ if (o->pow2 && !is_power_of_2(ull)) {
+ log_err("%s: must be a power-of-2\n", o->name);
+ return 1;
+ }
if (o->maxval && ull > o->maxval) {
log_err("max value out of range: %llu"