source: squid-ssl/trunk/fuentes/src/DiskIO/AIO/async_io.h @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 1.6 KB
Line 
1/*
2 * Copyright (C) 1996-2015 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
9#ifndef __ASYNC_IO_H__
10#define __ASYNC_IO_H__
11
12#if USE_DISKIO_AIO
13
14#if _SQUID_WINDOWS_
15#include "aio_win32.h"
16#else
17#if HAVE_AIO_H
18#include <aio.h>
19#endif
20#endif
21
22/* for FREE* */
23#include "typedefs.h"
24
25#define MAX_ASYNCOP     128
26
27typedef enum {
28    AQ_STATE_NONE,      /* Not active/uninitialised */
29    AQ_STATE_SETUP      /* Initialised */
30} async_queue_state_t;
31
32typedef enum {
33    AQ_ENTRY_FREE,
34    AQ_ENTRY_USED
35} async_queue_entry_state_t;
36
37typedef enum {
38    AQ_ENTRY_NONE,
39    AQ_ENTRY_READ,
40    AQ_ENTRY_WRITE
41} async_queue_entry_type_t;
42
43typedef struct _async_queue_entry async_queue_entry_t;
44
45typedef struct _async_queue async_queue_t;
46
47/* An async queue entry */
48
49class AIODiskFile;
50
51struct _async_queue_entry {
52    async_queue_entry_state_t aq_e_state;
53    async_queue_entry_type_t aq_e_type;
54
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
59    struct aiocb aq_e_aiocb;
60#endif
61    AIODiskFile *theFile;
62    void *aq_e_callback_data;
63    FREE *aq_e_free;
64    int aq_e_fd;
65    void *aq_e_buf;
66};
67
68/* An async queue */
69
70struct _async_queue {
71    async_queue_state_t aq_state;
72    async_queue_entry_t aq_queue[MAX_ASYNCOP];  /* queued ops */
73    int aq_numpending;      /* Num of pending ops */
74};
75
76#endif /* USE_DISKIO_AIO */
77#endif /* __ASYNC_IO_H_ */
78
Note: See TracBrowser for help on using the repository browser.