X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fbinject.c;h=fb1906206a039be8e13f5cc00118307b6febd1dd;hb=6d0e9f83bdc1b9014ffb7200f923372de29eb713;hp=58901b6f8674b5238e133879620ec00811fdf751;hpb=ce4b5050396e81c0d9cf3fe1eaf583de9284df07;p=fio.git diff --git a/engines/binject.c b/engines/binject.c index 58901b6f..fb190620 100644 --- a/engines/binject.c +++ b/engines/binject.c @@ -69,7 +69,7 @@ static unsigned int binject_read_commands(struct thread_data *td, void *p, one_more: events = 0; for_each_file(td, f, i) { - bf = f->file_data; + bf = (struct binject_file *) (uintptr_t) f->engine_data; ret = read(bf->fd, p, left * sizeof(struct b_user_cmd)); if (ret < 0) { if (errno == EAGAIN) @@ -104,7 +104,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, * Fill in the file descriptors */ for_each_file(td, f, i) { - bf = f->file_data; + bf = (struct binject_file *) (uintptr_t) f->engine_data; /* * don't block for min events == 0 @@ -146,14 +146,14 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, for (i = 0; i < events; i++) { struct b_user_cmd *buc = (struct b_user_cmd *) buf + i; - bd->events[ev_index] = (struct io_u *) buc->usr_ptr; + bd->events[ev_index] = (struct io_u *) (unsigned long) buc->usr_ptr; ev_index++; } } if (!min) { for_each_file(td, f, i) { - bf = f->file_data; + bf = (struct binject_file *) (uintptr_t) f->engine_data; fcntl(bf->fd, F_SETFL, bd->fd_flags[i]); } } @@ -167,7 +167,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, static int fio_binject_doio(struct thread_data *td, struct io_u *io_u) { struct b_user_cmd *buc = &io_u->buc; - struct binject_file *bf = io_u->file->file_data; + struct binject_file *bf = (struct binject_file *) (uintptr_t) io_u->file->engine_data; int ret; ret = write(bf->fd, buc, sizeof(*buc)); @@ -181,7 +181,7 @@ static int fio_binject_prep(struct thread_data *td, struct io_u *io_u) { struct binject_data *bd = td->io_ops->data; struct b_user_cmd *buc = &io_u->buc; - struct binject_file *bf = io_u->file->file_data; + struct binject_file *bf = (struct binject_file *) (uintptr_t) io_u->file->engine_data; if (io_u->xfer_buflen & (bf->bs - 1)) { log_err("read/write not sector aligned\n"); @@ -260,7 +260,7 @@ static void binject_unmap_dev(struct thread_data *td, struct binject_file *bf) bic.minor = bf->minor; - if (ioctl(fdb, 1, &bic) < 0) + if (ioctl(fdb, B_IOCTL_DEL, &bic) < 0) td_verror(td, errno, "binject dev unmap"); close(fdb); @@ -280,7 +280,7 @@ static int binject_map_dev(struct thread_data *td, struct binject_file *bf, bic.fd = fd; - if (ioctl(fdb, 0, &bic) < 0) { + if (ioctl(fdb, B_IOCTL_ADD, &bic) < 0) { td_verror(td, errno, "binject dev map"); close(fdb); return 1; @@ -323,12 +323,12 @@ err_unmap: static int fio_binject_close_file(struct thread_data *td, struct fio_file *f) { - struct binject_file *bf = f->file_data; + struct binject_file *bf = (struct binject_file *) (uintptr_t) f->engine_data; if (bf) { binject_unmap_dev(td, bf); free(bf); - f->file_data = NULL; + f->engine_data = 0; return generic_close_file(td, f); } @@ -357,7 +357,7 @@ static int fio_binject_open_file(struct thread_data *td, struct fio_file *f) bf = malloc(sizeof(*bf)); bf->bs = bs; bf->minor = bf->fd = -1; - f->file_data = bf; + f->engine_data = (uintptr_t) bf; if (binject_map_dev(td, bf, f->fd)) { err_close: @@ -416,7 +416,7 @@ static struct ioengine_ops ioengine = { .open_file = fio_binject_open_file, .close_file = fio_binject_close_file, .get_file_size = generic_get_file_size, - .flags = FIO_RAWIO | FIO_BARRIER, + .flags = FIO_RAWIO | FIO_BARRIER | FIO_MEMALIGN, }; #else /* FIO_HAVE_BINJECT */