From: Jens Axboe Date: Wed, 3 Jun 2009 06:45:40 +0000 (+0200) Subject: Cleanup verify headers X-Git-Tag: fio-1.27~11 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=4f5af7b2370a6d3e64bc5128905c1aa8b0dc51b0 Cleanup verify headers Signed-off-by: Jens Axboe --- diff --git a/engines/mmap.c b/engines/mmap.c index 2a341d07..fde68f1d 100644 --- a/engines/mmap.c +++ b/engines/mmap.c @@ -12,6 +12,7 @@ #include #include "../fio.h" +#include "../verify.h" /* * Limits us to 2GB of mapped files in total diff --git a/fio.c b/fio.c index 5bd1baef..8c1502ec 100644 --- a/fio.c +++ b/fio.c @@ -37,6 +37,7 @@ #include "fio.h" #include "hash.h" #include "smalloc.h" +#include "verify.h" unsigned long page_mask; unsigned long page_size; diff --git a/fio.h b/fio.h index 1819c321..d3a03795 100644 --- a/fio.h +++ b/fio.h @@ -168,63 +168,6 @@ enum { FIO_Q_BUSY = 2, /* no more room, call ->commit() */ }; -#define FIO_HDR_MAGIC 0xf00baaef - -enum { - VERIFY_NONE = 0, /* no verification */ - VERIFY_MD5, /* md5 sum data blocks */ - VERIFY_CRC64, /* crc64 sum data blocks */ - VERIFY_CRC32, /* crc32 sum data blocks */ - VERIFY_CRC32C, /* crc32c sum data blocks */ - VERIFY_CRC32C_INTEL, /* crc32c sum data blocks with hw */ - VERIFY_CRC16, /* crc16 sum data blocks */ - VERIFY_CRC7, /* crc7 sum data blocks */ - VERIFY_SHA256, /* sha256 sum data blocks */ - VERIFY_SHA512, /* sha512 sum data blocks */ - VERIFY_META, /* block_num, timestamp etc. */ - VERIFY_NULL, /* pretend to verify */ -}; - -/* - * A header structure associated with each checksummed data block. It is - * followed by a checksum specific header that contains the verification - * data. - */ -struct verify_header { - unsigned int fio_magic; - unsigned int len; - unsigned int verify_type; -}; - -struct vhdr_md5 { - uint32_t md5_digest[16]; -}; -struct vhdr_sha512 { - uint8_t sha512[128]; -}; -struct vhdr_sha256 { - uint8_t sha256[128]; -}; -struct vhdr_crc64 { - uint64_t crc64; -}; -struct vhdr_crc32 { - uint32_t crc32; -}; -struct vhdr_crc16 { - uint16_t crc16; -}; -struct vhdr_crc7 { - uint8_t crc7; -}; -struct vhdr_meta { - uint64_t offset; - unsigned char thread; - unsigned short numberio; - unsigned long time_sec; - unsigned long time_usec; -}; - struct group_run_stats { unsigned long long max_run[2], min_run[2]; unsigned long long max_bw[2], min_bw[2]; @@ -858,13 +801,6 @@ enum { extern void td_set_runstate(struct thread_data *, int); -/* - * Verify helpers - */ -extern void populate_verify_io_u(struct thread_data *, struct io_u *); -extern int __must_check get_next_verify(struct thread_data *td, struct io_u *); -extern int __must_check verify_io_u(struct thread_data *, struct io_u *); - /* * Memory helpers */ diff --git a/init.c b/init.c index 7681102b..b3ce07c9 100644 --- a/init.c +++ b/init.c @@ -18,6 +18,7 @@ #include "parse.h" #include "smalloc.h" #include "filehash.h" +#include "verify.h" static char fio_version_string[] = "fio 1.26.4"; diff --git a/io_u.c b/io_u.c index d12f370b..5cf2526b 100644 --- a/io_u.c +++ b/io_u.c @@ -7,6 +7,7 @@ #include "fio.h" #include "hash.h" +#include "verify.h" struct io_completion_data { int nr; /* input */ diff --git a/log.c b/log.c index 6d5e68da..5014b484 100644 --- a/log.c +++ b/log.c @@ -8,6 +8,7 @@ #include #include "flist.h" #include "fio.h" +#include "verify.h" static const char iolog_ver2[] = "fio version 2 iolog"; diff --git a/options.c b/options.c index a45d1af6..9dcef0ca 100644 --- a/options.c +++ b/options.c @@ -11,6 +11,7 @@ #include #include "fio.h" +#include "verify.h" #include "parse.h" #include "lib/fls.h" diff --git a/verify.c b/verify.c index 6de0b884..2ae74b93 100644 --- a/verify.c +++ b/verify.c @@ -7,6 +7,7 @@ #include #include "fio.h" +#include "verify.h" #include "crc/md5.h" #include "crc/crc64.h" diff --git a/verify.h b/verify.h new file mode 100644 index 00000000..76d256d1 --- /dev/null +++ b/verify.h @@ -0,0 +1,68 @@ +#ifndef FIO_VERIFY_H +#define FIO_VERIFY_H + +#define FIO_HDR_MAGIC 0xf00baaef + +enum { + VERIFY_NONE = 0, /* no verification */ + VERIFY_MD5, /* md5 sum data blocks */ + VERIFY_CRC64, /* crc64 sum data blocks */ + VERIFY_CRC32, /* crc32 sum data blocks */ + VERIFY_CRC32C, /* crc32c sum data blocks */ + VERIFY_CRC32C_INTEL, /* crc32c sum data blocks with hw */ + VERIFY_CRC16, /* crc16 sum data blocks */ + VERIFY_CRC7, /* crc7 sum data blocks */ + VERIFY_SHA256, /* sha256 sum data blocks */ + VERIFY_SHA512, /* sha512 sum data blocks */ + VERIFY_META, /* block_num, timestamp etc. */ + VERIFY_NULL, /* pretend to verify */ +}; + +/* + * A header structure associated with each checksummed data block. It is + * followed by a checksum specific header that contains the verification + * data. + */ +struct verify_header { + unsigned int fio_magic; + unsigned int len; + unsigned int verify_type; +}; + +struct vhdr_md5 { + uint32_t md5_digest[16]; +}; +struct vhdr_sha512 { + uint8_t sha512[128]; +}; +struct vhdr_sha256 { + uint8_t sha256[128]; +}; +struct vhdr_crc64 { + uint64_t crc64; +}; +struct vhdr_crc32 { + uint32_t crc32; +}; +struct vhdr_crc16 { + uint16_t crc16; +}; +struct vhdr_crc7 { + uint8_t crc7; +}; +struct vhdr_meta { + uint64_t offset; + unsigned char thread; + unsigned short numberio; + unsigned long time_sec; + unsigned long time_usec; +}; + +/* + * Verify helpers + */ +extern void populate_verify_io_u(struct thread_data *, struct io_u *); +extern int __must_check get_next_verify(struct thread_data *td, struct io_u *); +extern int __must_check verify_io_u(struct thread_data *, struct io_u *); + +#endif