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