Add checksum to verify_header
[fio.git] / verify.h
... / ...
CommitLineData
1#ifndef FIO_VERIFY_H
2#define FIO_VERIFY_H
3
4#include <stdint.h>
5
6#define FIO_HDR_MAGIC 0xf00baaef
7#define FIO_HDR_MAGIC2 0xf00dbeef
8
9enum {
10 VERIFY_NONE = 0, /* no verification */
11 VERIFY_MD5, /* md5 sum data blocks */
12 VERIFY_CRC64, /* crc64 sum data blocks */
13 VERIFY_CRC32, /* crc32 sum data blocks */
14 VERIFY_CRC32C, /* crc32c sum data blocks */
15 VERIFY_CRC32C_INTEL, /* crc32c sum data blocks with hw */
16 VERIFY_CRC16, /* crc16 sum data blocks */
17 VERIFY_CRC7, /* crc7 sum data blocks */
18 VERIFY_SHA256, /* sha256 sum data blocks */
19 VERIFY_SHA512, /* sha512 sum data blocks */
20 VERIFY_META, /* block_num, timestamp etc. */
21 VERIFY_SHA1, /* sha1 sum data blocks */
22 VERIFY_PATTERN, /* verify specific patterns */
23 VERIFY_NULL, /* pretend to verify */
24};
25
26/*
27 * A header structure associated with each checksummed data block. It is
28 * followed by a checksum specific header that contains the verification
29 * data.
30 */
31struct verify_header {
32 uint32_t fio_magic;
33 uint32_t len;
34 uint32_t verify_type;
35 uint32_t pad1;
36 uint64_t rand_seed;
37 uint32_t pad2;
38 uint32_t crc32;
39};
40
41struct vhdr_md5 {
42 uint32_t md5_digest[4];
43};
44struct vhdr_sha512 {
45 uint8_t sha512[128];
46};
47struct vhdr_sha256 {
48 uint8_t sha256[64];
49};
50struct vhdr_sha1 {
51 uint32_t sha1[5];
52};
53struct vhdr_crc64 {
54 uint64_t crc64;
55};
56struct vhdr_crc32 {
57 uint32_t crc32;
58};
59struct vhdr_crc16 {
60 uint16_t crc16;
61};
62struct vhdr_crc7 {
63 uint8_t crc7;
64};
65struct vhdr_meta {
66 uint64_t offset;
67 unsigned char thread;
68 unsigned short numberio;
69 unsigned long time_sec;
70 unsigned long time_usec;
71};
72
73/*
74 * Verify helpers
75 */
76extern void populate_verify_io_u(struct thread_data *, struct io_u *);
77extern int __must_check get_next_verify(struct thread_data *td, struct io_u *);
78extern int __must_check verify_io_u(struct thread_data *, struct io_u *);
79extern int verify_io_u_async(struct thread_data *, struct io_u *);
80extern void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u *io_u, unsigned long seed, int use_seed);
81
82/*
83 * Async verify offload
84 */
85extern int verify_async_init(struct thread_data *);
86extern void verify_async_exit(struct thread_data *);
87
88#endif