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>2020-01-07 13:57:52 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2020-01-07 13:57:52 +0300
commitcb9e8e4a5d607cb8157645c87b6a8f423b6b8eff (patch)
treefe293a739a61fd73aedb8ea51dd0c80c4e052104
parentd80ae1703bef20545a29a134575b9ac723e6d971 (diff)
Rename parameterised clone() to reopen(), as per LEWG-I guidance.
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/async_file_handle.hpp10
-rw-r--r--include/llfio/v2.0/detail/impl/posix/directory_handle.ipp4
-rw-r--r--include/llfio/v2.0/detail/impl/posix/file_handle.ipp4
-rw-r--r--include/llfio/v2.0/detail/impl/posix/import.hpp2
-rw-r--r--include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp2
-rw-r--r--include/llfio/v2.0/detail/impl/storage_profile.ipp12
-rw-r--r--include/llfio/v2.0/detail/impl/windows/directory_handle.ipp2
-rw-r--r--include/llfio/v2.0/detail/impl/windows/file_handle.ipp2
-rw-r--r--include/llfio/v2.0/detail/impl/windows/symlink_handle.ipp2
-rw-r--r--include/llfio/v2.0/directory_handle.hpp4
-rw-r--r--include/llfio/v2.0/file_handle.hpp15
-rw-r--r--include/llfio/v2.0/handle.hpp2
-rw-r--r--include/llfio/v2.0/mapped_file_handle.hpp4
-rw-r--r--include/llfio/v2.0/path_handle.hpp9
-rw-r--r--include/llfio/v2.0/pipe_handle.hpp3
-rw-r--r--include/llfio/v2.0/symlink_handle.hpp4
17 files changed, 43 insertions, 44 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp
index 5a74254b..98e5b822 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 ead062146b2e0777b8da33cf3651bce7930afccf
-#define LLFIO_PREVIOUS_COMMIT_DATE "2019-12-29 10:33:22 +00:00"
-#define LLFIO_PREVIOUS_COMMIT_UNIQUE ead06214
+#define LLFIO_PREVIOUS_COMMIT_REF 95df9d976cd266762f7c587ce32f496cc4350597
+#define LLFIO_PREVIOUS_COMMIT_DATE "2020-01-07 09:56:20 +00:00"
+#define LLFIO_PREVIOUS_COMMIT_UNIQUE 95df9d97
diff --git a/include/llfio/v2.0/async_file_handle.hpp b/include/llfio/v2.0/async_file_handle.hpp
index 20a2a5d1..b35b1850 100644
--- a/include/llfio/v2.0/async_file_handle.hpp
+++ b/include/llfio/v2.0/async_file_handle.hpp
@@ -214,20 +214,20 @@ public:
LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> barrier(io_request<const_buffers_type> reqs = io_request<const_buffers_type>(), barrier_kind kind = barrier_kind::nowait_data_only, deadline d = deadline()) noexcept override;
- /*! Clone this handle to a different io_service (copy constructor is disabled to avoid accidental copying)
+ /*! Reopen this handle to a different io_service (copy constructor is disabled to avoid accidental copying)
\errors Any of the values POSIX dup() or DuplicateHandle() can return.
*/
- result<async_file_handle> clone(io_service &service, mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept
+ result<async_file_handle> reopen(io_service &service, mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept
{
- OUTCOME_TRY(v, file_handle::clone(mode_, caching_, d));
+ OUTCOME_TRY(v, file_handle::reopen(mode_, caching_, d));
async_file_handle ret(std::move(v));
ret._service = &service;
return {std::move(ret)};
}
- LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<file_handle> clone(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<file_handle> reopen(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept
{
- OUTCOME_TRY(v, file_handle::clone(mode_, caching_, d));
+ OUTCOME_TRY(v, file_handle::reopen(mode_, caching_, d));
async_file_handle ret(std::move(v));
ret._service = _service;
return {static_cast<file_handle &&>(ret)};
diff --git a/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp b/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp
index 1548d792..7ed68548 100644
--- a/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp
@@ -87,7 +87,7 @@ result<directory_handle> directory_handle::directory(const path_handle &base, pa
if(base.is_valid() && path_parent.empty())
{
OUTCOME_TRY(dh, base.clone());
- dirh = std::move(dh);
+ dirh = path_handle(std::move(dh));
}
else if(!path_parent.empty())
{
@@ -175,7 +175,7 @@ opened:
return ret;
}
-result<directory_handle> directory_handle::clone(mode mode_, caching caching_, deadline d) const noexcept
+result<directory_handle> directory_handle::reopen(mode mode_, caching caching_, deadline d) const noexcept
{
LLFIO_LOG_FUNCTION_CALL(this);
// Fast path
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 ea4c4305..2246a627 100644
--- a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp
@@ -56,7 +56,7 @@ result<file_handle> file_handle::file(const path_handle &base, file_handle::path
if(base.is_valid() && path_parent.empty())
{
OUTCOME_TRY(dh, base.clone());
- dirh = std::move(dh);
+ dirh = path_handle(std::move(dh));
}
else if(!path_parent.empty())
{
@@ -158,7 +158,7 @@ result<file_handle> file_handle::temp_inode(const path_handle &dirh, mode _mode,
}
}
-result<file_handle> file_handle::clone(mode mode_, caching caching_, deadline d) const noexcept
+result<file_handle> file_handle::reopen(mode mode_, caching caching_, deadline d) const noexcept
{
LLFIO_LOG_FUNCTION_CALL(this);
// Fast path
diff --git a/include/llfio/v2.0/detail/impl/posix/import.hpp b/include/llfio/v2.0/detail/impl/posix/import.hpp
index 30ee5949..25c020fe 100644
--- a/include/llfio/v2.0/detail/impl/posix/import.hpp
+++ b/include/llfio/v2.0/detail/impl/posix/import.hpp
@@ -138,7 +138,7 @@ inline result<int> attribs_from_handle_mode_caching_and_flags(native_handle_type
if((d).steady) \
began_steady = std::chrono::steady_clock::now(); \
else \
- end_utc = std::chrono::system_clock::now() + std::chrono::nanoseconds((d).nsecs); \
+ end_utc = std::chrono::system_clock::now() + std::chrono::microseconds((d).nsecs/1000); \
timeout = &_timeout; \
}
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 ba8a7aae..68da012d 100644
--- a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp
@@ -124,7 +124,7 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<void> symlink_handle::_create_symlink(con
}
}
-result<symlink_handle> symlink_handle::clone(mode mode_, deadline d) const noexcept
+result<symlink_handle> symlink_handle::reopen(mode mode_, deadline d) const noexcept
{
LLFIO_LOG_FUNCTION_CALL(this);
#if LLFIO_SYMLINK_HANDLE_IS_FAKED
diff --git a/include/llfio/v2.0/detail/impl/storage_profile.ipp b/include/llfio/v2.0/detail/impl/storage_profile.ipp
index e1c5ec4d..ddaeeb8f 100644
--- a/include/llfio/v2.0/detail/impl/storage_profile.ipp
+++ b/include/llfio/v2.0/detail/impl/storage_profile.ipp
@@ -417,7 +417,7 @@ namespace storage_profile
for(char no = '1'; no <= '2'; no++)
{
std::packaged_task<void()> task([size, &srch, no, &done] {
- auto _h(srch.clone());
+ auto _h(srch.reopen());
if(!_h)
{
throw std::runtime_error(std::string("concurrency::atomic_rewrite_quantum: " // NOLINT
@@ -456,7 +456,7 @@ namespace storage_profile
for(unsigned no = 0; no < concurrency; no++)
{
std::packaged_task<void()> task([size, &srch, &done, &atomic_rewrite_quantum, &failed] {
- auto _h(srch.clone());
+ auto _h(srch.reopen());
if(!_h)
{
throw std::runtime_error(std::string("concurrency::atomic_rewrite_quantum: " // NOLINT
@@ -561,7 +561,7 @@ namespace storage_profile
for(char no = '1'; no <= '2'; no++)
{
std::packaged_task<void()> task([size, offset, &srch, no, &done] {
- auto _h(srch.clone());
+ auto _h(srch.reopen());
if(!_h)
{
throw std::runtime_error(std::string("concurrency::atomic_rewrite_" // NOLINT
@@ -601,7 +601,7 @@ namespace storage_profile
for(unsigned no = 0; no < concurrency; no++)
{
std::packaged_task<void()> task([size, offset, &srch, &done, &max_aligned_atomic_rewrite, &failed] {
- auto _h(srch.clone());
+ auto _h(srch.reopen());
if(!_h)
{
throw std::runtime_error(std::string("concurrency::atomic_rewrite_" // NOLINT
@@ -722,7 +722,7 @@ namespace storage_profile
for(char no = '1'; no <= '2'; no++)
{
std::packaged_task<void()> task([size, offset, &srch, no, &done] {
- auto _h(srch.clone());
+ auto _h(srch.reopen());
if(!_h)
{
throw std::runtime_error(std::string("concurrency::atomic_rewrite_" // NOLINT
@@ -762,7 +762,7 @@ namespace storage_profile
for(unsigned no = 0; no < concurrency; no++)
{
std::packaged_task<void()> task([size, offset, &srch, &done, &atomic_rewrite_offset_boundary, &failed] {
- auto _h(srch.clone());
+ auto _h(srch.reopen());
if(!_h)
{
throw std::runtime_error(std::string("concurrency::atomic_rewrite_" // NOLINT
diff --git a/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp b/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp
index c833317a..dfcc9ab4 100644
--- a/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp
@@ -203,7 +203,7 @@ result<directory_handle> directory_handle::directory(const path_handle &base, pa
return ret;
}
-result<directory_handle> directory_handle::clone(mode mode_, caching caching_, deadline /* unused */) const noexcept
+result<directory_handle> directory_handle::reopen(mode mode_, caching caching_, deadline /* unused */) const noexcept
{
LLFIO_LOG_FUNCTION_CALL(this);
result<directory_handle> ret(directory_handle(native_handle_type(), _devid, _inode, _caching, _flags));
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 c4dee1a8..e646fcd0 100644
--- a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp
@@ -294,7 +294,7 @@ result<file_handle> file_handle::temp_inode(const path_handle &dirh, mode _mode,
}
}
-result<file_handle> file_handle::clone(mode mode_, caching caching_, deadline /*unused*/) const noexcept
+result<file_handle> file_handle::reopen(mode mode_, caching caching_, deadline /*unused*/) const noexcept
{
LLFIO_LOG_FUNCTION_CALL(this);
result<file_handle> ret(file_handle(native_handle_type(), _devid, _inode, caching_, _flags));
diff --git a/include/llfio/v2.0/detail/impl/windows/symlink_handle.ipp b/include/llfio/v2.0/detail/impl/windows/symlink_handle.ipp
index a48026c6..4bfc908e 100644
--- a/include/llfio/v2.0/detail/impl/windows/symlink_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/windows/symlink_handle.ipp
@@ -27,7 +27,7 @@ Distributed under the Boost Software License, Version 1.0.
LLFIO_V2_NAMESPACE_BEGIN
-result<symlink_handle> symlink_handle::clone(mode mode_, deadline /*unused*/) const noexcept
+result<symlink_handle> symlink_handle::reopen(mode mode_, deadline /*unused*/) const noexcept
{
LLFIO_LOG_FUNCTION_CALL(this);
result<symlink_handle> ret(symlink_handle(native_handle_type(), _devid, _inode, _flags));
diff --git a/include/llfio/v2.0/directory_handle.hpp b/include/llfio/v2.0/directory_handle.hpp
index b201c94c..f3f746ef 100644
--- a/include/llfio/v2.0/directory_handle.hpp
+++ b/include/llfio/v2.0/directory_handle.hpp
@@ -268,7 +268,7 @@ public:
return path_handle::close();
}
- /*! Clone this handle (copy constructor is disabled to avoid accidental copying),
+ /*! Reopen this handle (copy constructor is disabled to avoid accidental copying),
optionally race free reopening the handle with different access or caching.
Microsoft Windows provides a syscall for cloning an existing handle but with new
@@ -279,7 +279,7 @@ public:
\mallocs On POSIX if changing the mode, we must loop calling `current_path()` and
trying to open the path returned. Thus many allocations may occur.
*/
- LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<directory_handle> clone(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept;
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<directory_handle> reopen(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept;
/*! Return a copy of this directory handle, but as a path handle.
diff --git a/include/llfio/v2.0/file_handle.hpp b/include/llfio/v2.0/file_handle.hpp
index b8e4e074..747fdf8a 100644
--- a/include/llfio/v2.0/file_handle.hpp
+++ b/include/llfio/v2.0/file_handle.hpp
@@ -229,7 +229,7 @@ public:
return io_handle::close();
}
- /*! Clone this handle (copy constructor is disabled to avoid accidental copying),
+ /*! Reopen this handle (copy constructor is disabled to avoid accidental copying),
optionally race free reopening the handle with different access or caching.
Microsoft Windows provides a syscall for cloning an existing handle but with new
@@ -241,9 +241,16 @@ public:
\mallocs On POSIX if changing the mode, we must loop calling `current_path()` and
trying to open the path returned. Thus many allocations may occur.
*/
- result<file_handle> clone(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept;
+ result<file_handle> reopen(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept;
- LLFIO_DEADLINE_TRY_FOR_UNTIL(clone)
+ LLFIO_DEADLINE_TRY_FOR_UNTIL(reopen)
+
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<handle> clone() const noexcept override
+ {
+ // For file handles, we need a deeper clone than duph()
+ OUTCOME_TRY(ret, reopen());
+ return handle(ret.release());
+ }
//! The i/o service this handle is attached to, if any
io_service *service() const noexcept { return _service; }
@@ -424,7 +431,7 @@ inline result<file_handle::extent_type> truncate(file_handle &self, file_handle:
return self.truncate(std::forward<decltype(newsize)>(newsize));
}
/*! \brief Returns a list of currently valid extents for this open file. WARNING: racy!
-*/
+ */
inline result<std::vector<std::pair<file_handle::extent_type, file_handle::extent_type>>> extents(const file_handle &self) noexcept
{
return self.extents();
diff --git a/include/llfio/v2.0/handle.hpp b/include/llfio/v2.0/handle.hpp
index e889d7ab..eeb1ba71 100644
--- a/include/llfio/v2.0/handle.hpp
+++ b/include/llfio/v2.0/handle.hpp
@@ -300,7 +300,7 @@ public:
\errors Any of the values POSIX dup() or DuplicateHandle() can return.
*/
- LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<handle> clone() const noexcept;
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<handle> clone() const noexcept;
//! Release the native handle type managed by this handle
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC native_handle_type release() noexcept
{
diff --git a/include/llfio/v2.0/mapped_file_handle.hpp b/include/llfio/v2.0/mapped_file_handle.hpp
index 494d836c..f9349d3d 100644
--- a/include/llfio/v2.0/mapped_file_handle.hpp
+++ b/include/llfio/v2.0/mapped_file_handle.hpp
@@ -329,9 +329,9 @@ public:
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> close() noexcept override;
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC native_handle_type release() noexcept override;
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> barrier(io_request<const_buffers_type> reqs = io_request<const_buffers_type>(), barrier_kind kind = barrier_kind::nowait_data_only, deadline d = deadline()) noexcept override { return _mh.barrier(reqs, kind, d); }
- result<mapped_file_handle> clone(size_type reservation, mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept
+ result<mapped_file_handle> reopen(size_type reservation, mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept
{
- OUTCOME_TRY(fh, file_handle::clone(mode_, caching_, d));
+ OUTCOME_TRY(fh, file_handle::reopen(mode_, caching_, d));
return mapped_file_handle(std::move(fh), reservation);
}
//! Return the current maximum permitted extent of the file.
diff --git a/include/llfio/v2.0/path_handle.hpp b/include/llfio/v2.0/path_handle.hpp
index 1e308ca7..1c5e2814 100644
--- a/include/llfio/v2.0/path_handle.hpp
+++ b/include/llfio/v2.0/path_handle.hpp
@@ -125,15 +125,6 @@ public:
#endif
return handle::close();
}
- /*! Clone this handle (copy constructor is disabled to avoid accidental copying).
- */
- result<path_handle> clone() const noexcept
- {
- auto *h = static_cast<const handle *>(this);
- OUTCOME_TRY(ret, h->clone());
- auto nativeh = ret.release();
- return path_handle(nativeh);
- }
};
//! \brief Constructor for `path_handle`
diff --git a/include/llfio/v2.0/pipe_handle.hpp b/include/llfio/v2.0/pipe_handle.hpp
index 39163c10..97400423 100644
--- a/include/llfio/v2.0/pipe_handle.hpp
+++ b/include/llfio/v2.0/pipe_handle.hpp
@@ -249,7 +249,8 @@ public:
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<path_handle> parent_path_handle(deadline /*unused*/ = std::chrono::seconds(30)) const noexcept override
{
// Pipes parent handle is always the NT kernel namespace for pipes
- return path_discovery::temporary_named_pipes_directory().clone();
+ OUTCOME_TRY(h, path_discovery::temporary_named_pipes_directory().clone());
+ return path_handle(std::move(h));
}
LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<buffers_type> read(io_request<buffers_type> reqs, deadline d = deadline()) noexcept override;
diff --git a/include/llfio/v2.0/symlink_handle.hpp b/include/llfio/v2.0/symlink_handle.hpp
index 9f8249ab..f7bf57c4 100644
--- a/include/llfio/v2.0/symlink_handle.hpp
+++ b/include/llfio/v2.0/symlink_handle.hpp
@@ -370,7 +370,7 @@ public:
#endif
}
- /*! Clone this handle (copy constructor is disabled to avoid accidental copying),
+ /*! Reopen this handle (copy constructor is disabled to avoid accidental copying),
optionally race free reopening the handle with different access or caching.
Microsoft Windows provides a syscall for cloning an existing handle but with new
@@ -381,7 +381,7 @@ public:
\mallocs On POSIX if changing the mode, we must loop calling `current_path()` and
trying to open the path returned. Thus many allocations may occur.
*/
- LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<symlink_handle> clone(mode mode_ = mode::unchanged, deadline d = std::chrono::seconds(30)) const noexcept;
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<symlink_handle> reopen(mode mode_ = mode::unchanged, deadline d = std::chrono::seconds(30)) const noexcept;
#if LLFIO_SYMLINK_HANDLE_IS_FAKED
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<path_type> current_path() const noexcept override;