Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 1 | #ifndef FIO_VERIFY_H |
| 2 | #define FIO_VERIFY_H |
| 3 | |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | |
Jens Axboe | d3a173a | 2012-02-23 08:23:18 +0100 | [diff] [blame] | 6 | #define FIO_HDR_MAGIC 0xacca |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 7 | |
| 8 | enum { |
| 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 Axboe | 7c353ce | 2009-08-09 22:40:33 +0200 | [diff] [blame] | 20 | VERIFY_SHA1, /* sha1 sum data blocks */ |
Jens Axboe | 92bf48d | 2011-01-14 21:20:42 +0100 | [diff] [blame] | 21 | VERIFY_PATTERN, /* verify specific patterns */ |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 22 | 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 | */ |
| 30 | struct verify_header { |
Jens Axboe | d3a173a | 2012-02-23 08:23:18 +0100 | [diff] [blame] | 31 | uint16_t magic; |
| 32 | uint16_t verify_type; |
Jens Axboe | f65d1c2 | 2012-02-22 20:11:57 +0100 | [diff] [blame] | 33 | uint32_t len; |
Jens Axboe | f65d1c2 | 2012-02-22 20:11:57 +0100 | [diff] [blame] | 34 | uint64_t rand_seed; |
Jens Axboe | f65d1c2 | 2012-02-22 20:11:57 +0100 | [diff] [blame] | 35 | uint32_t crc32; |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | struct vhdr_md5 { |
Jens Axboe | 34644af | 2010-06-17 20:37:58 +0200 | [diff] [blame] | 39 | uint32_t md5_digest[4]; |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 40 | }; |
| 41 | struct vhdr_sha512 { |
| 42 | uint8_t sha512[128]; |
| 43 | }; |
| 44 | struct vhdr_sha256 { |
Jens Axboe | bc77f56 | 2010-02-23 10:36:21 +0100 | [diff] [blame] | 45 | uint8_t sha256[64]; |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 46 | }; |
Jens Axboe | 7c353ce | 2009-08-09 22:40:33 +0200 | [diff] [blame] | 47 | struct vhdr_sha1 { |
| 48 | uint32_t sha1[5]; |
| 49 | }; |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 50 | struct vhdr_crc64 { |
| 51 | uint64_t crc64; |
| 52 | }; |
| 53 | struct vhdr_crc32 { |
| 54 | uint32_t crc32; |
| 55 | }; |
| 56 | struct vhdr_crc16 { |
| 57 | uint16_t crc16; |
| 58 | }; |
| 59 | struct vhdr_crc7 { |
| 60 | uint8_t crc7; |
| 61 | }; |
| 62 | struct 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 | */ |
| 73 | extern void populate_verify_io_u(struct thread_data *, struct io_u *); |
| 74 | extern int __must_check get_next_verify(struct thread_data *td, struct io_u *); |
| 75 | extern int __must_check verify_io_u(struct thread_data *, struct io_u *); |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 76 | extern int verify_io_u_async(struct thread_data *, struct io_u *); |
Jens Axboe | ce35b1e | 2014-01-14 15:35:58 -0700 | [diff] [blame] | 77 | extern void fill_verify_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u, unsigned long seed, int use_seed); |
| 78 | extern void fill_buffer_pattern(struct thread_data *td, void *p, unsigned int len); |
Jens Axboe | dc5bfbb | 2013-04-10 22:23:40 +0200 | [diff] [blame] | 79 | extern void fio_verify_init(struct thread_data *td); |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 80 | |
| 81 | /* |
| 82 | * Async verify offload |
| 83 | */ |
| 84 | extern int verify_async_init(struct thread_data *); |
| 85 | extern void verify_async_exit(struct thread_data *); |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 86 | |
| 87 | #endif |