blob: 6a81e9b012bc6fa0632a90ea0dc2e9acfe26755f [file] [log] [blame]
Jens Axboe4f5af7b2009-06-03 08:45:40 +02001#ifndef FIO_VERIFY_H
2#define FIO_VERIFY_H
3
Bruce Cran03e20d62011-01-02 20:14:54 +01004#include <stdint.h>
5
Jens Axboed3a173a2012-02-23 08:23:18 +01006#define FIO_HDR_MAGIC 0xacca
Jens Axboe4f5af7b2009-06-03 08:45:40 +02007
8enum {
9 VERIFY_NONE = 0, /* no verification */
10 VERIFY_MD5, /* md5 sum data blocks */
11 VERIFY_CRC64, /* crc64 sum data blocks */
12 VERIFY_CRC32, /* crc32 sum data blocks */
13 VERIFY_CRC32C, /* crc32c sum data blocks */
14 VERIFY_CRC32C_INTEL, /* crc32c sum data blocks with hw */
15 VERIFY_CRC16, /* crc16 sum data blocks */
16 VERIFY_CRC7, /* crc7 sum data blocks */
17 VERIFY_SHA256, /* sha256 sum data blocks */
18 VERIFY_SHA512, /* sha512 sum data blocks */
19 VERIFY_META, /* block_num, timestamp etc. */
Jens Axboe7c353ce2009-08-09 22:40:33 +020020 VERIFY_SHA1, /* sha1 sum data blocks */
Jens Axboe92bf48d2011-01-14 21:20:42 +010021 VERIFY_PATTERN, /* verify specific patterns */
Jens Axboe4f5af7b2009-06-03 08:45:40 +020022 VERIFY_NULL, /* pretend to verify */
23};
24
25/*
26 * A header structure associated with each checksummed data block. It is
27 * followed by a checksum specific header that contains the verification
28 * data.
29 */
30struct verify_header {
Jens Axboed3a173a2012-02-23 08:23:18 +010031 uint16_t magic;
32 uint16_t verify_type;
Jens Axboef65d1c22012-02-22 20:11:57 +010033 uint32_t len;
Jens Axboef65d1c22012-02-22 20:11:57 +010034 uint64_t rand_seed;
Jens Axboef65d1c22012-02-22 20:11:57 +010035 uint32_t crc32;
Jens Axboe4f5af7b2009-06-03 08:45:40 +020036};
37
38struct vhdr_md5 {
Jens Axboe34644af2010-06-17 20:37:58 +020039 uint32_t md5_digest[4];
Jens Axboe4f5af7b2009-06-03 08:45:40 +020040};
41struct vhdr_sha512 {
42 uint8_t sha512[128];
43};
44struct vhdr_sha256 {
Jens Axboebc77f562010-02-23 10:36:21 +010045 uint8_t sha256[64];
Jens Axboe4f5af7b2009-06-03 08:45:40 +020046};
Jens Axboe7c353ce2009-08-09 22:40:33 +020047struct vhdr_sha1 {
48 uint32_t sha1[5];
49};
Jens Axboe4f5af7b2009-06-03 08:45:40 +020050struct vhdr_crc64 {
51 uint64_t crc64;
52};
53struct vhdr_crc32 {
54 uint32_t crc32;
55};
56struct vhdr_crc16 {
57 uint16_t crc16;
58};
59struct vhdr_crc7 {
60 uint8_t crc7;
61};
62struct vhdr_meta {
63 uint64_t offset;
64 unsigned char thread;
65 unsigned short numberio;
66 unsigned long time_sec;
67 unsigned long time_usec;
68};
69
70/*
71 * Verify helpers
72 */
73extern void populate_verify_io_u(struct thread_data *, struct io_u *);
74extern int __must_check get_next_verify(struct thread_data *td, struct io_u *);
75extern int __must_check verify_io_u(struct thread_data *, struct io_u *);
Jens Axboee8462bd2009-07-06 12:59:04 +020076extern int verify_io_u_async(struct thread_data *, struct io_u *);
Jens Axboe7d9fb452011-01-11 22:16:49 +010077extern void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u, unsigned long seed, int use_seed);
Jens Axboedc5bfbb2013-04-10 22:23:40 +020078extern void fio_verify_init(struct thread_data *td);
Jens Axboee8462bd2009-07-06 12:59:04 +020079
80/*
81 * Async verify offload
82 */
83extern int verify_async_init(struct thread_data *);
84extern void verify_async_exit(struct thread_data *);
Jens Axboe4f5af7b2009-06-03 08:45:40 +020085
86#endif