From 45495090aa6bc285446174d46ad8e1bef8551ca1 Mon Sep 17 00:00:00 2001 From: Jeff Moyer Date: Tue, 30 Mar 2004 22:04:57 +0000 Subject: o Fix header file to allow inclusion from c++ code. o Fix compatibility routines, thanks to Daniel @ osdl. o Shared library is now libaio.so.1.0.0 and links are created for libaio.so.1 and libaio.so. --- src/Makefile | 3 ++- src/compat-0_1.c | 34 ++++++++++++++++++++++++++++++++-- src/libaio.h | 11 ++++++++++- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index 9971d40..a1d6c84 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,7 +8,7 @@ SO_CFLAGS=-shared $(CFLAGS) L_CFLAGS=$(CFLAGS) LINK_FLAGS= -soname=libaio.so.1 +soname=libaio.so.1.0.0 all_targets += libaio.a $(soname) all: $(all_targets) @@ -51,6 +51,7 @@ install: $(all_targets) install -D -m 644 libaio.h $(includedir)/libaio.h install -D -m 644 libaio.a $(libdir)/libaio.a install -D -m 755 $(soname) $(libdir)/$(soname) + ln -sf $(soname) $(libdir)/libaio.so.1 ln -sf $(soname) $(libdir)/libaio.so $(libaio_objs): libaio.h diff --git a/src/compat-0_1.c b/src/compat-0_1.c index d689bff..343a33f 100644 --- a/src/compat-0_1.c +++ b/src/compat-0_1.c @@ -27,6 +27,28 @@ #include "syscall.h" +/* + * Compatible interfaces that still need an entry point. + */ + +SYMVER(compat0_1_io_queue_init, io_queue_init, 0.1); +int compat0_1_io_queue_init(int maxevents, io_context_t *ctxp) +{ + return io_queue_init(maxevents, ctxp); +} + +SYMVER(compat0_1_io_queue_run, io_queue_run, 0.1); +int compat0_1_io_queue_run(io_context_t ctx) +{ + return io_queue_run(ctx); +} + +SYMVER(compat0_1_io_submit, io_submit, 0.1); +int compat0_1_io_submit(io_context_t ctx, long nr, struct iocb **iocbs) +{ + return io_submit(ctx, nr, iocbs); +} + /* ABI change. Provide partial compatibility on this one for now. */ SYMVER(compat0_1_io_cancel, io_cancel, 0.1); int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb) @@ -38,11 +60,19 @@ int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb) } SYMVER(compat0_1_io_queue_wait, io_queue_wait, 0.1); -int compat0_1_io_queue_wait(io_context_t ctx, struct iocb *iocb, const struct timespec *when) +int compat0_1_io_queue_wait(io_context_t ctx, struct timespec *when) { - return -ENOSYS; + struct timespec timeout; + if (when) + timeout = *when; + return io_getevents(ctx, 0, 0, NULL, when ? &timeout : NULL); } +SYMVER(compat0_1_io_queue_release, io_queue_release, 0.1); +int compat0_1_io_queue_release(io_context_t ctx) +{ + return io_destroy(ctx); +} /* ABI change. Provide backwards compatibility for this one. */ SYMVER(compat0_1_io_getevents, io_getevents, 0.1); diff --git a/src/libaio.h b/src/libaio.h index fd2e626..c78a1eb 100644 --- a/src/libaio.h +++ b/src/libaio.h @@ -22,6 +22,11 @@ */ #ifndef __LIBAIO_H #define __LIBAIO_H + +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -139,7 +144,7 @@ extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_eve static inline void io_set_callback(struct iocb *iocb, io_callback_t cb) { - iocb->data = cb; + iocb->data = (void *)cb; } static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) @@ -210,4 +215,8 @@ static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t c return io_submit(ctx, 1, &iocb); } +#ifdef __cplusplus +} #endif + +#endif /* __LIBAIO_H */ -- cgit v1.2.1