summaryrefslogtreecommitdiff
path: root/src/AdaptiveFileAllocationIterator.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-20 08:21:36 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-20 08:21:36 +0000
commit580098eb4929a3bdbf424af18da361259ef2efe5 (patch)
treec6ff77fa55fcbdcdd0ca21ec2105db14a8c050d3 /src/AdaptiveFileAllocationIterator.cc
parent3940da75624b194cdd5036f9fe330fcecc725964 (diff)
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten Logger interface. Logger now writes source file name and line number in log file.
Diffstat (limited to 'src/AdaptiveFileAllocationIterator.cc')
-rw-r--r--src/AdaptiveFileAllocationIterator.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/AdaptiveFileAllocationIterator.cc b/src/AdaptiveFileAllocationIterator.cc
index 347ae0df..8eeb5f99 100644
--- a/src/AdaptiveFileAllocationIterator.cc
+++ b/src/AdaptiveFileAllocationIterator.cc
@@ -45,9 +45,11 @@
namespace aria2 {
AdaptiveFileAllocationIterator::AdaptiveFileAllocationIterator
-(BinaryStream* stream, off_t offset, uint64_t totalLength):
- stream_(stream), offset_(offset), totalLength_(totalLength),
- logger_(LogFactory::getInstance()) {}
+(BinaryStream* stream, off_t offset, uint64_t totalLength)
+ : stream_(stream),
+ offset_(offset),
+ totalLength_(totalLength)
+{}
AdaptiveFileAllocationIterator::~AdaptiveFileAllocationIterator() {}
@@ -56,23 +58,17 @@ void AdaptiveFileAllocationIterator::allocateChunk()
if(!allocator_) {
#ifdef HAVE_FALLOCATE
try {
- if(logger_->debug()) {
- logger_->debug("Testing file system supports fallocate.");
- }
+ A2_LOG_DEBUG("Testing file system supports fallocate.");
if(static_cast<uint64_t>(offset_) < totalLength_) {
off_t len = std::min(totalLength_-offset_, static_cast<uint64_t>(4096));
stream_->allocate(offset_, len);
offset_ += len;
}
- if(logger_->debug()) {
- logger_->debug("File system supports fallocate.");
- }
+ A2_LOG_DEBUG("File system supports fallocate.");
allocator_.reset
(new FallocFileAllocationIterator(stream_, offset_, totalLength_));
} catch(RecoverableException& e) {
- if(logger_->debug()) {
- logger_->debug("File system does not support fallocate.");
- }
+ A2_LOG_DEBUG("File system does not support fallocate.");
SharedHandle<SingleFileAllocationIterator> salloc
(new SingleFileAllocationIterator(stream_, offset_, totalLength_));
salloc->init();