]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DiskIO/Blocking/BlockingFile.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / DiskIO / Blocking / BlockingFile.h
CommitLineData
59b2d47f 1/*
b8ae064d 2 * Copyright (C) 1996-2023 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
ff9d9458
FC
11#ifndef SQUID_SRC_DISKIO_BLOCKING_BLOCKINGFILE_H
12#define SQUID_SRC_DISKIO_BLOCKING_BLOCKINGFILE_H
aa839030 13
14#include "cbdata.h"
b9ae18aa 15#include "DiskIO/DiskFile.h"
63be0a78 16#include "DiskIO/IORequestor.h"
e1ba42a4 17#include "typedefs.h" //DRCB, DWCB
59b2d47f 18
b9ae18aa 19class BlockingFile : public DiskFile
59b2d47f 20{
5c2f68b7 21 CBDATA_CLASS(BlockingFile);
59b2d47f 22
23public:
63be0a78 24 BlockingFile(char const *path);
337b9aa4
AR
25 ~BlockingFile() override;
26 void open(int flags, mode_t mode, RefCount<IORequestor> callback) override;
27 void create(int flags, mode_t mode, RefCount<IORequestor> callback) override;
28 void read(ReadRequest *) override;
29 void write(WriteRequest *) override;
30 void close() override;
31 bool error() const override;
32 int getFD() const override { return fd;}
33
34 bool canRead() const override;
35 bool ioInProgress() const override;
59b2d47f 36
b9ae18aa 37private:
38 static DRCB ReadDone;
39 static DWCB WriteDone;
b9ae18aa 40 int fd;
41 bool closed;
42 void error (bool const &);
43 bool error_;
44 char const *path_;
45 RefCount<IORequestor> ioRequestor;
46 RefCount<ReadRequest> readRequest;
47 RefCount<WriteRequest> writeRequest;
48 void doClose();
49 void readDone(int fd, const char *buf, int len, int errflag);
50 void writeDone(int fd, int errflag, size_t len);
51};
59b2d47f 52
ff9d9458 53#endif /* SQUID_SRC_DISKIO_BLOCKING_BLOCKINGFILE_H */
f53969cc 54