DiskThreadsDiskFile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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/* DEBUG: section 79 Disk IO Routines */
10
11#ifndef SQUID_DISKTHREADSDISKFILE_H
12#define SQUID_DISKTHREADSDISKFILE_H
13
14#include "cbdata.h"
15#include "DiskIO/DiskFile.h"
16#include "DiskThreads.h"
17#include "typedefs.h" //for DWCB
18
20{
22
23public:
24 DiskThreadsDiskFile(char const *path);
26 virtual void open(int flags, mode_t mode, RefCount<IORequestor> callback);
27 virtual void create(int flags, mode_t mode, RefCount<IORequestor> callback);
28 virtual void read(ReadRequest *);
29 virtual void write(WriteRequest *);
30 virtual void close();
31 virtual bool error() const;
32 virtual int getFD() const { return fd;}
33
34 virtual bool canRead() const;
35 virtual bool canWrite() const;
36 virtual bool ioInProgress() const;
37
38private:
39#if ASYNC_READ
40
42#else
43
44 static DRCB ReadDone;
45#endif
46#if ASYNC_WRITE
47
48 static AIOCB WriteDone;
49#else
50
52#endif
53
54 int fd = -1;
55 bool errorOccured = false;
56 char const *path_ = nullptr;
57 size_t inProgressIOs = 0;
59 void openDone(int fd, const char *buf, int aio_return, int aio_errno);
61 void doClose();
62
63 void readDone(int fd, const char *buf, int len, int errflag, RefCount<ReadRequest> request);
64 void writeDone(int fd, int errflag, size_t len, RefCount<WriteRequest> request);
65};
66
67#include "DiskIO/ReadRequest.h"
68
69template <class RT>
71{
73
74public:
75 IoResult(RefCount<DiskThreadsDiskFile> aFile, RefCount<RT> aRequest) : file(aFile), request(aRequest) {}
76
79};
80
81template <class RT>
83IOResult(RefCount<RT> aRequest, RefCount<DiskThreadsDiskFile> aFile) { return IoResult<RT>(aFile, aRequest);}
84
85#endif /* SQUID_DISKTHREADSDISKFILE_H */
86
IoResult< RT > IOResult(RefCount< RT > aRequest, RefCount< DiskThreadsDiskFile > aFile)
void AIOCB(int fd, void *cbdata, const char *buf, int aio_return, int aio_errno)
Definition: DiskThreads.h:57
virtual bool error() const
void openDone(int fd, const char *buf, int aio_return, int aio_errno)
void writeDone(int fd, int errflag, size_t len, RefCount< WriteRequest > request)
virtual void create(int flags, mode_t mode, RefCount< IORequestor > callback)
virtual void write(WriteRequest *)
virtual int getFD() const
CBDATA_CLASS(DiskThreadsDiskFile)
virtual void open(int flags, mode_t mode, RefCount< IORequestor > callback)
virtual bool ioInProgress() const
DiskThreadsDiskFile(char const *path)
virtual bool canWrite() const
void readDone(int fd, const char *buf, int len, int errflag, RefCount< ReadRequest > request)
virtual void read(ReadRequest *)
virtual bool canRead() const
RefCount< IORequestor > ioRequestor
CBDATA_CLASS(IoResult)
RefCount< DiskThreadsDiskFile > file
IoResult(RefCount< DiskThreadsDiskFile > aFile, RefCount< RT > aRequest)
RefCount< RT > request
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
void DRCB(int, const char *buf, int size, int errflag, void *data)
Definition: typedefs.h:16
void DWCB(int, int, size_t, void *)
Definition: typedefs.h:18
unsigned short mode_t
Definition: types.h:150

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors