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 SQUID_SRC_DISKIO_AIO_ASYNC_IO_H
10 #define SQUID_SRC_DISKIO_AIO_ASYNC_IO_H
11 
12 #if HAVE_DISKIO_MODULE_AIO
13 
14 #if _SQUID_WINDOWS_
15 #include "DiskIO/AIO/aio_win32.h"
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 
26 typedef enum {
27  AQ_STATE_NONE, /* Not active/uninitialised */
28  AQ_STATE_SETUP /* Initialised */
29 } async_queue_state_t;
30 
31 typedef enum {
32  AQ_ENTRY_FREE,
33  AQ_ENTRY_USED
34 } async_queue_entry_state_t;
35 
36 typedef enum {
37  AQ_ENTRY_NONE,
38  AQ_ENTRY_READ,
39  AQ_ENTRY_WRITE
40 } async_queue_entry_type_t;
41 
42 typedef struct _async_queue_entry async_queue_entry_t;
43 
44 typedef struct _async_queue async_queue_t;
45 
46 /* An async queue entry */
47 
48 class AIODiskFile;
49 
50 struct _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 
69 struct _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 /* SQUID_SRC_DISKIO_AIO_ASYNC_IO_H */
77 
void FREE(void *)
Definition: forward.h:37

 

Introduction

Documentation

Support

Miscellaneous