Lines Matching refs:hdr

29 			 struct verify_header *hdr, unsigned int header_num,
106 struct verify_header *hdr;
114 hdr = p;
115 populate_hdr(td, io_u, hdr, header_num, hdr_inc);
196 static inline unsigned int hdr_size(struct verify_header *hdr)
198 return __hdr_size(hdr->verify_type);
201 static void *hdr_priv(struct verify_header *hdr)
203 void *priv = hdr;
283 static void dump_verify_buffers(struct verify_header *hdr, struct vcont *vc)
297 hdr_offset = vc->hdr_num * hdr->len;
299 dump_buf(io_u->buf + hdr_offset, hdr->len, io_u->offset + hdr_offset,
308 dummy.rand_seed = hdr->rand_seed;
312 fill_pattern_headers(td, &dummy, hdr->rand_seed, 1);
314 dump_buf(buf + hdr_offset, hdr->len, io_u->offset + hdr_offset,
319 static void log_verify_failure(struct verify_header *hdr, struct vcont *vc)
324 offset += vc->hdr_num * hdr->len;
326 vc->name, vc->io_u->file->file_name, offset, hdr->len);
335 dump_verify_buffers(hdr, vc);
341 static inline void *io_u_verify_off(struct verify_header *hdr, struct vcont *vc)
343 return vc->io_u->buf + vc->hdr_num * hdr->len + hdr_size(hdr);
346 static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc)
358 buf = (void *) hdr + header_size;
380 dump_verify_buffers(hdr, vc);
391 static int verify_io_u_meta(struct verify_header *hdr, struct vcont *vc)
394 struct vhdr_meta *vh = hdr_priv(hdr);
398 dprint(FD_VERIFY, "meta verify io_u %p, len %u\n", io_u, hdr->len);
404 ret |= verify_io_u_pattern(hdr, vc);
423 log_verify_failure(hdr, vc);
427 static int verify_io_u_xxhash(struct verify_header *hdr, struct vcont *vc)
429 void *p = io_u_verify_off(hdr, vc);
430 struct vhdr_xxhash *vh = hdr_priv(hdr);
434 dprint(FD_VERIFY, "xxhash verify io_u %p, len %u\n", vc->io_u, hdr->len);
437 XXH32_update(state, p, hdr->len - hdr_size(hdr));
447 log_verify_failure(hdr, vc);
451 static int verify_io_u_sha512(struct verify_header *hdr, struct vcont *vc)
453 void *p = io_u_verify_off(hdr, vc);
454 struct vhdr_sha512 *vh = hdr_priv(hdr);
460 dprint(FD_VERIFY, "sha512 verify io_u %p, len %u\n", vc->io_u, hdr->len);
463 fio_sha512_update(&sha512_ctx, p, hdr->len - hdr_size(hdr));
472 log_verify_failure(hdr, vc);
476 static int verify_io_u_sha256(struct verify_header *hdr, struct vcont *vc)
478 void *p = io_u_verify_off(hdr, vc);
479 struct vhdr_sha256 *vh = hdr_priv(hdr);
485 dprint(FD_VERIFY, "sha256 verify io_u %p, len %u\n", vc->io_u, hdr->len);
488 fio_sha256_update(&sha256_ctx, p, hdr->len - hdr_size(hdr));
497 log_verify_failure(hdr, vc);
501 static int verify_io_u_sha1(struct verify_header *hdr, struct vcont *vc)
503 void *p = io_u_verify_off(hdr, vc);
504 struct vhdr_sha1 *vh = hdr_priv(hdr);
510 dprint(FD_VERIFY, "sha1 verify io_u %p, len %u\n", vc->io_u, hdr->len);
513 fio_sha1_update(&sha1_ctx, p, hdr->len - hdr_size(hdr));
522 log_verify_failure(hdr, vc);
526 static int verify_io_u_crc7(struct verify_header *hdr, struct vcont *vc)
528 void *p = io_u_verify_off(hdr, vc);
529 struct vhdr_crc7 *vh = hdr_priv(hdr);
532 dprint(FD_VERIFY, "crc7 verify io_u %p, len %u\n", vc->io_u, hdr->len);
534 c = fio_crc7(p, hdr->len - hdr_size(hdr));
543 log_verify_failure(hdr, vc);
547 static int verify_io_u_crc16(struct verify_header *hdr, struct vcont *vc)
549 void *p = io_u_verify_off(hdr, vc);
550 struct vhdr_crc16 *vh = hdr_priv(hdr);
553 dprint(FD_VERIFY, "crc16 verify io_u %p, len %u\n", vc->io_u, hdr->len);
555 c = fio_crc16(p, hdr->len - hdr_size(hdr));
564 log_verify_failure(hdr, vc);
568 static int verify_io_u_crc64(struct verify_header *hdr, struct vcont *vc)
570 void *p = io_u_verify_off(hdr, vc);
571 struct vhdr_crc64 *vh = hdr_priv(hdr);
574 dprint(FD_VERIFY, "crc64 verify io_u %p, len %u\n", vc->io_u, hdr->len);
576 c = fio_crc64(p, hdr->len - hdr_size(hdr));
585 log_verify_failure(hdr, vc);
589 static int verify_io_u_crc32(struct verify_header *hdr, struct vcont *vc)
591 void *p = io_u_verify_off(hdr, vc);
592 struct vhdr_crc32 *vh = hdr_priv(hdr);
595 dprint(FD_VERIFY, "crc32 verify io_u %p, len %u\n", vc->io_u, hdr->len);
597 c = fio_crc32(p, hdr->len - hdr_size(hdr));
606 log_verify_failure(hdr, vc);
610 static int verify_io_u_crc32c(struct verify_header *hdr, struct vcont *vc)
612 void *p = io_u_verify_off(hdr, vc);
613 struct vhdr_crc32 *vh = hdr_priv(hdr);
616 dprint(FD_VERIFY, "crc32c verify io_u %p, len %u\n", vc->io_u, hdr->len);
618 c = fio_crc32c(p, hdr->len - hdr_size(hdr));
627 log_verify_failure(hdr, vc);
631 static int verify_io_u_md5(struct verify_header *hdr, struct vcont *vc)
633 void *p = io_u_verify_off(hdr, vc);
634 struct vhdr_md5 *vh = hdr_priv(hdr);
640 dprint(FD_VERIFY, "md5 verify io_u %p, len %u\n", vc->io_u, hdr->len);
643 fio_md5_update(&md5_ctx, p, hdr->len - hdr_size(hdr));
652 log_verify_failure(hdr, vc);
712 static int verify_header(struct io_u *io_u, struct verify_header *hdr)
714 void *p = hdr;
717 if (hdr->magic != FIO_HDR_MAGIC)
719 if (hdr->len > io_u->buflen)
721 if (hdr->rand_seed != io_u->rand_seed)
725 if (crc == hdr->crc32)
727 log_err("fio: verify header crc %x, calculated %x\n", hdr->crc32, crc);
733 struct verify_header *hdr;
763 hdr = p;
770 io_u->rand_seed = hdr->rand_seed;
772 ret = verify_header(io_u, hdr);
779 hdr->magic, FIO_HDR_MAGIC,
781 io_u->offset + hdr_num * hdr->len, hdr->len);
786 "> %lu)\n", hdr->len, io_u->buflen);
793 hdr->rand_seed, io_u->rand_seed,
795 io_u->offset + hdr_num * hdr->len, hdr->len);
805 io_u->offset + hdr_num * hdr->len, hdr->len);
812 verify_type = hdr->verify_type;
816 ret = verify_io_u_md5(hdr, &vc);
819 ret = verify_io_u_crc64(hdr, &vc);
823 ret = verify_io_u_crc32c(hdr, &vc);
826 ret = verify_io_u_crc32(hdr, &vc);
829 ret = verify_io_u_crc16(hdr, &vc);
832 ret = verify_io_u_crc7(hdr, &vc);
835 ret = verify_io_u_sha256(hdr, &vc);
838 ret = verify_io_u_sha512(hdr, &vc);
841 ret = verify_io_u_xxhash(hdr, &vc);
844 ret = verify_io_u_meta(hdr, &vc);
847 ret = verify_io_u_sha1(hdr, &vc);
850 ret = verify_io_u_pattern(hdr, &vc);
853 log_err("Bad verify type %u\n", hdr->verify_type);
857 if (ret && verify_type != hdr->verify_type)
859 hdr->verify_type, verify_type);
869 static void fill_meta(struct verify_header *hdr, struct thread_data *td,
872 struct vhdr_meta *vh = hdr_priv(hdr);
884 static void fill_xxhash(struct verify_header *hdr, void *p, unsigned int len)
886 struct vhdr_xxhash *vh = hdr_priv(hdr);
894 static void fill_sha512(struct verify_header *hdr, void *p, unsigned int len)
896 struct vhdr_sha512 *vh = hdr_priv(hdr);
905 static void fill_sha256(struct verify_header *hdr, void *p, unsigned int len)
907 struct vhdr_sha256 *vh = hdr_priv(hdr);
916 static void fill_sha1(struct verify_header *hdr, void *p, unsigned int len)
918 struct vhdr_sha1 *vh = hdr_priv(hdr);
927 static void fill_crc7(struct verify_header *hdr, void *p, unsigned int len)
929 struct vhdr_crc7 *vh = hdr_priv(hdr);
934 static void fill_crc16(struct verify_header *hdr, void *p, unsigned int len)
936 struct vhdr_crc16 *vh = hdr_priv(hdr);
941 static void fill_crc32(struct verify_header *hdr, void *p, unsigned int len)
943 struct vhdr_crc32 *vh = hdr_priv(hdr);
948 static void fill_crc32c(struct verify_header *hdr, void *p, unsigned int len)
950 struct vhdr_crc32 *vh = hdr_priv(hdr);
955 static void fill_crc64(struct verify_header *hdr, void *p, unsigned int len)
957 struct vhdr_crc64 *vh = hdr_priv(hdr);
962 static void fill_md5(struct verify_header *hdr, void *p, unsigned int len)
964 struct vhdr_md5 *vh = hdr_priv(hdr);
974 struct verify_header *hdr, unsigned int header_num,
980 p = (void *) hdr;
982 hdr->magic = FIO_HDR_MAGIC;
983 hdr->verify_type = td->o.verify;
984 hdr->len = header_len;
985 hdr->rand_seed = io_u->rand_seed;
986 hdr->crc32 = fio_crc32c(p, offsetof(struct verify_header, crc32));
988 data_len = header_len - hdr_size(hdr);
990 data = p + hdr_size(hdr);
994 io_u, hdr->len);
995 fill_md5(hdr, data, data_len);
999 io_u, hdr->len);
1000 fill_crc64(hdr, data, data_len);
1005 io_u, hdr->len);
1006 fill_crc32c(hdr, data, data_len);
1010 io_u, hdr->len);
1011 fill_crc32(hdr, data, data_len);
1015 io_u, hdr->len);
1016 fill_crc16(hdr, data, data_len);
1020 io_u, hdr->len);
1021 fill_crc7(hdr, data, data_len);
1025 io_u, hdr->len);
1026 fill_sha256(hdr, data, data_len);
1030 io_u, hdr->len);
1031 fill_sha512(hdr, data, data_len);
1035 io_u, hdr->len);
1036 fill_xxhash(hdr, data, data_len);
1040 io_u, hdr->len);
1041 fill_meta(hdr, td, io_u, header_num);
1045 io_u, hdr->len);
1046 fill_sha1(hdr, data, data_len);
1056 memswp(p, p + td->o.verify_offset, hdr_size(hdr));