26 #include <QSharedPointer>
27 #include <util/constants.h>
31 class PreallocationThread;
41 virtual ~MMappeable() {}
54 class CacheFile :
public QObject
73 void open(
const QString & path,Uint64 size);
87 void*
map(
MMappeable* thing,Uint64 off,Uint32 size,Mode mode);
94 void unmap(
void* ptr,Uint32 size);
108 void read(Uint8* buf,Uint32 size,Uint64 off);
116 void write(
const Uint8* buf,Uint32 size,Uint64 off);
126 typedef QSharedPointer<CacheFile> Ptr;
129 void growFile(Uint64 to_write);
130 void closeTemporary();
131 void openFile(Mode mode);
133 bool allocateBytes(bt::Uint64 off,bt::Uint64 size);
141 Uint64 max_size,file_size;
152 QMap<void*,Entry> mappings;
153 mutable QMutex mutex;