]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
f70aedc4 | 2 | * Copyright (C) 1996-2021 The Squid Software Foundation and contributors |
bbc27441 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
0b30d52d | 9 | #ifndef __ASYNC_IO_H__ |
10 | #define __ASYNC_IO_H__ | |
02529124 | 11 | |
d9691f09 | 12 | #if HAVE_DISKIO_MODULE_AIO |
2513178d | 13 | |
be266cb2 | 14 | #if _SQUID_WINDOWS_ |
d9691f09 | 15 | #include "DiskIO/AIO/aio_win32.h" |
abb2a3d9 | 16 | #else |
27e059d4 | 17 | #if HAVE_AIO_H |
59b2d47f | 18 | #include <aio.h> |
abb2a3d9 | 19 | #endif |
27e059d4 | 20 | #endif |
0b30d52d | 21 | |
6f5dc9e4 | 22 | #include "mem/forward.h" |
02529124 | 23 | |
f53969cc | 24 | #define MAX_ASYNCOP 128 |
0b30d52d | 25 | |
26 | typedef enum { | |
f53969cc SM |
27 | AQ_STATE_NONE, /* Not active/uninitialised */ |
28 | AQ_STATE_SETUP /* Initialised */ | |
0b30d52d | 29 | } async_queue_state_t; |
30 | ||
31 | typedef enum { | |
b671cc68 | 32 | AQ_ENTRY_FREE, |
33 | AQ_ENTRY_USED | |
0b30d52d | 34 | } async_queue_entry_state_t; |
35 | ||
2887ac99 | 36 | typedef enum { |
b671cc68 | 37 | AQ_ENTRY_NONE, |
38 | AQ_ENTRY_READ, | |
39 | AQ_ENTRY_WRITE | |
2887ac99 | 40 | } async_queue_entry_type_t; |
41 | ||
0b30d52d | 42 | typedef struct _async_queue_entry async_queue_entry_t; |
62e76326 | 43 | |
0b30d52d | 44 | typedef struct _async_queue async_queue_t; |
45 | ||
46 | /* An async queue entry */ | |
62e76326 | 47 | |
b9ae18aa | 48 | class AIODiskFile; |
49 | ||
26ac0430 | 50 | struct _async_queue_entry { |
b671cc68 | 51 | async_queue_entry_state_t aq_e_state; |
52 | async_queue_entry_type_t aq_e_type; | |
62e76326 | 53 | |
51d345d0 AJ |
54 | /* 64-bit environments with non-GCC complain about the type mismatch on Linux */ |
55 | #if defined(__USE_FILE_OFFSET64) && !defined(__GNUC__) | |
56 | struct aiocb64 aq_e_aiocb; | |
57 | #else | |
b671cc68 | 58 | struct aiocb aq_e_aiocb; |
51d345d0 | 59 | #endif |
b9ae18aa | 60 | AIODiskFile *theFile; |
b671cc68 | 61 | void *aq_e_callback_data; |
62 | FREE *aq_e_free; | |
63 | int aq_e_fd; | |
64 | void *aq_e_buf; | |
0b30d52d | 65 | }; |
66 | ||
67 | /* An async queue */ | |
62e76326 | 68 | |
26ac0430 | 69 | struct _async_queue { |
b671cc68 | 70 | async_queue_state_t aq_state; |
f53969cc SM |
71 | async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */ |
72 | int aq_numpending; /* Num of pending ops */ | |
0b30d52d | 73 | }; |
74 | ||
d9691f09 | 75 | #endif /* HAVE_DISKIO_MODULE_AIO */ |
2513178d | 76 | #endif /* __ASYNC_IO_H_ */ |
f53969cc | 77 |