]>
Commit | Line | Data |
---|---|---|
59b2d47f | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
59b2d47f | 3 | * |
bbc27441 AJ |
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. | |
59b2d47f | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 47 Store Directory Routines */ |
10 | ||
b9ae18aa | 11 | #ifndef SQUID_BLOCKINGFILE_H |
12 | #define SQUID_BLOCKINGFILE_H | |
aa839030 | 13 | |
14 | #include "cbdata.h" | |
b9ae18aa | 15 | #include "DiskIO/DiskFile.h" |
63be0a78 | 16 | #include "DiskIO/IORequestor.h" |
59b2d47f | 17 | |
b9ae18aa | 18 | class BlockingFile : public DiskFile |
59b2d47f | 19 | { |
5c2f68b7 | 20 | CBDATA_CLASS(BlockingFile); |
59b2d47f | 21 | |
22 | public: | |
63be0a78 | 23 | BlockingFile(char const *path); |
b9ae18aa | 24 | ~BlockingFile(); |
63be0a78 | 25 | virtual void open(int flags, mode_t mode, RefCount<IORequestor> callback); |
26 | virtual void create(int flags, mode_t mode, RefCount<IORequestor> callback); | |
b9ae18aa | 27 | virtual void read(ReadRequest *); |
28 | virtual void write(WriteRequest *); | |
63be0a78 | 29 | virtual void close(); |
b9ae18aa | 30 | virtual bool error() const; |
31 | virtual int getFD() const { return fd;} | |
59b2d47f | 32 | |
b9ae18aa | 33 | virtual bool canRead() const; |
63be0a78 | 34 | virtual bool ioInProgress() const; |
59b2d47f | 35 | |
b9ae18aa | 36 | private: |
37 | static DRCB ReadDone; | |
38 | static DWCB WriteDone; | |
b9ae18aa | 39 | int fd; |
40 | bool closed; | |
41 | void error (bool const &); | |
42 | bool error_; | |
43 | char const *path_; | |
44 | RefCount<IORequestor> ioRequestor; | |
45 | RefCount<ReadRequest> readRequest; | |
46 | RefCount<WriteRequest> writeRequest; | |
47 | void doClose(); | |
48 | void readDone(int fd, const char *buf, int len, int errflag); | |
49 | void writeDone(int fd, int errflag, size_t len); | |
50 | }; | |
59b2d47f | 51 | |
b9ae18aa | 52 | #endif /* SQUID_BLOCKINGFILE_H */ |
f53969cc | 53 |