BlockingFile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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 47 Store Directory Routines */
10
11#ifndef SQUID_BLOCKINGFILE_H
12#define SQUID_BLOCKINGFILE_H
13
14#include "cbdata.h"
15#include "DiskIO/DiskFile.h"
16#include "DiskIO/IORequestor.h"
17#include "typedefs.h" //DRCB, DWCB
18
19class BlockingFile : public DiskFile
20{
22
23public:
24 BlockingFile(char const *path);
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;
36
37private:
38 static DRCB ReadDone;
40 int fd;
41 bool closed;
42 void error (bool const &);
43 bool error_;
44 char const *path_;
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};
52
53#endif /* SQUID_BLOCKINGFILE_H */
54
void write(WriteRequest *) override
void readDone(int fd, const char *buf, int len, int errflag)
RefCount< ReadRequest > readRequest
Definition: BlockingFile.h:46
void create(int flags, mode_t mode, RefCount< IORequestor > callback) override
Definition: BlockingFile.cc:62
char const * path_
Definition: BlockingFile.h:44
RefCount< WriteRequest > writeRequest
Definition: BlockingFile.h:47
RefCount< IORequestor > ioRequestor
Definition: BlockingFile.h:45
bool error() const override
Definition: BlockingFile.cc:94
bool canRead() const override
Definition: BlockingFile.cc:88
BlockingFile(char const *path)
Definition: BlockingFile.cc:25
bool ioInProgress() const override
void read(ReadRequest *) override
int getFD() const override
Definition: BlockingFile.h:32
void close() override
Definition: BlockingFile.cc:79
static DWCB WriteDone
Definition: BlockingFile.h:39
void open(int flags, mode_t mode, RefCount< IORequestor > callback) override
Definition: BlockingFile.cc:39
CBDATA_CLASS(BlockingFile)
void doClose()
Definition: BlockingFile.cc:68
~BlockingFile() override
Definition: BlockingFile.cc:32
void writeDone(int fd, int errflag, size_t len)
static DRCB ReadDone
Definition: BlockingFile.h:38
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:144

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors