blob: a6f89746d49b24b5d1876f597df7c4ed4f89a074 [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 Axboe4f5af7b2009-06-03 08:45:40 +02006#define FIO_HDR_MAGIC 0xf00baaef
7
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 Axboe4f5af7b2009-06-03 08:45:40 +020021 VERIFY_NULL, /* pretend to verify */
22};
23
24/*
25 * A header structure associated with each checksummed data block. It is
26 * followed by a checksum specific header that contains the verification
27 * data.
28 */
29struct verify_header {
30 unsigned int fio_magic;
31 unsigned int len;
32 unsigned int verify_type;
33};
34
35struct vhdr_md5 {
Jens Axboe34644af2010-06-17 20:37:58 +020036 uint32_t md5_digest[4];
Jens Axboe4f5af7b2009-06-03 08:45:40 +020037};
38struct vhdr_sha512 {
39 uint8_t sha512[128];
40};
41struct vhdr_sha256 {
Jens Axboebc77f562010-02-23 10:36:21 +010042 uint8_t sha256[64];
Jens Axboe4f5af7b2009-06-03 08:45:40 +020043};
Jens Axboe7c353ce2009-08-09 22:40:33 +020044struct vhdr_sha1 {
45 uint32_t sha1[5];
46};
Jens Axboe4f5af7b2009-06-03 08:45:40 +020047struct vhdr_crc64 {
48 uint64_t crc64;
49};
50struct vhdr_crc32 {
51 uint32_t crc32;
52};
53struct vhdr_crc16 {
54 uint16_t crc16;
55};
56struct vhdr_crc7 {
57 uint8_t crc7;
58};
59struct vhdr_meta {
60 uint64_t offset;
61 unsigned char thread;
62 unsigned short numberio;
63 unsigned long time_sec;
64 unsigned long time_usec;
65};
66
67/*
68 * Verify helpers
69 */
70extern void populate_verify_io_u(struct thread_data *, struct io_u *);
71extern int __must_check get_next_verify(struct thread_data *td, struct io_u *);
72extern int __must_check verify_io_u(struct thread_data *, struct io_u *);
Jens Axboee8462bd2009-07-06 12:59:04 +020073extern int verify_io_u_async(struct thread_data *, struct io_u *);
Radha Ramachandrancbe8d752010-07-14 08:36:07 +020074extern void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u);
Jens Axboee8462bd2009-07-06 12:59:04 +020075
76/*
77 * Async verify offload
78 */
79extern int verify_async_init(struct thread_data *);
80extern void verify_async_exit(struct thread_data *);
Jens Axboe4f5af7b2009-06-03 08:45:40 +020081
82#endif