Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-02-15 20:08:10 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-02-15 20:08:10 +0300
commit2c3586fb710d15bf67b92e472d11b9a9f85cbd06 (patch)
treece1b95c80a2fe6bcbfe97ae61dfd6c813e244d10
parent8a89e98108296dbceca12e1648f5bb4ce2ca2d01 (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.
-rw-r--r--CMakeLists.txt6
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/algorithm/contents.hpp2
-rw-r--r--include/llfio/v2.0/algorithm/reduce.hpp1
-rw-r--r--include/llfio/v2.0/detail/impl/clone.ipp4
-rw-r--r--include/llfio/v2.0/detail/impl/posix/file_handle.ipp12
-rw-r--r--include/llfio/v2.0/detail/impl/posix/fs_handle.ipp4
-rw-r--r--include/llfio/v2.0/detail/impl/posix/statfs.ipp2
-rw-r--r--include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp2
-rw-r--r--include/llfio/v2.0/detail/impl/windows/file_handle.ipp10
-rw-r--r--test-packaging/example.cpp4
11 files changed, 28 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53741b27..dec1ade8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
# LLFIO cmake
-# (C) 2016-2020 Niall Douglas <http://www.nedproductions.biz/>
+# (C) 2016-2021 Niall Douglas <http://www.nedproductions.biz/>
# File Created: June 2016
#
#
@@ -29,6 +29,8 @@ include(QuickCppLibPolicies)
option(LLFIO_USE_EXPERIMENTAL_SG14_STATUS_CODE "Whether to use SG14 status_code for failure handling" OFF)
option(LLFIO_ENABLE_DEPENDENCY_SMOKE_TEST "Whether to build executables which are smoke tests that LLFIO is fully working. Used by various package managers such as vcpkg." OFF)
+option(LLFIO_ASSUME_CROSS_COMPILING "Whether to assume we are cross compiling. Normally automatically detected, but if automatic detection doesn't work, a working <filesystem> will not be found during cmake configure." OFF)
+option(UNIT_TESTS_BUILD_ALL "Whether to run all of the unit test suite." OFF)
set(UNIT_TESTS_CXX_VERSION "latest" CACHE STRING "The version of C++ to use in the header-only unit tests")
ensure_git_subrepo("${CMAKE_CURRENT_SOURCE_DIR}/include/llfio/ntkernel-error-category/include" "https://github.com/ned14/ntkernel-error-category.git")
@@ -177,7 +179,7 @@ function(check_cxx_source_linkage prog var)
if(MSVC AND CMAKE_GENERATOR MATCHES "Ninja")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /EHsc")
endif()
- if(CMAKE_SYSTEM_PROCESSOR STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR} AND NOT LLFIO_ASSUME_CROSS_COMPILING)
check_cxx_source_runs("${prog}" ${var})
else()
check_cxx_source_compiles("${prog}" ${var})
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 &&currentfilepath_, 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
diff --git a/test-packaging/example.cpp b/test-packaging/example.cpp
index b64a98d2..006d59f5 100644
--- a/test-packaging/example.cpp
+++ b/test-packaging/example.cpp
@@ -31,11 +31,11 @@ int main()
namespace llfio = LLFIO_V2_NAMESPACE;
auto r = []() -> llfio::result<int> {
- OUTCOME_TRY(auto fh, llfio::file_handle::temp_file());
+ OUTCOME_TRY(auto &&fh, llfio::file_handle::temp_file());
static const char *buffers[] = { "He", "llo", " world" };
OUTCOME_TRY(fh.write(0, { { (const llfio::byte *) buffers[0], 2 }, { (const llfio::byte *) buffers[1], 3 }, { (const llfio::byte *) buffers[2], 6 } } ));
llfio::byte buffer[64];
- OUTCOME_TRY(auto read, fh.read(0, { {buffer, sizeof(buffer)} }));
+ OUTCOME_TRY(auto &&read, fh.read(0, { {buffer, sizeof(buffer)} }));
if(read != 11)
{
std::cerr << "FAILURE: Did not read 11 bytes!" << std::endl;