From af207e6cd8ea27b58a0e82f720d0fe75a33cd76b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 3 Oct 2010 13:31:58 +0000 Subject: 2010-10-03 Tatsuhiro Tsujikawa Print message when performing slow file allocation at first time. * src/SingleFileAllocationIterator.cc * src/SingleFileAllocationIterator.h --- src/SingleFileAllocationIterator.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/SingleFileAllocationIterator.cc') diff --git a/src/SingleFileAllocationIterator.cc b/src/SingleFileAllocationIterator.cc index 019c2ce7..96d91f76 100644 --- a/src/SingleFileAllocationIterator.cc +++ b/src/SingleFileAllocationIterator.cc @@ -33,18 +33,28 @@ */ /* copyright --> */ #include "SingleFileAllocationIterator.h" + +#include +#include + #include "BinaryStream.h" #include "util.h" #include "a2io.h" -#include -#include +#include "Logger.h" +#include "LogFactory.h" namespace aria2 { #define BUFSIZE (256*1024) #define ALIGNMENT 512 -SingleFileAllocationIterator::SingleFileAllocationIterator(BinaryStream* stream, off_t offset, uint64_t totalLength):stream_(stream), offset_(offset), totalLength_(totalLength), buffer_(0) +SingleFileAllocationIterator::SingleFileAllocationIterator +(BinaryStream* stream, off_t offset, uint64_t totalLength): + stream_(stream), + offset_(offset), + totalLength_(totalLength), + buffer_(0), + logger_(LogFactory::getInstance()) { if(offset_%ALIGNMENT != 0) { stream_->disableDirectIO(); @@ -62,6 +72,13 @@ SingleFileAllocationIterator::~SingleFileAllocationIterator() void SingleFileAllocationIterator::init() { + static bool noticeDone = false; + if(!noticeDone) { + noticeDone = true; + logger_->notice("Allocating disk space. Use --file-allocation=none to" + " disable it. See --file-allocation option in man page for" + " more details."); + } #ifdef HAVE_POSIX_MEMALIGN buffer_ = reinterpret_cast (util::allocateAlignedMemory(ALIGNMENT, BUFSIZE)); -- cgit