diff --git a/cmake/headers.cmake b/cmake/headers.cmake index 9a091b8fb..abcea0369 100644 --- a/cmake/headers.cmake +++ b/cmake/headers.cmake @@ -31,7 +31,6 @@ set(llfio_HEADERS "include/llfio/v2.0/llfio.hpp" "include/llfio/v2.0/logging.hpp" "include/llfio/v2.0/map_handle.hpp" - "include/llfio/v2.0/map_view.hpp" "include/llfio/v2.0/mapped.hpp" "include/llfio/v2.0/mapped_file_handle.hpp" "include/llfio/v2.0/native_handle_type.hpp" diff --git a/example/use_cases.cpp b/example/use_cases.cpp index 9237f5e1c..1daf07f73 100644 --- a/example/use_cases.cpp +++ b/example/use_cases.cpp @@ -224,7 +224,7 @@ void malloc1() mh.do_not_store({mh.address(), mh.length()}).value(); // Fill the memory with 'b' C++ style, probably faulting new pages into existence - llfio::map_view p2(mh); + llfio::attached p2(mh); std::fill(p2.begin(), p2.end(), 'b'); // Kick the contents of the memory out to the swap file so it is no longer cached in RAM @@ -380,7 +380,7 @@ void sparse_array() (void) mfh.truncate(1000000000000ULL * sizeof(int)); // Create a typed view of the one trillion integers - llfio::map_view one_trillion_int_array(mfh); + llfio::attached one_trillion_int_array(mfh); // Write and read as you see fit, if you exceed physical RAM it'll be paged out one_trillion_int_array[0] = 5; diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index d10488650..ec7c60444 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 d9720b3670a8d481f202842d973f82b360a467e3 -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-05-24 19:26:26 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE d9720b36 +#define LLFIO_PREVIOUS_COMMIT_REF 19115c0eb238e6ab5e159c246d88ff551b134e9c +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-05-24 19:51:21 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 19115c0e diff --git a/include/llfio/v2.0/detail/impl/posix/path_discovery.ipp b/include/llfio/v2.0/detail/impl/posix/path_discovery.ipp index 675c84654..1c4b0d8b0 100644 --- a/include/llfio/v2.0/detail/impl/posix/path_discovery.ipp +++ b/include/llfio/v2.0/detail/impl/posix/path_discovery.ipp @@ -26,7 +26,7 @@ Distributed under the Boost Software License, Version 1.0. #error Must be included by ../path_discovery.ipp only #endif -#include "../../../map_view.hpp" +#include "../../../mapped_file_handle.hpp" #include @@ -77,7 +77,7 @@ namespace path_discovery } else { - map_view passwd(_passwdh.value()); + attached passwd(_passwdh.value()); /* This will consist of lines of the form: jsmith:x:1001:1000:Joe Smith,Room 1007,(234)555-8910,(234)555-0044,email:/home/jsmith:/bin/sh diff --git a/include/llfio/v2.0/llfio.hpp b/include/llfio/v2.0/llfio.hpp index b438dcd78..a33318af3 100644 --- a/include/llfio/v2.0/llfio.hpp +++ b/include/llfio/v2.0/llfio.hpp @@ -68,7 +68,7 @@ import LLFIO_MODULE_NAME; #include "file_handle.hpp" #endif #include "directory_handle.hpp" -#include "map_view.hpp" +#include "mapped.hpp" #include "statfs.hpp" #ifndef LLFIO_LEAN_AND_MEAN #include "storage_profile.hpp" diff --git a/include/llfio/v2.0/map_view.hpp b/include/llfio/v2.0/map_view.hpp deleted file mode 100644 index 75bab5b05..000000000 --- a/include/llfio/v2.0/map_view.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/* A typed view of a mapped section -(C) 2017-2018 Niall Douglas (12 commits) -File Created: Aug 2017 - - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License in the accompanying file -Licence.txt or at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -Distributed under the Boost Software License, Version 1.0. - (See accompanying file Licence.txt or copy at - http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef LLFIO_MAP_VIEW_HPP -#define LLFIO_MAP_VIEW_HPP - -#include "mapped.hpp" - -//! \file map_view.hpp Provides typed view of mapped section. - -LLFIO_V2_NAMESPACE_BEGIN - -/*! \brief Provides a lightweight typed view of a `map_handle`, a `mapped_file_handle` -or a `mapped` suitable for feeding to STL algorithms or the Ranges TS. - -This is the correct type to use when passing non-owning views of mapped data -around between functions. Where you wish the view to be (possibly) owning, -you may find the non-lightweight `mapped` of more use. -*/ -template class map_view : public span -{ -public: - //! The extent type. - using extent_type = typename section_handle::extent_type; - //! The size type. - using size_type = typename section_handle::size_type; - -public: - //! Default constructor - constexpr map_view() {} // NOLINT - - /*! Implicitly construct a mapped view of the given mapped data. - - \param map The mapped data to take a view upon. - \param length The number of items to map, use -1 to mean the length of the input view. - \param offset The item offset into the mapped file handle. - */ - map_view(mapped &map, size_type length = (size_type) -1, size_type offset = 0) // NOLINT - : span(map.begin() + offset, (length == (size_type) -1) ? (map.size() - offset) : length) // NOLINT - { - } - /*! Construct a mapped view of the given map handle. - - \param mh The map handle to use. - \param length The number of items to map, use -1 to mean the length of the map handle divided by `sizeof(T)`. - \param byteoffset The byte offset into the map handle, this does not need to be a multiple of the page size. - */ - explicit map_view(map_handle &mh, size_type length = (size_type) -1, extent_type byteoffset = 0) // NOLINT - : span(reinterpret_cast(mh.address() + byteoffset), (length == (size_type) -1) ? ((mh.length() - byteoffset) / sizeof(T)) : length) // NOLINT - { - } - /*! Construct a mapped view of the given mapped file handle. - - \param mfh The mapped file handle to take a view upon. - \param length The number of items to map, use -1 to mean the length of the section handle divided by `sizeof(T)`. - \param byteoffset The byte offset into the mapped file handle, this does not need to be a multiple of the page size. - */ - explicit map_view(mapped_file_handle &mfh, size_type length = (size_type) -1, extent_type byteoffset = 0) // NOLINT - : span(reinterpret_cast(mfh.address() + byteoffset), (length == (size_type) -1) ? ((mfh.maximum_extent().value() - byteoffset) / sizeof(T)) : length) // NOLINT - { - } -}; - -LLFIO_V2_NAMESPACE_END - -#endif diff --git a/include/llfio/v2.0/outcome b/include/llfio/v2.0/outcome index 4875c1c68..9fac0f600 160000 --- a/include/llfio/v2.0/outcome +++ b/include/llfio/v2.0/outcome @@ -1 +1 @@ -Subproject commit 4875c1c686381f01bfa0c8c40b797812350e3377 +Subproject commit 9fac0f60084f6f86055aee51bf646c843c12af4e diff --git a/include/llfio/v2.0/quickcpplib b/include/llfio/v2.0/quickcpplib index d4d2f29db..8d1f21c03 160000 --- a/include/llfio/v2.0/quickcpplib +++ b/include/llfio/v2.0/quickcpplib @@ -1 +1 @@ -Subproject commit d4d2f29dbbf4ec33ba20a0027ecdc6bc34ac013c +Subproject commit 8d1f21c03b2f2be74363a08eb5d1a7ecc7060436 diff --git a/test/kerneltest b/test/kerneltest index 4eb00f299..241623df1 160000 --- a/test/kerneltest +++ b/test/kerneltest @@ -1 +1 @@ -Subproject commit 4eb00f299ec44bd35a12016e4a48558edb7b4042 +Subproject commit 241623df1ffbbd043d6cc8fd9c4a84df1a8613e6 diff --git a/test/tests/mapped.cpp b/test/tests/mapped.cpp index 697047143..88fd1f384 100644 --- a/test/tests/mapped.cpp +++ b/test/tests/mapped.cpp @@ -78,7 +78,7 @@ static inline void TestMappedView2() byte *addr = mfh.address(); BOOST_CHECK(addr != nullptr); - map_view v1(mfh); + attached v1(mfh); BOOST_CHECK(v1.size() == 10000); v1[0] = 78; v1[9999] = 79; @@ -86,19 +86,19 @@ static inline void TestMappedView2() BOOST_CHECK(addr == mfh.address()); BOOST_CHECK(mfh.maximum_extent().value() == 20000 * sizeof(int)); BOOST_CHECK(mfh.underlying_file_maximum_extent().value() == 20000 * sizeof(int)); - v1 = map_view(mfh); + v1 = attached(mfh); BOOST_CHECK(v1.size() == 20000); BOOST_CHECK(v1[0] == 78); BOOST_CHECK(v1[9999] == 79); mfh.truncate(2 * 1024 * 1024).value(); // exceed reservation, cause hidden reserve BOOST_CHECK(addr != nullptr); - v1 = map_view(mfh); + v1 = attached(mfh); BOOST_CHECK(v1.size() == 2 * 1024 * 1024 / sizeof(int)); BOOST_CHECK(v1[0] == 78); BOOST_CHECK(v1[9999] == 79); mfh.reserve(2 * 1024 * 1024).value(); BOOST_CHECK(mfh.address() != nullptr); - v1 = map_view(mfh); + v1 = attached(mfh); BOOST_CHECK(v1.size() == 2 * 1024 * 1024 / sizeof(int)); BOOST_CHECK(v1[0] == 78); BOOST_CHECK(v1[9999] == 79); @@ -111,20 +111,20 @@ static inline void TestMappedView2() #endif mfh.truncate(1 * sizeof(int)).value(); BOOST_CHECK(mfh.address() != nullptr); - v1 = map_view(mfh); + v1 = attached(mfh); BOOST_CHECK(v1.size() == 1); BOOST_CHECK(v1[0] == 78); // Use a different handle to extend the file mapped_file_handle mfh2 = mapped_file_handle::mapped_file(1024 * 1024, {}, "testfile", file_handle::mode::write, file_handle::creation::open_existing, file_handle::caching::all, file_handle::flag::unlink_on_first_close).value(); mfh2.truncate(10000 * sizeof(int)).value(); - v1 = map_view(mfh2); + v1 = attached(mfh2); BOOST_CHECK(v1.size() == 10000); v1[0] = 78; v1[9999] = 79; // On Windows this will have updated the mapping, on POSIX it will not, so prod POSIX mfh.update_map().value(); - v1 = map_view(mfh); + v1 = attached(mfh); BOOST_CHECK(v1.size() == 10000); BOOST_CHECK(v1[0] == 78); BOOST_CHECK(v1[9999] == 79); @@ -137,7 +137,7 @@ static inline void TestMappedView2() fh.truncate(10000 * sizeof(int)).value(); // On POSIX this will have updated the mapping, on Windows it will not, so prod Windows mfh.update_map().value(); - v1 = map_view(mfh); + v1 = attached(mfh); BOOST_REQUIRE(v1.size() == 10000); BOOST_CHECK(v1[0] == 78); BOOST_CHECK(v1[9999] == 0); @@ -147,4 +147,4 @@ static inline void TestMappedView2() } KERNELTEST_TEST_KERNEL(integration, llfio, algorithm, mapped_span1, "Tests that llfio::mapped works as expected", TestMappedView1()) -KERNELTEST_TEST_KERNEL(integration, llfio, algorithm, mapped_span2, "Tests that llfio::map_view works as expected", TestMappedView2()) +KERNELTEST_TEST_KERNEL(integration, llfio, algorithm, mapped_span2, "Tests that llfio::attached works as expected", TestMappedView2())