summaryrefslogtreecommitdiff
path: root/src/MultiFileAllocationIterator.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-03-28 12:46:13 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-03-28 12:46:13 +0000
commit6cbb6d28501eef19e82046886882a012f1b32ac0 (patch)
tree833e696d23b003cb53801920d9f041eed477a420 /src/MultiFileAllocationIterator.cc
parenta69f499ccf99642b7782cc2efae504c59cd2d07e (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.cc23
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()) {