/* */ #include "FileAllocationEntry.h" #include "FileAllocationIterator.h" #include "DownloadEngine.h" #include "RequestGroup.h" #include "PieceStorage.h" #include "DiskAdaptor.h" namespace aria2 { FileAllocationEntry::FileAllocationEntry(RequestGroup* requestGroup, Command* nextCommand): RequestGroupEntry(requestGroup, nextCommand), fileAllocationIterator_(requestGroup->getPieceStorage()->getDiskAdaptor()->fileAllocationIterator()) { getRequestGroup()->getPieceStorage()->getDiskAdaptor()->enableDirectIO(); } FileAllocationEntry:: ~FileAllocationEntry() { getRequestGroup()->getPieceStorage()->getDiskAdaptor()->disableDirectIO(); } off_t FileAllocationEntry::getCurrentLength() { return fileAllocationIterator_->getCurrentLength(); } uint64_t FileAllocationEntry::getTotalLength() { return fileAllocationIterator_->getTotalLength(); } bool FileAllocationEntry::finished() { return fileAllocationIterator_->finished(); } void FileAllocationEntry::allocateChunk() { fileAllocationIterator_->allocateChunk(); } void FileAllocationEntry::disableDirectIO() { getRequestGroup()->getPieceStorage()->getDiskAdaptor()->disableDirectIO(); } } // namespace aria2