+/*
+ * Verify container, pass info to verify handlers and allow them to
+ * pass info back in case of error
+ */
+struct vcont {
+ /*
+ * Input
+ */
+ struct io_u *io_u;
+ unsigned int hdr_num;
+
+ /*
+ * Output, only valid in case of error
+ */
+ const char *name;
+ void *good_crc;
+ void *bad_crc;
+ unsigned int crc_len;
+};
+
+static void log_verify_failure(struct verify_header *hdr, struct vcont *vc)
+{
+ unsigned long long offset;
+
+ offset = vc->io_u->offset;
+ offset += vc->hdr_num * hdr->len;
+ log_err("%.8s: verify failed at file %s offset %llu, length %u\n",
+ vc->name, vc->io_u->file->file_name, offset, hdr->len);
+
+ if (vc->good_crc && vc->bad_crc) {
+ log_err(" Expected CRC: ");
+ hexdump(vc->good_crc, vc->crc_len);
+ log_err(" Received CRC: ");
+ hexdump(vc->bad_crc, vc->crc_len);
+ }
+}
+