Commit Graph

338 Commits

Author SHA1 Message Date
arvidn 9df4d4b7f8 replace typedef with using. replace NULL with nullptr. cleanup page_aligned_allocator 2018-03-23 11:19:46 +01:00
arvidn 720bfa54cd merged RC_1_1 into master 2018-01-29 01:20:08 +01:00
arvidn b729021625 make coalesce-buffers work on windows and systemps with pwritev()/preadv() 2018-01-28 23:05:01 +01:00
arvidn f29bb69612 fix error handling of unsupported hard-links 2018-01-13 08:36:48 -05:00
arvidn 65fef972a2 apply some c++11 modernization 2018-01-11 04:51:39 -05:00
arvidn 244d18dcf8 merged RC_1_1 into master 2017-10-17 09:38:51 +02:00
arvidn 205fe5e7ea fix full allocation failure on APFS 2017-10-16 00:08:10 +02:00
Andrei Kurushin c8d51689bb backport: fix windows file preallocation issue 2017-09-28 12:53:28 -07:00
Andrei Kurushin 6e396a85c2 fix windows file preallocation issue 2017-09-28 02:14:20 +03:00
arvidn 65d16142aa remove redundant null check 2017-09-18 00:51:26 +02:00
Steven Siloti 0232dc35cd deprecate lock_files (#2344)
File locking interacts poorly with the path to replace a read only file handle
with a read/write one. For performance reasons the old handle is not closed
until the new one is put in place. With file locking this obviously cannot
work because the first handle is holding a lock on the file. As a result,
file_pool::open_file fails in this case. Even if we dropped the reference to
the read only file handle before attempting to re-open it, the open could still
fail if another thread is holding a reference to the read only handle.

There doesn't seem to be a good way around this. The simple solution would be
to always open files in read/write mode, but that has obvious safety downsides.
Any other solution would significantly complicate the file pool code.
Deprecating file locking seems to be the least bad option.
2017-09-17 10:43:27 +02:00
Alden Torres 582d9dfc24 removed leading :: in posix_fadvise to allow for fix in old android API build (#2341) 2017-09-16 13:47:49 +02:00
arvidn 93bb84d94c some random cleanup 2017-09-13 08:28:46 +02:00
Alden Torres cb114a80e1 reverted ino_t cast and added fix only for android 2017-08-04 21:22:20 +02:00
Alden Torres 35232a5a5f fixed -Wshorten-64-to-32 in 32 bits and explicit nullptr check 2017-08-04 06:07:18 +02:00
Steven Siloti 140b8ace8d remove use of deprecated function readdir_r 2017-07-22 22:40:17 -07:00
arvidn c4afb5e949 use a dedicated class template for flags types instead of enum class. It's more backwards compatible and improves ergonomics 2017-07-15 01:15:57 -07:00
arvidn 5c37eb174f drop support for windows compilers without std::string and wchar_t (believed to be old cygwin) 2017-07-02 08:24:55 -04:00
arvidn b80c477733 merged RC_1_1 into master 2017-06-16 00:24:41 -04:00
Steven Siloti a48cdd0281 fix check for fully allocated file on windows
The file allocation size is in terms of clusters so it will likely be larger
than the file size even with a freshly allocated file.
2017-06-15 06:36:34 -04:00
arvidn ffaabd846c make file open mode flags be an enum class for type-safety 2017-05-28 11:16:59 -04:00
arvidn 749d0da875 make iovec_t an alias for span<char>, in preparation for removing it altogether in favour of span 2017-04-30 11:49:08 -04:00
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -04:00
arvidn 79d7ae3638 separate path and filesystem functions out into its own translation unit/header file pair, separating it from the file and directory class 2017-04-11 18:07:55 -04:00
Arvid Norberg 13b16a63a3 use unsigned type for file flags. make file_pool private to disk_io_thread (#1894)
use unsigned type for file flags. make file_pool private to disk_io_thread. move close_file_interval logic to the disk thread. don't expose file in public interface, and make pool_file_status properly public (not part of file_pool and renamed to open_file_status), this is exposed in public interface via torrent_handle::file_status()
2017-04-08 18:24:50 -04:00
Alden Torres a8b10a7449 more sign warnings fixes (#1775)
more sign warnings fixes
2017-03-09 07:46:52 -05:00
Andrei Kurushin 9bee2146d0 complete UNC path support (#1689)
complete UNC path support. all internal file api functions handle long size paths (> MAX_PATH) and special names (CON,PRN ...) with unit test
2017-02-16 23:47:08 -05:00
Alden Torres de6f2a9d88 fixing sign-conversion warnings, part 11, created aux::array and refactor (#1649)
fixing sign-conversion warnings, part 11, created aux::array and refactor
2017-02-04 22:05:53 -05:00
Alden Torres 3803661863 moved alloca.hpp to private aux_ and size refactor (#1634)
moved alloca.hpp to private aux_ and size refactor
2017-01-27 12:43:34 -05:00
Arvid Norberg 3d06371f31 factor out some common storage utilities out of storage.cpp (#1515)
factor out some common storage utilities out of storage.cpp
2017-01-11 00:42:10 -05:00
arvidn d1ea80c2c3 remove disk-access-log build configuration 2017-01-09 08:37:02 -05:00
arvidn 1d1ab4f4b5 removed file-leak code, temporarily used to trouble-shoot files appearing to be left open 2017-01-09 01:43:15 -05:00
arvidn 0c7e86078b merged RC_1_1 into master 2017-01-08 10:18:41 -05:00
arvidn 7957e2a30e fix move_storage() to its own directory (would delete the files) 2017-01-03 21:09:26 -05:00
Andrei Kurushin e10edb5e0b move LoadLibrary logic to new win_util module (#1464)
move LoadLibrary logic to new win_util module. use get_library_procedure as common windows dyn proc load routine
2016-12-28 10:12:20 -08:00
Andrei Kurushin 1ec5c69dcd minor code corrections (#1430)
use compact span cast. extend split_path api with only_first_part flag. use single loadlibrary and getprocaddress for IP helper
2016-12-26 22:45:48 -08:00
Alden Torres eaf99aa42b fixed more warnings of shorten-64-to-32 and sign-compare in android (#1425)
fixed more warnings of -Wshorten-64-to-32 in android. changed file_status to use std::time and disable warnings of NLMSG_OK in clang
2016-12-18 10:59:41 -05:00
Alden Torres 22b596945e enable /W4 warnings for msvc 2016-12-13 19:36:14 -05:00
Alden Torres f382936d56 headers, end of file, code cleanup 2016-12-12 23:36:45 -05:00
Alden Torres dd7179fb10 added a few consts to arguments and local variables 2016-12-10 18:19:14 -05:00
Alden Torres e73435a77b fixed shorten-64-to-32 warnings for clang 2016-12-10 08:57:08 -05:00
Alden Torres d5c4cd7280 fixed sign-compare warnings and some refactor (#1354)
fixed sign-compare warnings and some refactor. make sequence_number backed by std::int64_t
2016-11-27 08:46:53 -05:00
arvidn 0e33e62627 merged RC_1_1 into master 2016-11-20 11:18:16 -05:00
arvidn 4df1ecbe25 re-enable some warnings and fix code 2016-11-20 01:05:16 -05:00
Steven Siloti f5366bd816 use span for scatter/gather lists (#1260)
use span for gather/scatter buffers. remove explicit size parameter from file_op
2016-10-26 20:40:56 -04:00
Alden Torres 4eebd0c68a minor refactor, compilation fix when DEBUG_DISK_THREAD and missing convert_to_native (#1256) 2016-10-25 20:46:23 -04:00
Steven Siloti a6e5ba8804 return a span from TORRENT_ALLOCA (#1244)
return a span from TORRENT_ALLOCA

Unfortunately this requires moving the variable declaration inside the macro.
Due to alloca’s unique properties pretty much the only safe way to call it is
in a simple assign-to-pointer expression. Therefor we need to use a temporary
pointer to store the value returned from alloca before we can call span’s ctor.

This also causes double evaluation of the size parameter which is unfortunate,
but no current callers of TORRENT_ALLOCA have a problem with this. Passing
expressions with side effects to macros is bad mojo anyways.
2016-10-22 14:43:40 -04:00
Alden Torres fe754453f4 backport of fix for LFS support in android (#1232) 2016-10-20 00:14:03 -04:00
Alden Torres 5f04103a9d ensure posix calls with LFS support are used in android (#1226) 2016-10-19 13:00:03 -04:00
Arvid Norberg 5f7e2eb928 run undefined sanitier on travis/linux (#1134)
run undefined sanitizer on travis/linux. back-port ed25519 unit test from master
2016-10-08 12:29:46 -04:00