async_io.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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 HAVE_DISKIO_MODULE_AIO
13
14#if _SQUID_WINDOWS_
16#else
17#if HAVE_AIO_H
18#include <aio.h>
19#endif
20#endif
21
22#include "mem/forward.h"
23
24#define MAX_ASYNCOP 128
25
26typedef enum {
27 AQ_STATE_NONE, /* Not active/uninitialised */
28 AQ_STATE_SETUP /* Initialised */
29} async_queue_state_t;
30
31typedef enum {
32 AQ_ENTRY_FREE,
33 AQ_ENTRY_USED
34} async_queue_entry_state_t;
35
36typedef enum {
37 AQ_ENTRY_NONE,
38 AQ_ENTRY_READ,
39 AQ_ENTRY_WRITE
40} async_queue_entry_type_t;
41
42typedef struct _async_queue_entry async_queue_entry_t;
43
44typedef struct _async_queue async_queue_t;
45
46/* An async queue entry */
47
48class AIODiskFile;
49
50struct _async_queue_entry {
51 async_queue_entry_state_t aq_e_state;
52 async_queue_entry_type_t aq_e_type;
53
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
58 struct aiocb aq_e_aiocb;
59#endif
60 AIODiskFile *theFile;
61 void *aq_e_callback_data;
62 FREE *aq_e_free;
63 int aq_e_fd;
64 void *aq_e_buf;
65};
66
67/* An async queue */
68
69struct _async_queue {
70 async_queue_state_t aq_state;
71 async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */
72 int aq_numpending; /* Num of pending ops */
73};
74
75#endif /* HAVE_DISKIO_MODULE_AIO */
76#endif /* __ASYNC_IO_H_ */
77
void FREE(void *)
Definition: forward.h:37

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors