projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for options being a power-of-2
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index e70ed20bda7e64b3727e93cacad71de65148862b..745056bdc8186e54743d2fb688df926084c91853 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-17,6
+17,7
@@
#include "options.h"
#include "minmax.h"
#include "lib/ieee754.h"
#include "options.h"
#include "minmax.h"
#include "lib/ieee754.h"
+#include "lib/pow2.h"
#ifdef CONFIG_ARITHMETIC
#include "y.tab.h"
#ifdef CONFIG_ARITHMETIC
#include "y.tab.h"
@@
-506,6
+507,7
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
if (!is_time && o->is_time)
is_time = o->is_time;
if (!is_time && o->is_time)
is_time = o->is_time;
+ tmp[sizeof(tmp) - 1] = '\0';
strncpy(tmp, ptr, sizeof(tmp) - 1);
p = strchr(tmp, ',');
if (p)
strncpy(tmp, ptr, sizeof(tmp) - 1);
p = strchr(tmp, ',');
if (p)
@@
-520,6
+522,10
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
if (ret)
break;
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"
if (o->maxval && ull > o->maxval) {
log_err("max value out of range: %llu"
@@
-705,6
+711,7
@@
static int __handle_option(struct fio_option *o, const char *ptr, void *data,
char tmp[128];
char *p1, *p2;
char tmp[128];
char *p1, *p2;
+ tmp[sizeof(tmp) - 1] = '\0';
strncpy(tmp, ptr, sizeof(tmp) - 1);
/* Handle bsrange with separate read,write values: */
strncpy(tmp, ptr, sizeof(tmp) - 1);
/* Handle bsrange with separate read,write values: */