diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-25 05:43:07 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-25 05:43:07 +0000 |
| commit | 29c5ef9215be004b31cd53ef8841680c3f015d57 (patch) | |
| tree | acae3135c9240d627b30629c5a7594951a4cb688 /src/BinaryStream.h | |
| parent | fe614395d60da75836dbfb3f0a593d91b4024a89 (diff) | |
2009-03-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added 'falloc' parameter for --file-allocation option. 'falloc'
allocation mode uses posix_fallocate() system call to allocate
file on disk. If you are using newer file systems such as ext4
(with extents support), btrfs or xfs, 'falloc' is your best
choice. It allocates large(few GiB) files almost instantly.
Don't use 'falloc' with legacy file systems such as ext3 because
it takes almost same time as 'prealloc' and it blocks aria2
entirely until allocation finishes. 'falloc' may not be
available if your system doesn't have posix_fallocate() system
call.
* configure.ac
* src/AbstractDiskWriter.cc
* src/AbstractDiskWriter.h
* src/AbstractSingleDiskAdaptor.cc
* src/BinaryStream.h
* src/BtCheckIntegrityEntry.cc
* src/ByteArrayDiskWriter.h
* src/CheckIntegrityEntry.cc
* src/CheckIntegrityEntry.h
* src/DefaultPieceStorage.cc
* src/DiskAdaptor.cc
* src/DiskAdaptor.h
* src/DiskWriter.h
* src/FallocFileAllocationIterator.cc
* src/FallocFileAllocationIterator.h
* src/FileAllocationEntry.cc
* src/FileAllocationEntry.h
* src/Makefile.am
* src/MultiFileAllocationIterator.cc
* src/MultiFileAllocationIterator.h
* src/OptionHandlerFactory.cc
* src/RequestGroup.cc
* src/StreamCheckIntegrityEntry.cc
* src/prefs.cc
* src/prefs.h
* src/usage_text.h
* test/FallocFileAllocationIteratorTest.cc
* test/Makefile.am
Diffstat (limited to 'src/BinaryStream.h')
| -rw-r--r-- | src/BinaryStream.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/BinaryStream.h b/src/BinaryStream.h index 9af8b3bf..38688e44 100644 --- a/src/BinaryStream.h +++ b/src/BinaryStream.h @@ -36,9 +36,11 @@ #define _D_BINARY_STREAM_H_ #include "common.h" -#include "SharedHandle.h" + #include <unistd.h> +#include "SharedHandle.h" + namespace aria2 { class BinaryStream { @@ -49,7 +51,13 @@ public: virtual ssize_t readData(unsigned char* data, size_t len, off_t offset) = 0; - virtual void truncate(uint64_t length) = 0; + // Truncates a file to given length. The default implementation does + // nothing. + virtual void truncate(uint64_t length) {} + + // Allocates given length bytes of disk space from given offset. The + // default implementation does nothing. + virtual void allocate(off_t offset, uint64_t length) {} virtual void enableDirectIO() = 0; |
