+static int str_verify_offset_cb(void *data, unsigned int *off)
+{
+ struct thread_data *td = data;
+
+ if (*off && *off < sizeof(struct verify_header)) {
+ log_err("fio: verify_offset too small\n");
+ return 1;
+ }
+
+ td->o.verify_offset = *off;
+ return 0;
+}
+
+static int str_verify_cb(void *data, const char *mem)
+{
+ struct thread_data *td = data;
+ unsigned int nr, msb;
+ char *pat;
+
+ if (td->o.verify != VERIFY_PATTERN)
+ return 0;
+
+ pat = get_opt_postfix(mem);
+ if (!pat) {
+ log_err("fio: missing pattern\n");
+ return 1;
+ }
+
+ if (strstr(pat, "0x") || strstr(pat, "0X"))
+ nr = strtol(pat, NULL, 16);
+ else
+ nr = strtol(pat, NULL, 16);
+
+ msb = fls(nr);
+ if (msb <= 8)
+ td->o.verify_pattern_bytes = 1;
+ else if (msb <= 16)
+ td->o.verify_pattern_bytes = 2;
+ else if (msb <= 24)
+ td->o.verify_pattern_bytes = 3;
+ else
+ td->o.verify_pattern_bytes = 4;
+
+ td->o.verify_pattern = nr;
+ return 0;
+}