libaio: use container_of() instead of silly casting
authorJens Axboe <axboe@kernel.dk>
Wed, 2 Jan 2013 11:55:41 +0000 (12:55 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Jan 2013 11:57:23 +0000 (12:57 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Conflicts:
engines/libaio.c

Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/libaio.c

index bc459da1fcbaf5a310305cc4e4d2b63136c873a8..f17260d32911523b563d3c8493abcb3f67960eba 100644 (file)
@@ -14,8 +14,6 @@
 
 #ifdef FIO_HAVE_LIBAIO
 
-#define ev_to_iou(ev)  (struct io_u *) ((unsigned long) (ev)->obj)
-
 struct libaio_data {
        io_context_t aio_ctx;
        struct io_event *aio_events;
@@ -62,7 +60,7 @@ static struct io_u *fio_libaio_event(struct thread_data *td, int event)
        struct io_u *io_u;
 
        ev = ld->aio_events + event;
-       io_u = ev_to_iou(ev);
+       io_u = container_of(ev->obj, struct io_u, iocb);
 
        if (ev->res != io_u->xfer_buflen) {
                if (ev->res > io_u->xfer_buflen)