4 * Internal declarations for the DiskThreads routines
7 #ifndef __DISKTHREADS_H__
8 #define __DISKTHREADS_H__
10 #ifdef AUFS_IO_THREADS
11 #define NUMTHREADS AUFS_IO_THREADS
13 #define NUMTHREADS (Config.cacheSwap.n_configured*16)
16 /* Queue limit where swapouts are deferred (load calculation) */
17 #define MAGIC1 (NUMTHREADS*Config.cacheSwap.n_configured*5)
18 /* Queue limit where swapins are deferred (open/create fails) */
19 #define MAGIC2 (NUMTHREADS*Config.cacheSwap.n_configured*20)
21 /* Which operations to run async */
24 #define ASYNC_CREATE 1
28 enum _squidaio_request_type
{
39 typedef enum _squidaio_request_type squidaio_request_type
;
41 typedef void AIOCB(int fd
, void *cbdata
, const char *buf
, int aio_return
, int aio_errno
);
43 struct squidaio_result_t
47 enum _squidaio_request_type result_type
;
48 void *_data
; /* Internal housekeeping */
49 void *data
; /* Available to the caller */
52 struct squidaio_ctrl_t
55 struct squidaio_ctrl_t
*next
;
59 void *done_handler_data
;
60 squidaio_result_t result
;
67 void squidaio_init(void);
68 void squidaio_shutdown(void);
69 int squidaio_cancel(squidaio_result_t
*);
70 int squidaio_open(const char *, int, mode_t
, squidaio_result_t
*);
71 int squidaio_read(int, char *, int, off_t
, int, squidaio_result_t
*);
72 int squidaio_write(int, char *, int, off_t
, int, squidaio_result_t
*);
73 int squidaio_close(int, squidaio_result_t
*);
75 int squidaio_stat(const char *, struct stat
*, squidaio_result_t
*);
76 int squidaio_unlink(const char *, squidaio_result_t
*);
77 int squidaio_truncate(const char *, off_t length
, squidaio_result_t
*);
78 int squidaio_opendir(const char *, squidaio_result_t
*);
79 squidaio_result_t
*squidaio_poll_done(void);
80 int squidaio_operations_pending(void);
81 int squidaio_sync(void);
82 int squidaio_get_queue_len(void);
83 void *squidaio_xmalloc(int size
);
84 void squidaio_xfree(void *p
, int size
);
85 void squidaio_stats(StoreEntry
*);
90 void aioOpen(const char *, int, mode_t
, AIOCB
*, void *);
92 void aioWrite(int, int offset
, char *, int size
, AIOCB
*, void *, FREE
*);
93 void aioRead(int, int offset
, int size
, AIOCB
*, void *);
95 void aioStat(char *, struct stat
*, AIOCB
*, void *);
96 void aioUnlink(const char *, AIOCB
*, void *);
97 void aioTruncate(const char *, off_t length
, AIOCB
*, void *);
98 int aioQueueSize(void);
100 #include "DiskIO/DiskFile.h"
102 class DiskThreadsIOStrategy
;
122 extern AIOCounts squidaio_counts
;
123 extern dlink_list used_list
;