+ fio_md5_init(&md5_ctx);
+ fio_md5_update(&md5_ctx, p, len);
+}
+
+static void populate_hdr(struct thread_data *td, struct io_u *io_u,
+ struct verify_header *hdr, unsigned int header_num,
+ unsigned int header_len)
+{
+ unsigned int data_len;
+ void *data, *p;
+
+ p = (void *) hdr;
+
+ hdr->magic = FIO_HDR_MAGIC;
+ hdr->verify_type = td->o.verify;
+ hdr->len = header_len;
+ hdr->rand_seed = io_u->rand_seed;
+ hdr->crc32 = fio_crc32c(p, offsetof(struct verify_header, crc32));
+
+ data_len = header_len - hdr_size(hdr);
+
+ data = p + hdr_size(hdr);
+ switch (td->o.verify) {
+ case VERIFY_MD5:
+ dprint(FD_VERIFY, "fill md5 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_md5(hdr, data, data_len);
+ break;
+ case VERIFY_CRC64:
+ dprint(FD_VERIFY, "fill crc64 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_crc64(hdr, data, data_len);
+ break;
+ case VERIFY_CRC32C:
+ case VERIFY_CRC32C_INTEL:
+ dprint(FD_VERIFY, "fill crc32c io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_crc32c(hdr, data, data_len);
+ break;
+ case VERIFY_CRC32:
+ dprint(FD_VERIFY, "fill crc32 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_crc32(hdr, data, data_len);
+ break;
+ case VERIFY_CRC16:
+ dprint(FD_VERIFY, "fill crc16 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_crc16(hdr, data, data_len);
+ break;
+ case VERIFY_CRC7:
+ dprint(FD_VERIFY, "fill crc7 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_crc7(hdr, data, data_len);
+ break;
+ case VERIFY_SHA256:
+ dprint(FD_VERIFY, "fill sha256 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_sha256(hdr, data, data_len);
+ break;
+ case VERIFY_SHA512:
+ dprint(FD_VERIFY, "fill sha512 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_sha512(hdr, data, data_len);
+ break;
+ case VERIFY_META:
+ dprint(FD_VERIFY, "fill meta io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_meta(hdr, td, io_u, header_num);
+ break;
+ case VERIFY_SHA1:
+ dprint(FD_VERIFY, "fill sha1 io_u %p, len %u\n",
+ io_u, hdr->len);
+ fill_sha1(hdr, data, data_len);
+ break;
+ case VERIFY_PATTERN:
+ /* nothing to do here */
+ break;
+ default:
+ log_err("fio: bad verify type: %d\n", td->o.verify);
+ assert(0);
+ }
+ if (td->o.verify_offset)
+ memswp(p, p + td->o.verify_offset, hdr_size(hdr));