mirror of https://github.com/aria2/aria2
2010-10-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Print message when performing slow file allocation at first time. * src/SingleFileAllocationIterator.cc * src/SingleFileAllocationIterator.hpull/1/head
parent
32d4ffa8ee
commit
af207e6cd8
|
@ -1,3 +1,9 @@
|
||||||
|
2010-10-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Print message when performing slow file allocation at first time.
|
||||||
|
* src/SingleFileAllocationIterator.cc
|
||||||
|
* src/SingleFileAllocationIterator.h
|
||||||
|
|
||||||
2010-10-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-10-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed compile error on OpenBSD4.7(i386). In openssl.m4, we first
|
Fixed compile error on OpenBSD4.7(i386). In openssl.m4, we first
|
||||||
|
|
|
@ -33,18 +33,28 @@
|
||||||
*/
|
*/
|
||||||
/* copyright --> */
|
/* copyright --> */
|
||||||
#include "SingleFileAllocationIterator.h"
|
#include "SingleFileAllocationIterator.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "BinaryStream.h"
|
#include "BinaryStream.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "a2io.h"
|
#include "a2io.h"
|
||||||
#include <cstring>
|
#include "Logger.h"
|
||||||
#include <cstdlib>
|
#include "LogFactory.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
#define BUFSIZE (256*1024)
|
#define BUFSIZE (256*1024)
|
||||||
#define ALIGNMENT 512
|
#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) {
|
if(offset_%ALIGNMENT != 0) {
|
||||||
stream_->disableDirectIO();
|
stream_->disableDirectIO();
|
||||||
|
@ -62,6 +72,13 @@ SingleFileAllocationIterator::~SingleFileAllocationIterator()
|
||||||
|
|
||||||
void SingleFileAllocationIterator::init()
|
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
|
#ifdef HAVE_POSIX_MEMALIGN
|
||||||
buffer_ = reinterpret_cast<unsigned char*>
|
buffer_ = reinterpret_cast<unsigned char*>
|
||||||
(util::allocateAlignedMemory(ALIGNMENT, BUFSIZE));
|
(util::allocateAlignedMemory(ALIGNMENT, BUFSIZE));
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
class BinaryStream;
|
class BinaryStream;
|
||||||
|
class Logger;
|
||||||
|
|
||||||
class SingleFileAllocationIterator:public FileAllocationIterator
|
class SingleFileAllocationIterator:public FileAllocationIterator
|
||||||
{
|
{
|
||||||
|
@ -51,6 +52,8 @@ private:
|
||||||
uint64_t totalLength_;
|
uint64_t totalLength_;
|
||||||
|
|
||||||
unsigned char* buffer_;
|
unsigned char* buffer_;
|
||||||
|
|
||||||
|
Logger* logger_;
|
||||||
public:
|
public:
|
||||||
SingleFileAllocationIterator(BinaryStream* stream, off_t offset, uint64_t totalLength);
|
SingleFileAllocationIterator(BinaryStream* stream, off_t offset, uint64_t totalLength);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue