Merge branch 'master' of git://github.com/DaveGlen/fio
[fio.git] / options.c
index 96b8b682f1724ce44c7413c7aaa1eabfebe37eca..ed5d37e45c9c83abef8df6d677257e2a8b0aaf88 100644 (file)
--- a/options.c
+++ b/options.c
@@ -917,7 +917,7 @@ static int str_opendir_cb(void *data, const char fio_unused *str)
 static int pattern_cb(char *pattern, unsigned int max_size,
                      const char *input, unsigned int *pattern_bytes)
 {
-       long off;
+       long off = 0;
        int i = 0, j = 0, len, k, base = 10;
        uint32_t pattern_length;
        char *loc1, *loc2;
@@ -983,6 +983,8 @@ static int pattern_cb(char *pattern, unsigned int max_size,
         */
 fill:
        pattern_length = i;
+       if (!i && !off)
+               i = 1;
        while (i > 1 && i * 2 <= max_size) {
                memcpy(&pattern[i], &pattern[0], i);
                i *= 2;
@@ -1062,7 +1064,7 @@ static int str_verify_pattern_cb(void *data, const char *input)
        /*
         * VERIFY_META could already be set
         */
-       if (!ret && td->o.verify == VERIFY_NONE)
+       if (!ret && !fio_option_is_set(&td->o, verify))
                td->o.verify = VERIFY_PATTERN;
 
        return ret;
@@ -2400,6 +2402,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .oval = VERIFY_META,
                            .help = "Use io information",
                          },
+                         { .ival = "pattern",
+                           .oval = VERIFY_PATTERN_NO_HDR,
+                           .help = "Verify strict pattern",
+                         },
                          {
                            .ival = "null",
                            .oval = VERIFY_NULL,
@@ -4359,7 +4365,7 @@ static int opt_is_set(struct thread_options *o, struct fio_option *opt)
        opt_off = opt - &fio_options[0];
        index = opt_off / (8 * sizeof(uint64_t));
        offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
-       return (o->set_options[index] & (1UL << offset)) != 0;
+       return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
 }
 
 int __fio_option_is_set(struct thread_options *o, unsigned int off1)
@@ -4384,5 +4390,5 @@ void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
        opt_off = opt - &fio_options[0];
        index = opt_off / (8 * sizeof(uint64_t));
        offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
-       o->set_options[index] |= 1UL << offset;
+       o->set_options[index] |= (uint64_t)1 << offset;
 }