diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-27 05:20:58 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-27 05:20:58 +0000 |
| commit | c6df43611fecc455c2cabd6cfa33266c6a0a69b1 (patch) | |
| tree | daaa1e2b48993d171699aa21b4e467c0b7ab61de | |
| parent | ffa0818f59c247a50549a1418142179043058dc3 (diff) | |
2007-10-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added --no-file-allocation-limit command-line option.
Because this option's goal is to speed up simultaneous
multi-file
download for http/ftp, I decided to make BitTorrent download
ingore
this option.
* src/main.cc
* src/OptionHandlerFactory.cc
* src/RequestGroup.cc
* src/prefs.h
* doc/aria2c.1.txt
* doc/aria2c.1
| -rw-r--r-- | ChangeLog | 13 | ||||
| -rw-r--r-- | doc/aria2c.1 | 11 | ||||
| -rw-r--r-- | doc/aria2c.1.txt | 7 | ||||
| -rw-r--r-- | src/OptionHandlerFactory.cc | 3 | ||||
| -rw-r--r-- | src/RequestGroup.cc | 3 | ||||
| -rw-r--r-- | src/main.cc | 10 | ||||
| -rw-r--r-- | src/prefs.h | 2 |
7 files changed, 44 insertions, 5 deletions
@@ -1,3 +1,16 @@ +2007-10-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> + + Added --no-file-allocation-limit command-line option. + Because this option's goal is to speed up simultaneous multi-file + download for http/ftp, I decided to make BitTorrent download ingore + this option. + * src/main.cc + * src/OptionHandlerFactory.cc + * src/RequestGroup.cc + * src/prefs.h + * doc/aria2c.1.txt + * doc/aria2c.1 + 2007-10-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> Now prealloc is the default value for --file-allocation option. diff --git a/doc/aria2c.1 b/doc/aria2c.1 index 8d61d9ce..9dccdc10 100644 --- a/doc/aria2c.1 +++ b/doc/aria2c.1 @@ -1,11 +1,11 @@ .\" Title: aria2c .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/> -.\" Date: 09/10/2007 +.\" Date: 10/27/2007 .\" Manual: .\" Source: .\" -.TH "ARIA2C" "1" "09/10/2007" "" "" +.TH "ARIA2C" "1" "10/27/2007" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -193,7 +193,12 @@ or \fInone\fR doesn\'t pre\-allocate file space\. \fIprealloc\fR -pre\-allocates file space before download begins\. This may take some time depending on the size of the file\. Default: none +pre\-allocates file space before download begins\. This may take some time depending on the size of the file\. Default: prealloc +.RE +.PP +\-\-no\-file\-allocation\-limit=SIZE +.RS 4 +No file allocation is made for files whose size is smaller than SIZE\. You can append K or M(1K = 1024, 1M = 1024K)\. BitTorrent downloads ignore this option\. Default: 5M .RE .PP \-\-allow\-overwrite=true|false diff --git a/doc/aria2c.1.txt b/doc/aria2c.1.txt index 381a5213..3d4132ab 100644 --- a/doc/aria2c.1.txt +++ b/doc/aria2c.1.txt @@ -130,6 +130,13 @@ OPTIONS depending on the size of the file. Default: prealloc + --no-file-allocation-limit=SIZE:: + No file allocation is made for files whose + size is smaller than SIZE. + You can append K or M(1K = 1024, 1M = 1024K). + BitTorrent downloads ignore this option. + Default: 5M + --allow-overwrite=true|false:: If false, aria2 doesn't download a file which already exists but the corresponding .aria2 file diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 1f3634bc..691a80b7 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -96,7 +96,8 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() handlers.push_back(new DefaultOptionHandler(PREF_PEER_ID_PREFIX)); handlers.push_back(new BooleanOptionHandler(PREF_FORCE_SEQUENTIAL)); handlers.push_back(new BooleanOptionHandler(PREF_AUTO_FILE_RENAMING)); - handlers.push_back(new BooleanOptionHandler(PREF_PARAMETERIZED_URI)); + handlers.push_back(new BooleanOptionHandler(PREF_PARAMETERIZED_URI)); + handlers.push_back(new UnitNumberOptionHandler(PREF_NO_FILE_ALLOCATION_LIMIT, 0)); return handlers; } diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index 01e95a40..6297d38c 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -149,7 +149,8 @@ void RequestGroup::initAndOpenFile() bool RequestGroup::needsFileAllocation() const { return _option->get(PREF_FILE_ALLOCATION) == V_PREALLOC - && File(_segmentMan->getFilePath()).size() < _segmentMan->totalSize; + && File(_segmentMan->getFilePath()).size() < _segmentMan->totalSize + && _option->getAsLLInt(PREF_NO_FILE_ALLOCATION_LIMIT) < _segmentMan->totalSize; } bool RequestGroup::fileExists() const diff --git a/src/main.cc b/src/main.cc index 6ea331dd..11d63a16 100644 --- a/src/main.cc +++ b/src/main.cc @@ -192,6 +192,11 @@ void showUsage() { " before download begins. This may take some time\n" " depending on the size of the file.\n" " Default: prealloc") << endl; + cout << _(" --no-file-allocation-limit=SIZE No file allocation is made for files whose\n" + " size is smaller than SIZE.\n" + " You can append K or M(1K = 1024, 1M = 1024K).\n" + " BitTorrent downloads ignore this option.\n" + " Default: 5M") << endl; cout << _(" --allow-overwrite=true|false If false, aria2 doesn't download a file which\n" " already exists but the corresponding .aria2 file\n" " doesn't exist.\n" @@ -443,6 +448,7 @@ int main(int argc, char* argv[]) { op->put(PREF_STARTUP_IDLE_TIME, "10"); op->put(PREF_TRACKER_MAX_TRIES, "10"); op->put(PREF_FILE_ALLOCATION, V_PREALLOC); + op->put(PREF_NO_FILE_ALLOCATION_LIMIT, "5242880"); // 5MiB op->put(PREF_ALLOW_OVERWRITE, V_FALSE); op->put(PREF_REALTIME_CHUNK_CHECKSUM, V_TRUE); op->put(PREF_CHECK_INTEGRITY, V_FALSE); @@ -500,6 +506,7 @@ int main(int argc, char* argv[]) { { "force-sequential", optional_argument, 0, 'Z' }, { "auto-file-renaming", optional_argument, &lopt, 206 }, { "parameterized-uri", optional_argument, 0, 'P' }, + { "no-file-allocation-limit", required_argument, &lopt, 207 }, #if defined ENABLE_BITTORRENT || ENABLE_METALINK { "show-files", no_argument, NULL, 'S' }, { "select-file", required_argument, &lopt, 21 }, @@ -641,6 +648,9 @@ int main(int argc, char* argv[]) { case 206: cmdstream << PREF_AUTO_FILE_RENAMING << "=" << toBoolArg(optarg) << "\n"; break; + case 207: + cmdstream << PREF_NO_FILE_ALLOCATION_LIMIT << "=" << optarg << "\n"; + break; } break; } diff --git a/src/prefs.h b/src/prefs.h index 99e5efc8..b7b6de5d 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -87,6 +87,8 @@ // value: prealloc | none #define PREF_FILE_ALLOCATION "file-allocation" # define V_PREALLOC "prealloc" +#// value: 1*digit +#define PREF_NO_FILE_ALLOCATION_LIMIT "no-file-allocation-limit" // value: true | false #define PREF_ALLOW_OVERWRITE "allow-overwrite" // value: true | false |
