Just make 'p' void *, like io_u->buf.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
#include "fio.h"
static void fill_random_bytes(struct thread_data *td,
#include "fio.h"
static void fill_random_bytes(struct thread_data *td,
- unsigned char *p, unsigned int len)
+ void *p, unsigned int len)
{
unsigned int todo;
int r;
{
unsigned int todo;
int r;
static int verify_io_u_crc7(struct verify_header *hdr, struct io_u *io_u,
unsigned char header_num)
{
static int verify_io_u_crc7(struct verify_header *hdr, struct io_u *io_u,
unsigned char header_num)
{
- unsigned char *p = io_u->buf;
+ void *p = io_u->buf + header_num * hdr->len + sizeof(*hdr);
- p += header_num * hdr->len + sizeof(*hdr);
c = crc7(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc7) {
c = crc7(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc7) {
static int verify_io_u_crc16(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
static int verify_io_u_crc16(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
- unsigned char *p = io_u->buf;
+ void *p = io_u->buf + header_num * hdr->len + sizeof(*hdr);
- p += header_num * hdr->len + sizeof(*hdr);
c = crc16(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc16) {
c = crc16(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc16) {
static int verify_io_u_crc64(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
static int verify_io_u_crc64(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
- unsigned char *p = io_u->buf;
+ void *p = io_u->buf + header_num * hdr->len + sizeof(*hdr);
- p += header_num * hdr->len + sizeof(*hdr);
c = crc64(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc64) {
c = crc64(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc64) {
static int verify_io_u_crc32(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
static int verify_io_u_crc32(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
- unsigned char *p = io_u->buf;
+ void *p = io_u->buf + header_num * hdr->len + sizeof(*hdr);
- p += header_num * hdr->len + sizeof(*hdr);
c = crc32(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc32) {
c = crc32(p, hdr->len - sizeof(*hdr));
if (c != hdr->crc32) {
static int verify_io_u_md5(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
static int verify_io_u_md5(struct verify_header *hdr, struct io_u *io_u,
unsigned int header_num)
{
- unsigned char *p = io_u->buf;
+ void *p = io_u->buf + header_num * hdr->len + sizeof(*hdr);
uint32_t hash[MD5_HASH_WORDS];
struct md5_ctx md5_ctx = {
.hash = hash,
};
uint32_t hash[MD5_HASH_WORDS];
struct md5_ctx md5_ctx = {
.hash = hash,
};
- p += header_num * hdr->len + sizeof(*hdr);
md5_update(&md5_ctx, p, hdr->len - sizeof(*hdr));
if (memcmp(hdr->md5_digest, md5_ctx.hash, sizeof(md5_ctx.hash))) {
md5_update(&md5_ctx, p, hdr->len - sizeof(*hdr));
if (memcmp(hdr->md5_digest, md5_ctx.hash, sizeof(md5_ctx.hash))) {
int verify_io_u(struct thread_data *td, struct io_u *io_u)
{
int verify_io_u(struct thread_data *td, struct io_u *io_u)
{
- unsigned char *p = (unsigned char*) io_u->buf;
struct verify_header *hdr;
unsigned int hdr_inc, hdr_num = 0;
struct verify_header *hdr;
unsigned int hdr_inc, hdr_num = 0;
int ret;
if (td->o.verify == VERIFY_NULL || io_u->ddir != DDIR_READ)
int ret;
if (td->o.verify == VERIFY_NULL || io_u->ddir != DDIR_READ)
if (td->o.header_interval)
hdr_inc = td->o.header_interval;
if (td->o.header_interval)
hdr_inc = td->o.header_interval;
- for (; p < (unsigned char*) io_u->buf + io_u->buflen; p += hdr_inc) {
+ for (p = io_u->buf; p < io_u->buf + io_u->buflen; p += hdr_inc) {
- memswp(p, &p[td->o.header_offset], sizeof(*hdr));
+ memswp(p, p + td->o.header_offset, sizeof(*hdr));
- hdr = (struct verify_header*) p;
if (hdr->fio_magic != FIO_HDR_MAGIC) {
log_err("Bad verify header %x\n", hdr->fio_magic);
if (hdr->fio_magic != FIO_HDR_MAGIC) {
log_err("Bad verify header %x\n", hdr->fio_magic);
void populate_verify_io_u(struct thread_data *td, struct io_u *io_u)
{
struct verify_header *hdr;
void populate_verify_io_u(struct thread_data *td, struct io_u *io_u)
{
struct verify_header *hdr;
- unsigned char *p = io_u->buf, *data;
+ void *p = io_u->buf, *data;
unsigned int hdr_inc, data_len;
if (td->o.verify == VERIFY_NULL)
unsigned int hdr_inc, data_len;
if (td->o.verify == VERIFY_NULL)
hdr_inc = td->o.header_interval;
data_len = hdr_inc - sizeof(*hdr);
hdr_inc = td->o.header_interval;
data_len = hdr_inc - sizeof(*hdr);
- for (;p < (unsigned char*) io_u->buf + io_u->buflen; p += hdr_inc) {
- hdr = (struct verify_header*) p;
+ for (;p < io_u->buf + io_u->buflen; p += hdr_inc) {
+ hdr = p;
hdr->fio_magic = FIO_HDR_MAGIC;
hdr->verify_type = td->o.verify;
hdr->fio_magic = FIO_HDR_MAGIC;
hdr->verify_type = td->o.verify;
assert(0);
}
if (td->o.header_offset)
assert(0);
}
if (td->o.header_offset)
- memswp(p, &p[td->o.header_offset], sizeof(*hdr));
+ memswp(p, p + td->o.header_offset, sizeof(*hdr));