diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-02-15 20:08:10 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-02-15 20:08:10 +0300 |
commit | 2c3586fb710d15bf67b92e472d11b9a9f85cbd06 (patch) | |
tree | ce1b95c80a2fe6bcbfe97ae61dfd6c813e244d10 /include | |
parent | 8a89e98108296dbceca12e1648f5bb4ce2ca2d01 (diff) |
Port LLFIO to latest Outcome, whose TRY operation now uses value semantics for the unique temporary and therefore all TRY destinations ought to be rvalue refs.
Diffstat (limited to 'include')
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/algorithm/contents.hpp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/algorithm/reduce.hpp | 1 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/clone.ipp | 4 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/file_handle.ipp | 12 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/fs_handle.ipp | 4 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/statfs.ipp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/windows/file_handle.ipp | 10 |
9 files changed, 22 insertions, 21 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 0d040689..0002cc06 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define LLFIO_PREVIOUS_COMMIT_REF 46451d97a7c7d44af017f5b4eb138b7d34685df0 -#define LLFIO_PREVIOUS_COMMIT_DATE "2021-02-03 08:59:56 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE 46451d97 +#define LLFIO_PREVIOUS_COMMIT_REF 8a89e98108296dbceca12e1648f5bb4ce2ca2d01 +#define LLFIO_PREVIOUS_COMMIT_DATE "2021-02-04 09:26:19 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 8a89e981 diff --git a/include/llfio/v2.0/algorithm/contents.hpp b/include/llfio/v2.0/algorithm/contents.hpp index 813fa8eb..d17f257e 100644 --- a/include/llfio/v2.0/algorithm/contents.hpp +++ b/include/llfio/v2.0/algorithm/contents.hpp @@ -229,7 +229,7 @@ namespace algorithm visitor = &default_visitor; } contents_visitor::_state_type state(dirh); - OUTCOME_TRY(auto dirhpath, dirh.current_path()); + OUTCOME_TRY(auto &&dirhpath, dirh.current_path()); state.rootdirpathlen.store(dirhpath.native().size() + 1, std::memory_order_relaxed); OUTCOME_TRY(traverse(dirh, visitor, threads, &state, force_slow_path)); return {std::move(state.contents)}; diff --git a/include/llfio/v2.0/algorithm/reduce.hpp b/include/llfio/v2.0/algorithm/reduce.hpp index 856733ec..b84d8850 100644 --- a/include/llfio/v2.0/algorithm/reduce.hpp +++ b/include/llfio/v2.0/algorithm/reduce.hpp @@ -35,6 +35,7 @@ namespace algorithm { #ifdef _MSC_VER #pragma warning(push) +#pragma warning(disable : 4251) // dll interface #pragma warning(disable : 4275) // dll interface #endif /*! \brief A visitor for the filesystem traversal and reduction algorithm. diff --git a/include/llfio/v2.0/detail/impl/clone.ipp b/include/llfio/v2.0/detail/impl/clone.ipp index 12317038..93ef36df 100644 --- a/include/llfio/v2.0/detail/impl/clone.ipp +++ b/include/llfio/v2.0/detail/impl/clone.ipp @@ -63,7 +63,7 @@ namespace algorithm } } } - OUTCOME_TRY(auto dest, file_handle::file(destdir, destleaf, file_handle::mode::write, creation, src.kernel_caching())); + OUTCOME_TRY(auto &&dest, file_handle::file(destdir, destleaf, file_handle::mode::write, creation, src.kernel_caching())); bool failed = true; auto undest = make_scope_exit([&]() noexcept { if(failed) @@ -92,7 +92,7 @@ namespace algorithm { return errc::no_space_on_device; } - OUTCOME_TRY(auto copied, src.clone_extents_to(dest, d, force_copy_now, true)); + OUTCOME_TRY(auto &&copied, src.clone_extents_to(dest, d, force_copy_now, true)); failed = false; return copied.length; } diff --git a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp index aeae4ee7..d36d397a 100644 --- a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp @@ -443,7 +443,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte { return errc::bad_file_descriptor; } - OUTCOME_TRY(auto mycurrentlength, maximum_extent()); + OUTCOME_TRY(auto &&mycurrentlength, maximum_extent()); if(extent.offset == (extent_type) -1 && extent.length == (extent_type) -1) { extent.offset = 0; @@ -546,7 +546,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte return ret; } LLFIO_DEADLINE_TO_PARTIAL_DEADLINE(nd, d); - OUTCOME_TRY(auto written_, dest_.write({{&cb, 1}, destoffset}, nd)); + OUTCOME_TRY(auto &&written_, dest_.write({{&cb, 1}, destoffset}, nd)); const auto written = written_.front().size(); extent.offset += written; destoffset += written; @@ -668,7 +668,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte #endif // If cloning within the same file, use the appropriate direction auto &dest = static_cast<file_handle &>(dest_); - OUTCOME_TRY(auto dest_length, dest.maximum_extent()); + OUTCOME_TRY(auto &&dest_length, dest.maximum_extent()); if(dest.unique_id() == unique_id()) { if(abs((int64_t) destoffset - (int64_t) extent.offset) < (int64_t) blocksize) @@ -817,7 +817,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte deadline nd; buffer_type b(buffer, thisblock); LLFIO_DEADLINE_TO_PARTIAL_DEADLINE(nd, d); - OUTCOME_TRY(auto readed, read({{&b, 1}, item.src.offset + thisoffset}, nd)); + OUTCOME_TRY(auto &&readed, read({{&b, 1}, item.src.offset + thisoffset}, nd)); buffer_dirty = true; if(readed.front().size() != thisblock) { @@ -852,7 +852,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte cb = {(const byte *) ds, (size_t)(zs - ds)}; auto localoffset = cb.data() - readed.front().data(); // std::cout << "*** " << (item.src.offset + thisoffset + localoffset) << " - " << cb.size() << std::endl; - OUTCOME_TRY(auto written, dest.write({{&cb, 1}, item.src.offset + thisoffset + localoffset + destoffsetdiff}, nd)); + OUTCOME_TRY(auto &&written, dest.write({{&cb, 1}, item.src.offset + thisoffset + localoffset + destoffsetdiff}, nd)); if(written.front().size() != (size_t)(zs - ds)) { return errc::resource_unavailable_try_again; // something is wrong @@ -864,7 +864,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte else { // Straight write - OUTCOME_TRY(auto written, dest.write({{&cb, 1}, item.src.offset + thisoffset + destoffsetdiff}, nd)); + OUTCOME_TRY(auto &&written, dest.write({{&cb, 1}, item.src.offset + thisoffset + destoffsetdiff}, nd)); if(written.front().size() != thisblock) { return errc::resource_unavailable_try_again; // something is wrong diff --git a/include/llfio/v2.0/detail/impl/posix/fs_handle.ipp b/include/llfio/v2.0/detail/impl/posix/fs_handle.ipp index 9035f435..f59638e2 100644 --- a/include/llfio/v2.0/detail/impl/posix/fs_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/fs_handle.ipp @@ -68,7 +68,7 @@ namespace detail for(;;) { // Get current path for handle and open its containing dir - OUTCOME_TRY(auto _currentpath, h.current_path()); + OUTCOME_TRY(auto &&_currentpath, h.current_path()); // If current path is empty, it's been deleted if(_currentpath.empty()) { @@ -216,7 +216,7 @@ result<void> fs_handle::relink(const path_handle &base, path_view_type path, boo { OUTCOME_TRY(_fetch_inode()); } - OUTCOME_TRY(auto dirh, detail::containing_directory(std::ref(filename), h, *this, d)); + OUTCOME_TRY(auto &&dirh, detail::containing_directory(std::ref(filename), h, *this, d)); if(!atomic_replace) { // Linux has an extension for atomic non-replacing renames diff --git a/include/llfio/v2.0/detail/impl/posix/statfs.ipp b/include/llfio/v2.0/detail/impl/posix/statfs.ipp index b3e819b0..a853a418 100644 --- a/include/llfio/v2.0/detail/impl/posix/statfs.ipp +++ b/include/llfio/v2.0/detail/impl/posix/statfs.ipp @@ -164,7 +164,7 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<size_t> statfs_t::fill(const handle &h, s */ if(mountentries.size() > 1) { - OUTCOME_TRY(auto currentfilepath_, h.current_path()); + OUTCOME_TRY(auto &¤tfilepath_, h.current_path()); string_view currentfilepath(currentfilepath_.native()); std::vector<std::pair<size_t, size_t>> scores(mountentries.size()); //std::cout << "*** For matching mount entries to file with path " << currentfilepath << ":\n"; diff --git a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp index a234c668..fad232ec 100644 --- a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp @@ -322,7 +322,7 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<symlink_handle> symlink_handle::symlink(c dirhfd = base.native_handle().fd; dirh = const_cast<path_handle *>(&base); #else - OUTCOME_TRY(auto dh, base.clone()); + OUTCOME_TRY(auto &&dh, base.clone()); *dirh = path_handle(std::move(dh)); dirhfd = dirh->native_handle().fd; #endif diff --git a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp index 8c065f68..610f20b1 100644 --- a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp +++ b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp @@ -414,7 +414,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte { return errc::bad_file_descriptor; } - OUTCOME_TRY(auto mycurrentlength, maximum_extent()); + OUTCOME_TRY(auto &&mycurrentlength, maximum_extent()); if(extent.offset == (extent_type) -1 && extent.length == (extent_type) -1) { extent.offset = 0; @@ -582,7 +582,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte #endif // If cloning within the same file, use the appropriate direction auto &dest = static_cast<file_handle &>(dest_); - OUTCOME_TRY(auto dest_length, dest.maximum_extent()); + OUTCOME_TRY(auto &&dest_length, dest.maximum_extent()); if(dest.unique_id() == unique_id()) { if(abs((int64_t) destoffset - (int64_t) extent.offset) < (int64_t) blocksize) @@ -715,7 +715,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte deadline nd; buffer_type b(buffer, (size_type) thisblock); LLFIO_DEADLINE_TO_PARTIAL_DEADLINE(nd, d); - OUTCOME_TRY(auto readed, read({{&b, 1}, item.src.offset + thisoffset}, nd)); + OUTCOME_TRY(auto &&readed, read({{&b, 1}, item.src.offset + thisoffset}, nd)); buffer_dirty = true; if(readed.front().size() != thisblock) { @@ -750,7 +750,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte cb = {(const byte *) ds, (size_t)(zs - ds)}; auto localoffset = cb.data() - readed.front().data(); // std::cout << "*** " << (item.src.offset + thisoffset + localoffset) << " - " << cb.size() << std::endl; - OUTCOME_TRY(auto written, dest.write({{&cb, 1}, item.src.offset + thisoffset + localoffset + destoffsetdiff}, nd)); + OUTCOME_TRY(auto &&written, dest.write({{&cb, 1}, item.src.offset + thisoffset + localoffset + destoffsetdiff}, nd)); if(written.front().size() != (size_t)(zs - ds)) { return errc::resource_unavailable_try_again; // something is wrong @@ -762,7 +762,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte else { // Straight write - OUTCOME_TRY(auto written, dest.write({{&cb, 1}, item.src.offset + thisoffset + destoffsetdiff}, nd)); + OUTCOME_TRY(auto &&written, dest.write({{&cb, 1}, item.src.offset + thisoffset + destoffsetdiff}, nd)); if(written.front().size() != thisblock) { return errc::resource_unavailable_try_again; // something is wrong |