From f5c112eefc4ad76ded8e477404b319032178213a Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 20 Mar 2016 16:31:17 -0400 Subject: [PATCH 1/2] remove remaining references to storage_mode_compact (since it's been deprecated for quite a while now, and no longer implemented) --- bindings/c/libtorrent.h | 5 ++--- bindings/python/src/session.cpp | 3 --- include/libtorrent/storage_defs.hpp | 11 ++--------- test/test_storage.cpp | 18 +++++++----------- test/test_transfer.cpp | 11 ----------- test/web_seed_suite.cpp | 3 --- 6 files changed, 11 insertions(+), 40 deletions(-) diff --git a/bindings/c/libtorrent.h b/bindings/c/libtorrent.h index d90ade47c..f761cae6e 100644 --- a/bindings/c/libtorrent.h +++ b/bindings/c/libtorrent.h @@ -129,8 +129,7 @@ enum proxy_type_t enum storage_mode_t { storage_mode_allocate = 0, - storage_mode_sparse, - storage_mode_compact + storage_mode_sparse }; enum state_t @@ -144,7 +143,7 @@ enum state_t allocating, checking_resume_data }; - + struct torrent_status { enum state_t state; diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index ac011917e..3aca92eb7 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -663,9 +663,6 @@ void bind_session() enum_("storage_mode_t") .value("storage_mode_allocate", storage_mode_allocate) .value("storage_mode_sparse", storage_mode_sparse) -#ifndef TORRENT_NO_DEPRECATE - .value("storage_mode_compact", storage_mode_compact) -#endif ; enum_("options_t") diff --git a/include/libtorrent/storage_defs.hpp b/include/libtorrent/storage_defs.hpp index 3d47280ad..ed870c7f4 100644 --- a/include/libtorrent/storage_defs.hpp +++ b/include/libtorrent/storage_defs.hpp @@ -55,14 +55,7 @@ namespace libtorrent // All pieces will be written to the place where they belong and sparse files // will be used. This is the recommended, and default mode. - storage_mode_sparse, - - // internal - internal_storage_mode_compact_deprecated -#ifndef TORRENT_NO_DEPRECATE - , // comma here to avoid compiler warning - storage_mode_compact = internal_storage_mode_compact_deprecated -#endif + storage_mode_sparse }; // see default_storage::default_storage() @@ -78,7 +71,7 @@ namespace libtorrent std::vector const* priorities; // optional torrent_info const* info; // optional }; - + typedef boost::function storage_constructor_type; // the constructor function for the regular file storage. This is the diff --git a/test/test_storage.cpp b/test/test_storage.cpp index d4c2b255a..0a898e3d5 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -478,10 +478,6 @@ void test_check_files(std::string const& test_path io.set_num_threads(0); } -#ifdef TORRENT_NO_DEPRECATE -#define storage_mode_compact storage_mode_sparse -#endif - // TODO: 2 split this test up into smaller parts void run_test(bool unbuffered) { @@ -531,7 +527,7 @@ void run_test(bool unbuffered) std::cerr << "=== test 1 === " << (unbuffered?"unbuffered":"buffered") << std::endl; // run_storage_tests writes piece 0, 1 and 2. not 3 - run_storage_tests(info, fs, test_path, storage_mode_compact, unbuffered); + run_storage_tests(info, fs, test_path, storage_mode_sparse, unbuffered); // make sure the files have the correct size std::string base = combine_path(test_path, "temp_storage"); @@ -575,7 +571,7 @@ void run_test(bool unbuffered) std::cerr << "=== test 3 ===" << std::endl; - run_storage_tests(info, fs, test_path, storage_mode_compact, unbuffered); + run_storage_tests(info, fs, test_path, storage_mode_sparse, unbuffered); TEST_EQUAL(file_size(combine_path(test_path, combine_path("temp_storage", "test1.tmp"))), piece_size * 3); remove_all(combine_path(test_path, "temp_storage"), ec); @@ -608,7 +604,7 @@ void run_test(bool unbuffered) std::cerr << "=== test 6 ===" << std::endl; test_check_files(test_path, storage_mode_sparse, unbuffered); - test_check_files(test_path, storage_mode_compact, unbuffered); + test_check_files(test_path, storage_mode_sparse, unbuffered); std::cerr << "=== test 7 ===" << std::endl; test_rename(test_path); @@ -653,7 +649,7 @@ TORRENT_TEST(fastresume) add_torrent_params p; p.ti = boost::make_shared(boost::cref(*t)); p.save_path = combine_path(test_path, "tmp1"); - p.storage_mode = storage_mode_compact; + p.storage_mode = storage_mode_sparse; torrent_handle h = ses.add_torrent(p, ec); TEST_CHECK(exists(combine_path(p.save_path, "temporary"))); if (!exists(combine_path(p.save_path, "temporary"))) @@ -714,7 +710,7 @@ TORRENT_TEST(fastresume) p.flags &= ~add_torrent_params::flag_auto_managed; p.ti = boost::make_shared(boost::cref(*t)); p.save_path = combine_path(test_path, "tmp1"); - p.storage_mode = storage_mode_compact; + p.storage_mode = storage_mode_sparse; bencode(std::back_inserter(p.resume_data), resume); torrent_handle h = ses.add_torrent(p, ec); @@ -769,7 +765,7 @@ TORRENT_TEST(rename_file_fastresume) add_torrent_params p; p.ti = boost::make_shared(boost::cref(*t)); p.save_path = combine_path(test_path, "tmp2"); - p.storage_mode = storage_mode_compact; + p.storage_mode = storage_mode_sparse; torrent_handle h = ses.add_torrent(p, ec); h.rename_file(0, "testing_renamed_files"); @@ -817,7 +813,7 @@ TORRENT_TEST(rename_file_fastresume) add_torrent_params p; p.ti = boost::make_shared(boost::cref(*t)); p.save_path = combine_path(test_path, "tmp2"); - p.storage_mode = storage_mode_compact; + p.storage_mode = storage_mode_sparse; bencode(std::back_inserter(p.resume_data), resume); torrent_handle h = ses.add_torrent(p, ec); diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index cb00755da..c13e253fb 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -431,14 +431,3 @@ TORRENT_TEST(allocate) cleanup(); } -#ifndef TORRENT_NO_DEPRECATE -TORRENT_TEST(compact) -{ - using namespace libtorrent; - fprintf(stderr, "compact mode\n"); - test_transfer(0, settings_pack(), false, storage_mode_compact); - - cleanup(); -} -#endif - diff --git a/test/web_seed_suite.cpp b/test/web_seed_suite.cpp index cc2c7141b..55d674c8e 100644 --- a/test/web_seed_suite.cpp +++ b/test/web_seed_suite.cpp @@ -139,9 +139,6 @@ void test_transfer(lt::session& ses, boost::shared_ptr torrent_fil p.flags |= add_torrent_params::flag_sequential_download; p.ti = torrent_file; p.save_path = save_path; -#ifndef TORRENT_NO_DEPRECATE - p.storage_mode = storage_mode_compact; -#endif torrent_handle th = ses.add_torrent(p, ec); printf("adding torrent, save_path = \"%s\" cwd = \"%s\" torrent = \"%s\"\n" , save_path.c_str(), current_working_directory().c_str() From e8693465a56b7305b6f168d58f04a6d2321c8827 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 20 Mar 2016 19:14:46 -0400 Subject: [PATCH 2/2] remove more references to compact storage allocation --- bindings/python/client.py | 6 ------ docs/manual.rst | 12 +----------- include/libtorrent/error_code.hpp | 4 ++-- include/libtorrent/storage.hpp | 11 ----------- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/bindings/python/client.py b/bindings/python/client.py index 4408e8895..10cd91ddb 100755 --- a/bindings/python/client.py +++ b/bindings/python/client.py @@ -168,9 +168,6 @@ def main(): parser.add_option('-s', '--save-path', type='string', help='the path where the downloaded file/folder should be placed.') - parser.add_option('-a', '--allocation-mode', - type='string', help='sets mode used for allocating the downloaded files on disk. Possible options are [full | compact]') - parser.add_option('-r', '--proxy-host', type='string', help='sets HTTP proxy host and port (separated by \':\')') @@ -179,7 +176,6 @@ def main(): , max_download_rate=0 , max_upload_rate=0 , save_path='.' - , allocation_mode='compact' , proxy_host='' ) @@ -196,8 +192,6 @@ def main(): if options.max_download_rate <= 0: options.max_download_rate = -1 - compact_allocation = options.allocation_mode == 'compact' - settings = lt.session_settings() settings.user_agent = 'python_client/' + lt.version diff --git a/docs/manual.rst b/docs/manual.rst index 48768ed7a..d012c99c4 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -522,7 +522,7 @@ The file format is a bencoded dictionary containing the following fields: | | re-check is issued. | +--------------------------+--------------------------------------------------------------+ | ``allocation`` | The allocation mode for the storage. Can be either ``full`` | -| | or ``compact``. If this is full, the file sizes and | +| | or ``sparse``. If this is full, the file sizes and | | | timestamps are disregarded. Pieces are assumed not to have | | | moved around even if the files have been modified after the | | | last resume data checkpoint. | @@ -541,16 +541,6 @@ There are two modes in which storage (files on disk) are allocated in libtorrent 2. The *sparse allocation*, sparse files are used, and pieces are downloaded directly to where they belong. This is the recommended (and default) mode. -In previous versions of libtorrent, a 3rd mode was supported, *compact -allocation*. Support for this is deprecated and will be removed in future -versions of libtorrent. It's still described in here for completeness. - -The allocation mode is selected when a torrent is started. It is passed as an -argument to session::add_torrent() or session::async_add_torrent(). - -The decision to use full allocation or compact allocation typically depends on -whether any files have priority 0 and if the filesystem supports sparse files. - sparse allocation ----------------- diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index e8c9f63d8..6dac8d7ff 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -365,7 +365,7 @@ namespace libtorrent // The 'blocks per piece' entry is invalid in the resume data file invalid_blocks_per_piece, // The resume file is missing the 'slots' entry, which is required - // for torrents with compact allocation + // for torrents with compact allocation. *DEPRECATED* missing_slots, // The resume file contains more slots than the torrent too_many_slots, @@ -376,7 +376,7 @@ namespace libtorrent // The pieces on disk needs to be re-ordered for the specified // allocation mode. This happens if you specify sparse allocation // and the files on disk are using compact storage. The pieces needs - // to be moved to their right position + // to be moved to their right position. *DEPRECATED* pieces_need_reorder, // this error is returned when asking to save resume data and // specifying the flag to only save when there's anything new to save diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index 3474b229c..da894d7f9 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -153,17 +153,6 @@ namespace libtorrent namespace aux { struct session_settings; } struct cached_piece_entry; - TORRENT_EXTRA_EXPORT std::vector > get_filesizes( - file_storage const& t - , std::string const& p); - - TORRENT_EXTRA_EXPORT bool match_filesizes( - file_storage const& t - , std::string const& p - , std::vector > const& sizes - , bool compact_mode - , std::string* error = 0); - TORRENT_EXTRA_EXPORT int copy_bufs(file::iovec_t const* bufs, int bytes, file::iovec_t* target); TORRENT_EXTRA_EXPORT void advance_bufs(file::iovec_t*& bufs, int bytes); TORRENT_EXTRA_EXPORT void clear_bufs(file::iovec_t const* bufs, int num_bufs);