1 #ifndef FIO_VERIFY_H 2 #define FIO_VERIFY_H 3 4 #include <stdint.h> 5 #include "verify-state.h" 6 7 #define FIO_HDR_MAGIC 0xacca 8 9 enum { 10 VERIFY_NONE = 0, /* no verification */ 11 VERIFY_HDR_ONLY, /* verify header only, kept for sake of 12 * compatibility with old configurations 13 * which use 'verify=meta' */ 14 VERIFY_MD5, /* md5 sum data blocks */ 15 VERIFY_CRC64, /* crc64 sum data blocks */ 16 VERIFY_CRC32, /* crc32 sum data blocks */ 17 VERIFY_CRC32C, /* crc32c sum data blocks */ 18 VERIFY_CRC32C_INTEL, /* crc32c sum data blocks with hw */ 19 VERIFY_CRC16, /* crc16 sum data blocks */ 20 VERIFY_CRC7, /* crc7 sum data blocks */ 21 VERIFY_SHA256, /* sha256 sum data blocks */ 22 VERIFY_SHA512, /* sha512 sum data blocks */ 23 VERIFY_SHA3_224, /* sha3-224 sum data blocks */ 24 VERIFY_SHA3_256, /* sha3-256 sum data blocks */ 25 VERIFY_SHA3_384, /* sha3-384 sum data blocks */ 26 VERIFY_SHA3_512, /* sha3-512 sum data blocks */ 27 VERIFY_XXHASH, /* xxhash sum data blocks */ 28 VERIFY_SHA1, /* sha1 sum data blocks */ 29 VERIFY_PATTERN, /* verify specific patterns */ 30 VERIFY_PATTERN_NO_HDR, /* verify specific patterns, no hdr */ 31 VERIFY_NULL, /* pretend to verify */ 32 }; 33 34 /* 35 * A header structure associated with each checksummed data block. It is 36 * followed by a checksum specific header that contains the verification 37 * data. 38 */ 39 struct verify_header { 40 uint16_t magic; 41 uint16_t verify_type; 42 uint32_t len; 43 uint64_t rand_seed; 44 uint64_t offset; 45 uint32_t time_sec; 46 uint32_t time_usec; 47 uint16_t thread; 48 uint16_t numberio; 49 uint32_t crc32; 50 }; 51 52 struct vhdr_md5 { 53 uint32_t md5_digest[4]; 54 }; 55 struct vhdr_sha3_224 { 56 uint8_t sha[224 / 8]; 57 }; 58 struct vhdr_sha3_256 { 59 uint8_t sha[256 / 8]; 60 }; 61 struct vhdr_sha3_384 { 62 uint8_t sha[384 / 8]; 63 }; 64 struct vhdr_sha3_512 { 65 uint8_t sha[512 / 8]; 66 }; 67 struct vhdr_sha512 { 68 uint8_t sha512[128]; 69 }; 70 struct vhdr_sha256 { 71 uint8_t sha256[64]; 72 }; 73 struct vhdr_sha1 { 74 uint32_t sha1[5]; 75 }; 76 struct vhdr_crc64 { 77 uint64_t crc64; 78 }; 79 struct vhdr_crc32 { 80 uint32_t crc32; 81 }; 82 struct vhdr_crc16 { 83 uint16_t crc16; 84 }; 85 struct vhdr_crc7 { 86 uint8_t crc7; 87 }; 88 struct vhdr_xxhash { 89 uint32_t hash; 90 }; 91 92 /* 93 * Verify helpers 94 */ 95 extern void populate_verify_io_u(struct thread_data *, struct io_u *); 96 extern int __must_check get_next_verify(struct thread_data *td, struct io_u *); 97 extern int __must_check verify_io_u(struct thread_data *, struct io_u **); 98 extern int verify_io_u_async(struct thread_data *, struct io_u **); 99 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); 100 extern void fill_buffer_pattern(struct thread_data *td, void *p, unsigned int len); 101 extern void fio_verify_init(struct thread_data *td); 102 103 /* 104 * Async verify offload 105 */ 106 extern int verify_async_init(struct thread_data *); 107 extern void verify_async_exit(struct thread_data *); 108 109 /* 110 * Callbacks for pasting formats in the pattern buffer 111 */ 112 extern int paste_blockoff(char *buf, unsigned int len, void *priv); 113 114 #endif 115