]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/Mmapped/MmappedFile.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_MMAPPEDFILE_H
10 #define SQUID_MMAPPEDFILE_H
13 #include "DiskIO/DiskFile.h"
14 #include "DiskIO/IORequestor.h"
16 class MmappedFile
: public DiskFile
18 CBDATA_CLASS(MmappedFile
);
21 MmappedFile(char const *path
);
23 virtual void open(int flags
, mode_t mode
, RefCount
<IORequestor
> callback
);
24 virtual void create(int flags
, mode_t mode
, RefCount
<IORequestor
> callback
);
25 virtual void read(ReadRequest
*);
26 virtual void write(WriteRequest
*);
28 virtual bool error() const;
29 virtual int getFD() const { return fd
;}
31 virtual bool canRead() const;
32 virtual bool canWrite() const;
33 virtual bool ioInProgress() const;
37 RefCount
<IORequestor
> ioRequestor
;
38 //RefCount<ReadRequest> readRequest;
39 //RefCount<WriteRequest> writeRequest;
42 // mmapped memory leads to SEGV and bus errors if it maps beyond file
43 int64_t minOffset
; ///< enforced if not negative (to preserve file headers)
44 int64_t maxOffset
; ///< enforced if not negative (to avoid crashes)
51 #endif /* SQUID_MMAPPEDFILE_H */