#ifndef WH_IMPL_H_b516b12a_ #define WH_IMPL_H_b516b12a_ /* This file is in the public domain. */ #include #include "aio.h" typedef struct blockfn BLOCKFN; typedef struct bimpl BIMPL; typedef struct iofd IOFD; struct aio_loop { IOFD **iofds; int niofds; void *bfns; struct pollfd *pfds; int pfdn; int pfdmax; int haveblock; int justloop; int addedblock; } ; struct blockfn { int (*fn)(void *); void *arg; unsigned int flags; #define BFF_DEAD 0x00000001 } ; struct bimpl { void *(*init)(void); void (*cleanup)(void *); int (*validid)(void *, int); int (*new)(void *, BLOCKFN *); void (*remove)(void *, int); int (*anyblock)(void *); void (*iter)(AIO_LOOP **, int, int (*)(BLOCKFN *, void *), void *); int (*getorder)(void *, int); } ; #define BIMPL_INIT(prefix) {\ &prefix##_init, \ &prefix##_cleanup, \ &prefix##_validid, \ &prefix##_new, \ &prefix##_remove, \ &prefix##_anyblock, \ &prefix##_iter, \ &prefix##_getorder \ } #define panic aio__panic extern void aio__panic(const char *, ...) __attribute__((__format__(__printf__,1,2))); #define dequal(x) (((char *)0)+(((const volatile char *)(x))-((const volatile char *)0))) extern char aio__order_used __attribute__((__weak__)); extern BIMPL aio__bimpl_simple; // see block-simple.c for why not weak extern BIMPL aio__bimpl_avl __attribute__((__weak__)); extern int aio__internalize_block_id(AIO_LOOP *, int); #ifdef DEBUG_BUILD extern void aio__trace_s(const char *); extern void aio__trace_append(const void *, int); extern int aio__tracing(void); #else #define aio__trace_s(x) do ; while (0) #define aio__trace_append(x,y) do ; while (0) #define aio__tracing() (0) #endif #endif