diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-28 12:46:13 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-28 12:46:13 +0000 |
| commit | 6cbb6d28501eef19e82046886882a012f1b32ac0 (patch) | |
| tree | 833e696d23b003cb53801920d9f041eed477a420 /src/MultiFileAllocationIterator.cc | |
| parent | a69f499ccf99642b7782cc2efae504c59cd2d07e (diff) | |
2009-03-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Guarded #ifdef HAVE_POSIX_FALLOCATE
* src/AbstractSingleDiskAdaptor.cc
* src/DefaultPieceStorage.cc
* src/DiskAdaptor.h
* src/DiskAdaptor.h
* src/MultiFileAllocationIterator.cc
Diffstat (limited to 'src/MultiFileAllocationIterator.cc')
| -rw-r--r-- | src/MultiFileAllocationIterator.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/MultiFileAllocationIterator.cc b/src/MultiFileAllocationIterator.cc index 647d4ebf..ff131573 100644 --- a/src/MultiFileAllocationIterator.cc +++ b/src/MultiFileAllocationIterator.cc @@ -36,7 +36,9 @@ #include "MultiDiskAdaptor.h" #include "FileEntry.h" #include "SingleFileAllocationIterator.h" -#include "FallocFileAllocationIterator.h" +#ifdef HAVE_POSIX_FALLOCATE +# include "FallocFileAllocationIterator.h" +#endif // HAVE_POSIX_FALLOCATE #include "DiskWriter.h" namespace aria2 { @@ -62,19 +64,22 @@ void MultiFileAllocationIterator::allocateChunk() _diskAdaptor->openIfNot(entry, &DiskWriterEntry::openFile); if(entry->needsFileAllocation() && entry->size() < fileEntry->getLength()) { // Calling private function of MultiDiskAdaptor. +#ifdef HAVE_POSIX_FALLOCATE if(_diskAdaptor->doesFallocate()) { _fileAllocationIterator.reset (new FallocFileAllocationIterator(entry->getDiskWriter().get(), entry->size(), fileEntry->getLength())); - } else { - SharedHandle<SingleFileAllocationIterator> fa - (new SingleFileAllocationIterator(entry->getDiskWriter().get(), - entry->size(), - fileEntry->getLength())); - fa->init(); - _fileAllocationIterator = fa; - } + } else +#endif // HAVE_POSIX_FALLOCATE + { + SharedHandle<SingleFileAllocationIterator> fa + (new SingleFileAllocationIterator(entry->getDiskWriter().get(), + entry->size(), + fileEntry->getLength())); + fa->init(); + _fileAllocationIterator = fa; + } } } if(finished()) { |
