summaryrefslogtreecommitdiff
path: root/src/AbstractSingleDiskAdaptor.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-08-12 16:52:53 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-08-12 16:52:53 +0900
commitd734ff7d298d0abee4e6f75f94afd2d33e0c8fc6 (patch)
tree704597e9a322ca8fa85cf3db94ea51299e7fd076 /src/AbstractSingleDiskAdaptor.cc
parente2fcd6d72c577688160ce2ae3886edb67416525d (diff)
Added new file allocation method called 'trunc'
--file-allocation option can now take new value 'trunc'. 'trunc' uses ftruncate() system call or platform-specific counterpart to truncate a file to a specified length.
Diffstat (limited to 'src/AbstractSingleDiskAdaptor.cc')
-rw-r--r--src/AbstractSingleDiskAdaptor.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/AbstractSingleDiskAdaptor.cc b/src/AbstractSingleDiskAdaptor.cc
index 2f92655c..f87a6e86 100644
--- a/src/AbstractSingleDiskAdaptor.cc
+++ b/src/AbstractSingleDiskAdaptor.cc
@@ -37,6 +37,7 @@
#include "AdaptiveFileAllocationIterator.h"
#include "DiskWriter.h"
#include "FileEntry.h"
+#include "TruncFileAllocationIterator.h"
#ifdef HAVE_SOME_FALLOCATE
# include "FallocFileAllocationIterator.h"
#endif // HAVE_SOME_FALLOCATE
@@ -107,6 +108,12 @@ AbstractSingleDiskAdaptor::fileAllocationIterator()
return h;
}
#endif // HAVE_SOME_FALLOCATE
+ case(DiskAdaptor::FILE_ALLOC_TRUNC): {
+ SharedHandle<TruncFileAllocationIterator> h
+ (new TruncFileAllocationIterator
+ (diskWriter_.get(), size(), totalLength_));
+ return h;
+ }
default: {
SharedHandle<AdaptiveFileAllocationIterator> h
(new AdaptiveFileAllocationIterator