projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
engines/windowsaio: kill useless forward declarations
[fio.git]
/
engines
/
binject.c
diff --git
a/engines/binject.c
b/engines/binject.c
index c0baf9d262c87376e10cfc43c7732a742c6b50e6..792dbbdd2ee89da71dfb42b3382a3e4adddbc877 100644
(file)
--- a/
engines/binject.c
+++ b/
engines/binject.c
@@
-59,17
+59,18
@@
static int pollin_events(struct pollfd *pfds, int fds)
return 0;
}
return 0;
}
-static unsigned int binject_read_commands(struct thread_data *td, void *
p
,
+static unsigned int binject_read_commands(struct thread_data *td, void *
buf
,
int left, int *err)
{
int left, int *err)
{
- struct binject_file *bf;
struct fio_file *f;
int i, ret, events;
struct fio_file *f;
int i, ret, events;
+ char *p = buf;
one_more:
events = 0;
for_each_file(td, f, i) {
one_more:
events = 0;
for_each_file(td, f, i) {
- bf = (struct binject_file *) (uintptr_t) f->engine_data;
+ struct binject_file *bf = FILE_ENG_DATA(f);
+
ret = read(bf->fd, p, left * sizeof(struct b_user_cmd));
if (ret < 0) {
if (errno == EAGAIN)
ret = read(bf->fd, p, left * sizeof(struct b_user_cmd));
if (ret < 0) {
if (errno == EAGAIN)
@@
-94,18
+95,17
@@
static int fio_binject_getevents(struct thread_data *td, unsigned int min,
unsigned int max,
const struct timespec fio_unused *t)
{
unsigned int max,
const struct timespec fio_unused *t)
{
- struct binject_data *bd = td->io_ops
->
data;
+ struct binject_data *bd = td->io_ops
_
data;
int left = max, ret, r = 0, ev_index = 0;
void *buf = bd->cmds;
unsigned int i, events;
struct fio_file *f;
int left = max, ret, r = 0, ev_index = 0;
void *buf = bd->cmds;
unsigned int i, events;
struct fio_file *f;
- struct binject_file *bf;
/*
* Fill in the file descriptors
*/
for_each_file(td, f, i) {
/*
* Fill in the file descriptors
*/
for_each_file(td, f, i) {
-
bf = (struct binject_file *) (uintptr_t) f->engine_data
;
+
struct binject_file *bf = FILE_ENG_DATA(f)
;
/*
* don't block for min events == 0
/*
* don't block for min events == 0
@@
-155,7
+155,7
@@
static int fio_binject_getevents(struct thread_data *td, unsigned int min,
if (!min) {
for_each_file(td, f, i) {
if (!min) {
for_each_file(td, f, i) {
-
bf = (struct binject_file *) (uintptr_t) f->engine_data
;
+
struct binject_file *bf = FILE_ENG_DATA(f)
;
if (bd->fd_flags[i] == -1)
continue;
if (bd->fd_flags[i] == -1)
continue;
@@
-174,7
+174,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;
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 =
(struct binject_file *) (uintptr_t) io_u->file->engine_data
;
+ struct binject_file *bf =
FILE_ENG_DATA(io_u->file)
;
int ret;
ret = write(bf->fd, buc, sizeof(*buc));
int ret;
ret = write(bf->fd, buc, sizeof(*buc));
@@
-186,9
+186,9
@@
static int fio_binject_doio(struct thread_data *td, struct io_u *io_u)
static int fio_binject_prep(struct thread_data *td, struct io_u *io_u)
{
static int fio_binject_prep(struct thread_data *td, struct io_u *io_u)
{
- struct binject_data *bd = td->io_ops
->
data;
+ struct binject_data *bd = td->io_ops
_
data;
struct b_user_cmd *buc = &io_u->buc;
struct b_user_cmd *buc = &io_u->buc;
- struct binject_file *bf =
(struct binject_file *) (uintptr_t) io_u->file->engine_data
;
+ struct binject_file *bf =
FILE_ENG_DATA(io_u->file)
;
if (io_u->xfer_buflen & (bf->bs - 1)) {
log_err("read/write not sector aligned\n");
if (io_u->xfer_buflen & (bf->bs - 1)) {
log_err("read/write not sector aligned\n");
@@
-235,7
+235,7
@@
static int fio_binject_queue(struct thread_data *td, struct io_u *io_u)
static struct io_u *fio_binject_event(struct thread_data *td, int event)
{
static struct io_u *fio_binject_event(struct thread_data *td, int event)
{
- struct binject_data *bd = td->io_ops
->
data;
+ struct binject_data *bd = td->io_ops
_
data;
return bd->events[event];
}
return bd->events[event];
}
@@
-330,12
+330,12
@@
err_unmap:
static int fio_binject_close_file(struct thread_data *td, struct fio_file *f)
{
static int fio_binject_close_file(struct thread_data *td, struct fio_file *f)
{
- struct binject_file *bf =
(struct binject_file *) (uintptr_t) f->engine_data
;
+ struct binject_file *bf =
FILE_ENG_DATA(f)
;
if (bf) {
binject_unmap_dev(td, bf);
free(bf);
if (bf) {
binject_unmap_dev(td, bf);
free(bf);
-
f->engine_data = 0
;
+
FILE_SET_ENG_DATA(f, NULL)
;
return generic_close_file(td, f);
}
return generic_close_file(td, f);
}
@@
-352,7
+352,7
@@
static int fio_binject_open_file(struct thread_data *td, struct fio_file *f)
if (ret)
return 1;
if (ret)
return 1;
- if (f->filetype != FIO_TYPE_B
D
) {
+ if (f->filetype != FIO_TYPE_B
LOCK
) {
log_err("fio: binject only works with block devices\n");
goto err_close;
}
log_err("fio: binject only works with block devices\n");
goto err_close;
}
@@
-364,7
+364,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;
bf = malloc(sizeof(*bf));
bf->bs = bs;
bf->minor = bf->fd = -1;
-
f->engine_data = (uintptr_t) bf
;
+
FILE_SET_ENG_DATA(f, bf)
;
if (binject_map_dev(td, bf, f->fd)) {
err_close:
if (binject_map_dev(td, bf, f->fd)) {
err_close:
@@
-377,7
+377,7
@@
err_close:
static void fio_binject_cleanup(struct thread_data *td)
{
static void fio_binject_cleanup(struct thread_data *td)
{
- struct binject_data *bd = td->io_ops
->
data;
+ struct binject_data *bd = td->io_ops
_
data;
if (bd) {
free(bd->events);
if (bd) {
free(bd->events);
@@
-407,7
+407,7
@@
static int fio_binject_init(struct thread_data *td)
bd->fd_flags = malloc(sizeof(int) * td->o.nr_files);
memset(bd->fd_flags, 0, sizeof(int) * td->o.nr_files);
bd->fd_flags = malloc(sizeof(int) * td->o.nr_files);
memset(bd->fd_flags, 0, sizeof(int) * td->o.nr_files);
- td->io_ops
->
data = bd;
+ td->io_ops
_
data = bd;
return 0;
}
return 0;
}