]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/AIO/async_io.h
Author: Leonid Evdokimov <leon@darkk.net.ru>
[thirdparty/squid.git] / src / DiskIO / AIO / async_io.h
1 #ifndef __ASYNC_IO_H__
2 #define __ASYNC_IO_H__
3
4 #if USE_DISKIO_AIO
5
6 #if _SQUID_WINDOWS_
7 #include "aio_win32.h"
8 #else
9 #if HAVE_AIO_H
10 #include <aio.h>
11 #endif
12 #endif
13
14 /* for FREE* */
15 #include "typedefs.h"
16
17 #define MAX_ASYNCOP 128
18
19 typedef enum {
20 AQ_STATE_NONE, /* Not active/uninitialised */
21 AQ_STATE_SETUP /* Initialised */
22 } async_queue_state_t;
23
24 typedef enum {
25 AQ_ENTRY_FREE,
26 AQ_ENTRY_USED
27 } async_queue_entry_state_t;
28
29 typedef enum {
30 AQ_ENTRY_NONE,
31 AQ_ENTRY_READ,
32 AQ_ENTRY_WRITE
33 } async_queue_entry_type_t;
34
35
36 typedef struct _async_queue_entry async_queue_entry_t;
37
38 typedef struct _async_queue async_queue_t;
39
40 /* An async queue entry */
41
42 class AIODiskFile;
43
44 struct _async_queue_entry {
45 async_queue_entry_state_t aq_e_state;
46 async_queue_entry_type_t aq_e_type;
47
48 struct aiocb aq_e_aiocb;
49 AIODiskFile *theFile;
50 void *aq_e_callback_data;
51 FREE *aq_e_free;
52 int aq_e_fd;
53 void *aq_e_buf;
54 };
55
56 /* An async queue */
57
58 struct _async_queue {
59 async_queue_state_t aq_state;
60 async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */
61 int aq_numpending; /* Num of pending ops */
62 };
63
64 #endif /* USE_DISKIO_AIO */
65 #endif /* __ASYNC_IO_H_ */