X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=inline;f=verify.c;h=156f068687097343469a6839c712adf862d35ab5;hb=d77a7af3e718200bbd77d76194725ead4bdb3591;hp=42a56d7162631e51be05d10394b40fa91b1bd382;hpb=bcdedd0ac6e9413258b608ecb3511867b1a9c534;p=fio.git diff --git a/verify.c b/verify.c index 42a56d71..156f0686 100644 --- a/verify.c +++ b/verify.c @@ -76,6 +76,22 @@ static int verify_io_u_crc16(struct verify_header *hdr, struct io_u *io_u) return 0; } +static int verify_io_u_crc64(struct verify_header *hdr, struct io_u *io_u) +{ + unsigned char *p = io_u->buf + sizeof(*hdr); + unsigned long long c; + + c = crc64(p, hdr->len - sizeof(*hdr)); + + if (c != hdr->crc64) { + log_err("crc64: verify failed at %llu/%lu\n", io_u->offset, io_u->buflen); + log_err("crc64: wanted %llx, got %llx\n", hdr->crc64, c); + return 1; + } + + return 0; +} + static int verify_io_u_crc32(struct verify_header *hdr, struct io_u *io_u) { unsigned char *p = io_u->buf; @@ -130,6 +146,9 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u) case VERIFY_MD5: ret = verify_io_u_md5(hdr, io_u); break; + case VERIFY_CRC64: + ret = verify_io_u_crc64(hdr, io_u); + break; case VERIFY_CRC32: ret = verify_io_u_crc32(hdr, io_u); break; @@ -165,6 +184,11 @@ static void fill_crc32(struct verify_header *hdr, void *p, unsigned int len) hdr->crc32 = crc32(p, len); } +static void fill_crc64(struct verify_header *hdr, void *p, unsigned int len) +{ + hdr->crc64 = crc64(p, len); +} + static void fill_md5(struct verify_header *hdr, void *p, unsigned int len) { struct md5_ctx md5_ctx = { @@ -199,6 +223,9 @@ void populate_verify_io_u(struct thread_data *td, struct io_u *io_u) case VERIFY_MD5: fill_md5(hdr, p, len); break; + case VERIFY_CRC64: + fill_crc64(hdr, p, len); + break; case VERIFY_CRC32: fill_crc32(hdr, p, len); break;