DiskThreadsDiskFile.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
23 public:
24  DiskThreadsDiskFile(char const *path, DiskThreadsIOStrategy *);
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 
38 private:
39 #if ASYNC_READ
40 
41  static AIOCB ReadDone;
42 #else
43 
44  static DRCB ReadDone;
45 #endif
46 #if ASYNC_WRITE
47 
48  static AIOCB WriteDone;
49 #else
50 
51  static DWCB WriteDone;
52 #endif
53 
54  int fd;
56  char const *path_;
58  size_t inProgressIOs;
59  static AIOCB OpenDone;
60  void openDone(int fd, const char *buf, int aio_return, int aio_errno);
62  void doClose();
63 
64  void readDone(int fd, const char *buf, int len, int errflag, RefCount<ReadRequest> request);
65  void writeDone(int fd, int errflag, size_t len, RefCount<WriteRequest> request);
66 };
67 
68 #include "DiskIO/ReadRequest.h"
69 
70 template <class RT>
71 class IoResult
72 {
74 
75 public:
76  IoResult(RefCount<DiskThreadsDiskFile> aFile, RefCount<RT> aRequest) : file(aFile), request(aRequest) {}
77 
80 };
81 
82 template <class RT>
84 IOResult(RefCount<RT> aRequest, RefCount<DiskThreadsDiskFile> aFile) { return IoResult<RT>(aFile, aRequest);}
85 
86 #endif /* SQUID_DISKTHREADSDISKFILE_H */
87 
virtual void create(int flags, mode_t mode, RefCount< IORequestor > callback)
void const char HLPCB * callback
Definition: stub_helper.cc:16
IoResult< RT > IOResult(RefCount< RT > aRequest, RefCount< DiskThreadsDiskFile > aFile)
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
virtual bool error() const
void DWCB(int, int, size_t, void *)
Definition: typedefs.h:18
void readDone(int fd, const char *buf, int len, int errflag, RefCount< ReadRequest > request)
void openDone(int fd, const char *buf, int aio_return, int aio_errno)
DiskThreadsDiskFile(char const *path, DiskThreadsIOStrategy *)
DiskThreadsIOStrategy * IO
RefCount< DiskThreadsDiskFile > file
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
virtual void write(WriteRequest *)
void DRCB(int, const char *buf, int size, int errflag, void *data)
Definition: typedefs.h:16
void const char * buf
Definition: stub_helper.cc:16
virtual bool ioInProgress() const
unsigned short mode_t
Definition: types.h:150
virtual void open(int flags, mode_t mode, RefCount< IORequestor > callback)
RefCount< RT > request
CBDATA_CLASS(IoResult)
void writeDone(int fd, int errflag, size_t len, RefCount< WriteRequest > request)
RefCount< IORequestor > ioRequestor
virtual bool canRead() const
virtual void read(ReadRequest *)
void AIOCB(int fd, void *cbdata, const char *buf, int aio_return, int aio_errno)
Definition: DiskThreads.h:57
virtual int getFD() const
CBDATA_CLASS(DiskThreadsDiskFile)
virtual bool canWrite() const
IoResult(RefCount< DiskThreadsDiskFile > aFile, RefCount< RT > aRequest)

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors