]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DiskIO/AIO/async_io.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / DiskIO / AIO / async_io.h
CommitLineData
bbc27441
AJ
1/*
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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
2513178d
AJ
12#if USE_DISKIO_AIO
13
be266cb2 14#if _SQUID_WINDOWS_
abb2a3d9 15#include "aio_win32.h"
16#else
27e059d4 17#if HAVE_AIO_H
59b2d47f 18#include <aio.h>
abb2a3d9 19#endif
27e059d4 20#endif
0b30d52d 21
02529124
AJ
22/* for FREE* */
23#include "typedefs.h"
24
f53969cc 25#define MAX_ASYNCOP 128
0b30d52d 26
27typedef enum {
f53969cc
SM
28 AQ_STATE_NONE, /* Not active/uninitialised */
29 AQ_STATE_SETUP /* Initialised */
0b30d52d 30} async_queue_state_t;
31
32typedef enum {
b671cc68 33 AQ_ENTRY_FREE,
34 AQ_ENTRY_USED
0b30d52d 35} async_queue_entry_state_t;
36
2887ac99 37typedef enum {
b671cc68 38 AQ_ENTRY_NONE,
39 AQ_ENTRY_READ,
40 AQ_ENTRY_WRITE
2887ac99 41} async_queue_entry_type_t;
42
0b30d52d 43typedef struct _async_queue_entry async_queue_entry_t;
62e76326 44
0b30d52d 45typedef struct _async_queue async_queue_t;
46
47/* An async queue entry */
62e76326 48
b9ae18aa 49class AIODiskFile;
50
26ac0430 51struct _async_queue_entry {
b671cc68 52 async_queue_entry_state_t aq_e_state;
53 async_queue_entry_type_t aq_e_type;
62e76326 54
51d345d0
AJ
55 /* 64-bit environments with non-GCC complain about the type mismatch on Linux */
56#if defined(__USE_FILE_OFFSET64) && !defined(__GNUC__)
57 struct aiocb64 aq_e_aiocb;
58#else
b671cc68 59 struct aiocb aq_e_aiocb;
51d345d0 60#endif
b9ae18aa 61 AIODiskFile *theFile;
b671cc68 62 void *aq_e_callback_data;
63 FREE *aq_e_free;
64 int aq_e_fd;
65 void *aq_e_buf;
0b30d52d 66};
67
68/* An async queue */
62e76326 69
26ac0430 70struct _async_queue {
b671cc68 71 async_queue_state_t aq_state;
f53969cc
SM
72 async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */
73 int aq_numpending; /* Num of pending ops */
0b30d52d 74};
75
2513178d
AJ
76#endif /* USE_DISKIO_AIO */
77#endif /* __ASYNC_IO_H_ */
f53969cc 78