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:
-rw-r--r--Doxyfile5
-rw-r--r--Readme.md3
m---------include/afio/outcome0
-rw-r--r--include/afio/revision.hpp6
-rw-r--r--include/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp6
-rw-r--r--include/afio/v2.0/algorithm/shared_fs_mutex/base.hpp10
-rw-r--r--include/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp6
-rw-r--r--include/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp6
-rw-r--r--include/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp6
-rw-r--r--include/afio/v2.0/async_file_handle.hpp12
-rw-r--r--include/afio/v2.0/config.hpp23
-rw-r--r--include/afio/v2.0/detail/impl/posix/async_file_handle.ipp4
-rw-r--r--include/afio/v2.0/detail/impl/windows/async_file_handle.ipp4
-rw-r--r--include/afio/v2.0/file_handle.hpp14
-rw-r--r--include/afio/v2.0/handle.hpp2
-rw-r--r--include/afio/v2.0/io_handle.hpp20
-rw-r--r--include/afio/v2.0/map_handle.hpp16
-rw-r--r--include/afio/v2.0/native_handle_type.hpp2
-rw-r--r--include/afio/v2.0/path_handle.hpp4
-rw-r--r--release_notes.md22
m---------test/kerneltest0
21 files changed, 104 insertions, 67 deletions
diff --git a/Doxyfile b/Doxyfile
index 9039dda7..1e989c95 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -2022,8 +2022,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED = DOXYGEN_IS_IN_THE_HOUSE=1 DOXYGEN_SHOULD_SKIP_THIS=1 \
- QUICKCPPLIB_CONSTEXPR=constexpr
+PREDEFINED = DOXYGEN_IS_IN_THE_HOUSE=1 DOXYGEN_SHOULD_SKIP_THIS=1
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2032,7 +2031,7 @@ PREDEFINED = DOXYGEN_IS_IN_THE_HOUSE=1 DOXYGEN_SHOULD_SKIP_THIS=1 \
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED = AFIO_DECL AFIO_DEADLINE_NAME QUICKCPPLIB_CONSTEXPR \
+EXPAND_AS_DEFINED = AFIO_DECL AFIO_DEADLINE_NAME AFIO_MAKE_FREE_FUNCTION \
AFIO_HEADERS_ONLY_MEMFUNC_SPEC AFIO_HEADERS_ONLY_FUNC_SPEC AFIO_HEADERS_ONLY_VIRTUAL_SPEC \
QUICKCPPLIB_BITFIELD_BEGIN QUICKCPPLIB_BITFIELD_END \
AFIO_V2_NAMESPACE AFIO_V2_NAMESPACE_BEGIN AFIO_V2_NAMESPACE_EXPORT_BEGIN AFIO_V2_NAMESPACE_END \
diff --git a/Readme.md b/Readme.md
index 648f2610..c73c3997 100644
--- a/Readme.md
+++ b/Readme.md
@@ -11,9 +11,6 @@ Outcome useful in the games/audio world.
- [ ] Move AFIO to being tested with exceptions and RTTI disabled. Where AFIO
throws, have it detect __cpp_exceptions and skip those implementations.
- [ ] Move handle caching into native_handle_type? Overlapped flag is especially needed.
-- [ ] `handle::current_path()` should be added using
-`GetFinalPathNameByHandle(FILE_NAME_OPENED)`. `VOLUME_NAME_DOS` vs `VOLUME_NAME_NT` should
-depend on the current afio::path setting.
- [ ] Implement the long planned ACID key-value BLOB store
with a very simple engine based on atomic renames and send it to Boost for peer review.
diff --git a/include/afio/outcome b/include/afio/outcome
-Subproject 068da34b7361c39d7d1954936fe0567bda4798c
+Subproject 5da364741db5935bf081d2c6c362bdbf27786b5
diff --git a/include/afio/revision.hpp b/include/afio/revision.hpp
index 1575a079..1f74be01 100644
--- a/include/afio/revision.hpp
+++ b/include/afio/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 AFIO_PREVIOUS_COMMIT_REF 15ea2b1ecd34b336839ee0973f473f7fc203ec7a
-#define AFIO_PREVIOUS_COMMIT_DATE "2017-07-31 01:50:02 +00:00"
-#define AFIO_PREVIOUS_COMMIT_UNIQUE 15ea2b1e
+#define AFIO_PREVIOUS_COMMIT_REF 9d66fe89ffa6df2c1ad87989d32bb8f828fba7d3
+#define AFIO_PREVIOUS_COMMIT_DATE "2017-07-31 02:59:37 +00:00"
+#define AFIO_PREVIOUS_COMMIT_UNIQUE 9d66fe89
diff --git a/include/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp b/include/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp
index b99e2c5e..807dd980 100644
--- a/include/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp
+++ b/include/afio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp
@@ -172,7 +172,7 @@ namespace algorithm
ZFS, btrfs) guarantee atomicity of updates and therefore torn writes are never
observed by readers. For these, hashing can be safely disabled.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static result<atomic_append> fs_mutex_append(const path_handle &base, path_view lockfile, bool nfs_compatibility = false, bool skip_hashing = false) noexcept
{
AFIO_LOG_FUNCTION_CALL(0);
@@ -212,7 +212,7 @@ namespace algorithm
const file_handle &handle() const noexcept { return _h; }
protected:
- virtual result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
atomic_append_detail::lock_request lock_request;
@@ -399,7 +399,7 @@ namespace algorithm
}
public:
- virtual void unlock(entities_type entities, unsigned long long hint) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void unlock(entities_type entities, unsigned long long hint) noexcept override final
{
(void) entities;
AFIO_LOG_FUNCTION_CALL(this);
diff --git a/include/afio/v2.0/algorithm/shared_fs_mutex/base.hpp b/include/afio/v2.0/algorithm/shared_fs_mutex/base.hpp
index d89667ea..1f6e2c01 100644
--- a/include/afio/v2.0/algorithm/shared_fs_mutex/base.hpp
+++ b/include/afio/v2.0/algorithm/shared_fs_mutex/base.hpp
@@ -79,9 +79,9 @@ namespace algorithm
#endif
//! Default constructor
constexpr entity_type() noexcept : _init(0) {}
- //! Constructor
+//! Constructor
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 7
- QUICKCPPLIB_CONSTEXPR
+ constexpr
#endif
entity_type(value_type _value, bool _exclusive) noexcept : _init(0)
{
@@ -98,7 +98,7 @@ namespace algorithm
constexpr shared_fs_mutex() {}
public:
- virtual ~shared_fs_mutex() {}
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC ~shared_fs_mutex() {}
//! Generates an entity id from a sequence of bytes
entity_type entity_from_buffer(const char *buffer, size_t bytes, bool exclusive = true) noexcept
@@ -190,7 +190,7 @@ namespace algorithm
}
};
- virtual result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept = 0;
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept = 0;
//! Lock all of a sequence of entities for exclusive or shared access
result<entities_guard> lock(entities_type entities, deadline d = deadline(), bool spin_not_sleep = false) noexcept
@@ -211,7 +211,7 @@ namespace algorithm
//! Try to lock a single entity for exclusive or shared access
result<entities_guard> try_lock(entity_type entity) noexcept { return lock(std::move(entity), deadline(std::chrono::seconds(0))); }
//! Unlock a previously locked sequence of entities
- virtual void unlock(entities_type entities, unsigned long long hint = 0) noexcept = 0;
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void unlock(entities_type entities, unsigned long long hint = 0) noexcept = 0;
};
} // namespace
diff --git a/include/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp b/include/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp
index bc2ebfe9..aa834e5a 100644
--- a/include/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp
+++ b/include/afio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp
@@ -92,7 +92,7 @@ namespace algorithm
}
//! Initialises a shared filing system mutex using the file at \em lockfile
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static result<byte_ranges> fs_mutex_byte_ranges(const path_handle &base, path_view lockfile) noexcept
{
AFIO_LOG_FUNCTION_CALL(0);
@@ -104,7 +104,7 @@ namespace algorithm
const file_handle &handle() const noexcept { return _h; }
protected:
- virtual result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
std::chrono::steady_clock::time_point began_steady;
@@ -196,7 +196,7 @@ namespace algorithm
}
public:
- virtual void unlock(entities_type entities, unsigned long long) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void unlock(entities_type entities, unsigned long long) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
for(const auto &i : entities)
diff --git a/include/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp b/include/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp
index 0c292ef9..68dfbcc0 100644
--- a/include/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp
+++ b/include/afio/v2.0/algorithm/shared_fs_mutex/lock_files.hpp
@@ -99,7 +99,7 @@ namespace algorithm
}
//! Initialises a shared filing system mutex using the directory at \em lockdir which MUST stay valid for the duration of this lock.
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static result<lock_files> fs_mutex_lock_files(const path_handle &lockdir) noexcept
{
AFIO_LOG_FUNCTION_CALL(0);
@@ -110,7 +110,7 @@ namespace algorithm
const path_handle &path() const noexcept { return _path; }
protected:
- virtual result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
std::chrono::steady_clock::time_point began_steady;
@@ -194,7 +194,7 @@ namespace algorithm
}
public:
- virtual void unlock(entities_type, unsigned long long) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void unlock(entities_type, unsigned long long) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
for(auto &i : _hs)
diff --git a/include/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp b/include/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp
index 0ae9f859..cca2b2a0 100644
--- a/include/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp
+++ b/include/afio/v2.0/algorithm/shared_fs_mutex/memory_map.hpp
@@ -203,7 +203,7 @@ namespace algorithm
but a particularly important one is `EBUSY` which will be returned if the memory map lock is already in
a degraded state (i.e. just use the fallback lock directly).
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static result<memory_map> fs_mutex_map(const path_handle &base, path_view lockfile, shared_fs_mutex *fallbacklock = nullptr) noexcept
{
AFIO_LOG_FUNCTION_CALL(0);
@@ -336,7 +336,7 @@ namespace algorithm
}
return span<_entity_idx>(entity_to_idx, ep - entity_to_idx);
}
- virtual result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> _lock(entities_guard &out, deadline d, bool spin_not_sleep) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
if(is_degraded())
@@ -425,7 +425,7 @@ namespace algorithm
}
public:
- virtual void unlock(entities_type entities, unsigned long long hint) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void unlock(entities_type entities, unsigned long long hint) noexcept override final
{
AFIO_LOG_FUNCTION_CALL(this);
if(_have_degraded)
diff --git a/include/afio/v2.0/async_file_handle.hpp b/include/afio/v2.0/async_file_handle.hpp
index 66dc95e5..084b9d34 100644
--- a/include/afio/v2.0/async_file_handle.hpp
+++ b/include/afio/v2.0/async_file_handle.hpp
@@ -98,7 +98,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<async_file_handle> async_file(io_service &service, const path_handle &base, path_view_type _path, mode _mode = mode::read, creation _creation = creation::open_existing, caching _caching = caching::all, flag flags = flag::none) noexcept
{
// Open it overlapped, otherwise no difference.
@@ -116,7 +116,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static inline result<async_file_handle> async_random_file(io_service &service, const path_handle &dirpath, mode _mode = mode::write, caching _caching = caching::temporary, flag flags = flag::none) noexcept
{
try
@@ -150,7 +150,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static inline result<async_file_handle> async_temp_file(io_service &service, path_view_type name = path_view_type(), mode _mode = mode::write, creation _creation = creation::if_needed, caching _caching = caching::temporary, flag flags = flag::unlink_on_close) noexcept
{
OUTCOME_TRY(tempdirh, path_handle::path(temporary_files_directory()));
@@ -166,7 +166,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<async_file_handle> async_temp_inode(io_service &service, path_view_type dirpath = temporary_files_directory(), mode _mode = mode::write, flag flags = flag::none) noexcept
{
// Open it overlapped, otherwise no difference.
@@ -285,7 +285,7 @@ public:
\mallocs One calloc, one free. The allocation is unavoidable due to the need to store a type
erased completion handler of unknown type.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
template <class CompletionRoutine> result<io_state_ptr<CompletionRoutine, buffers_type>> async_read(io_request<buffers_type> reqs, CompletionRoutine &&completion) noexcept;
/*! \brief Schedule a write to occur asynchronously.
@@ -298,7 +298,7 @@ public:
\mallocs One calloc, one free. The allocation is unavoidable due to the need to store a type
erased completion handler of unknown type.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
template <class CompletionRoutine> result<io_state_ptr<CompletionRoutine, const_buffers_type>> async_write(io_request<const_buffers_type> reqs, CompletionRoutine &&completion) noexcept;
AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<buffers_type> read(io_request<buffers_type> reqs, deadline d = deadline()) noexcept override;
diff --git a/include/afio/v2.0/config.hpp b/include/afio/v2.0/config.hpp
index 7b049b1a..3f3d0b02 100644
--- a/include/afio/v2.0/config.hpp
+++ b/include/afio/v2.0/config.hpp
@@ -102,8 +102,8 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef __cpp_variadic_templates
#error AFIO needs variadic template support in the compiler
#endif
-#ifndef __cpp_constexpr
-#error AFIO needs constexpr (C++ 11) support in the compiler
+#if __cpp_constexpr < 201304
+#error AFIO needs relaxed constexpr (C++ 14) support in the compiler
#endif
#ifndef __cpp_init_captures
#error AFIO needs lambda init captures support in the compiler (C++ 14)
@@ -250,10 +250,19 @@ AFIO_V2_NAMESPACE_END
#endif
#endif
+// A unique identifier generating macro
#define AFIO_GLUE2(x, y) x##y
#define AFIO_GLUE(x, y) AFIO_GLUE2(x, y)
#define AFIO_UNIQUE_NAME AFIO_GLUE(__t, __COUNTER__)
+// Used to tag functions which need to be made free by the AST tool
+#ifndef AFIO_MAKE_FREE_FUNCTION
+#if __cplusplus >= 201700
+#define AFIO_MAKE_FREE_FUNCTION [[afio::make_free_function]]
+#else
+#define AFIO_MAKE_FREE_FUNCTION
+#endif
+#endif
// Bring in bitfields
#include "../quickcpplib/include/bitfield.hpp"
@@ -599,7 +608,7 @@ namespace detail
public:
constexpr function_ptr() noexcept : ptr(nullptr) {}
constexpr function_ptr(function_ptr_storage *p) noexcept : ptr(p) {}
- QUICKCPPLIB_CONSTEXPR function_ptr(function_ptr &&o) noexcept : ptr(o.ptr) { o.ptr = nullptr; }
+ constexpr function_ptr(function_ptr &&o) noexcept : ptr(o.ptr) { o.ptr = nullptr; }
function_ptr &operator=(function_ptr &&o)
{
delete ptr;
@@ -611,14 +620,14 @@ namespace detail
function_ptr &operator=(const function_ptr &) = delete;
~function_ptr() { delete ptr; }
explicit constexpr operator bool() const noexcept { return !!ptr; }
- QUICKCPPLIB_CONSTEXPR R operator()(Args... args) const { return (*ptr)(std::move(args)...); }
- QUICKCPPLIB_CONSTEXPR function_ptr_storage *get() noexcept { return ptr; }
- QUICKCPPLIB_CONSTEXPR void reset(function_ptr_storage *p = nullptr) noexcept
+ constexpr R operator()(Args... args) const { return (*ptr)(std::move(args)...); }
+ constexpr function_ptr_storage *get() noexcept { return ptr; }
+ constexpr void reset(function_ptr_storage *p = nullptr) noexcept
{
delete ptr;
ptr = p;
}
- QUICKCPPLIB_CONSTEXPR function_ptr_storage *release() noexcept
+ constexpr function_ptr_storage *release() noexcept
{
auto p = ptr;
ptr = nullptr;
diff --git a/include/afio/v2.0/detail/impl/posix/async_file_handle.ipp b/include/afio/v2.0/detail/impl/posix/async_file_handle.ipp
index 5eb433a3..4a22fee8 100644
--- a/include/afio/v2.0/detail/impl/posix/async_file_handle.ipp
+++ b/include/afio/v2.0/detail/impl/posix/async_file_handle.ipp
@@ -81,7 +81,7 @@ result<async_file_handle::io_state_ptr<CompletionRoutine, BuffersType>> async_fi
: _io_state_type<CompletionRoutine, BuffersType>(_parent, _operation, std::forward<CompletionRoutine>(f), _items)
{
}
- virtual void operator()(long errcode, long bytes_transferred, void *internal_state) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void operator()(long errcode, long bytes_transferred, void *internal_state) noexcept override final
{
#if AFIO_USE_POSIX_AIO
struct aiocb **_paiocb = (struct aiocb **) internal_state;
@@ -116,7 +116,7 @@ result<async_file_handle::io_state_ptr<CompletionRoutine, BuffersType>> async_fi
if(!--this->items_to_go)
this->completion(this);
}
- virtual ~state_type() override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC ~state_type() override final
{
// Do we need to cancel pending i/o?
if(this->items_to_go)
diff --git a/include/afio/v2.0/detail/impl/windows/async_file_handle.ipp b/include/afio/v2.0/detail/impl/windows/async_file_handle.ipp
index 25aed704..4a3d2b8d 100644
--- a/include/afio/v2.0/detail/impl/windows/async_file_handle.ipp
+++ b/include/afio/v2.0/detail/impl/windows/async_file_handle.ipp
@@ -52,7 +52,7 @@ result<async_file_handle::io_state_ptr<CompletionRoutine, BuffersType>> async_fi
: _io_state_type<CompletionRoutine, BuffersType>(_parent, _operation, std::forward<CompletionRoutine>(f), _items)
{
}
- virtual void operator()(long errcode, long bytes_transferred, void *internal_state) noexcept override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC void operator()(long errcode, long bytes_transferred, void *internal_state) noexcept override final
{
LPOVERLAPPED ol = (LPOVERLAPPED) internal_state;
ol->hEvent = nullptr;
@@ -77,7 +77,7 @@ result<async_file_handle::io_state_ptr<CompletionRoutine, BuffersType>> async_fi
if(!--this->items_to_go)
this->completion(this);
}
- virtual ~state_type() override final
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC ~state_type() override final
{
// Do we need to cancel pending i/o?
if(this->items_to_go)
diff --git a/include/afio/v2.0/file_handle.hpp b/include/afio/v2.0/file_handle.hpp
index 5afc6484..be120948 100644
--- a/include/afio/v2.0/file_handle.hpp
+++ b/include/afio/v2.0/file_handle.hpp
@@ -145,7 +145,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<file_handle> file(const path_handle &base, path_view_type _path, mode _mode = mode::read, creation _creation = creation::open_existing, caching _caching = caching::all, flag flags = flag::none) noexcept;
/*! Create a file handle creating a randomly named file on a path.
The file is opened exclusively with `creation::only_if_not_exist` so it
@@ -155,7 +155,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static inline result<file_handle> random_file(const path_handle &dirpath, mode _mode = mode::write, caching _caching = caching::temporary, flag flags = flag::none) noexcept
{
try
@@ -189,7 +189,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static inline result<file_handle> temp_file(path_view_type name = path_view_type(), mode _mode = mode::write, creation _creation = creation::if_needed, caching _caching = caching::temporary, flag flags = flag::unlink_on_close) noexcept
{
OUTCOME_TRY(tempdirh, path_handle::path(temporary_files_directory()));
@@ -205,7 +205,7 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<file_handle> temp_inode(path_view_type dirpath = temporary_files_directory(), mode _mode = mode::write, flag flags = flag::none) noexcept;
//! Unless `flag::disable_safety_unlinks` is set, the device id of the file when opened
@@ -289,7 +289,7 @@ public:
\errors Any of the values POSIX fstat() or GetFileInformationByHandleEx() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<extent_type> length() const noexcept;
/*! Resize the current maximum permitted extent of the file to the given extent, avoiding any
@@ -300,7 +300,7 @@ public:
\param newsize The bytes to truncate the file to.
\errors Any of the values POSIX ftruncate() or SetFileInformationByHandle() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<extent_type> truncate(extent_type newsize) noexcept;
#if 0
@@ -323,7 +323,7 @@ public:
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
The asynchronous implementation in async_file_handle performs one calloc and one free.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> zero(io_request<const_buffers_type> reqs, deadline d = deadline()) noexcept;
//! \overload
io_result<const_buffer_type> zero(extent_type offset, const char *data, size_type bytes, deadline d = deadline()) noexcept
diff --git a/include/afio/v2.0/handle.hpp b/include/afio/v2.0/handle.hpp
index f90eb069..239632a7 100644
--- a/include/afio/v2.0/handle.hpp
+++ b/include/afio/v2.0/handle.hpp
@@ -154,7 +154,7 @@ public:
//! Default constructor
constexpr handle() noexcept : _caching(caching::none), _flags(flag::none) {}
//! Construct a handle from a supplied native handle
- explicit QUICKCPPLIB_CONSTEXPR handle(native_handle_type h, caching caching = caching::none, flag flags = flag::none) noexcept : _caching(caching), _flags(flags), _v(std::move(h)) {}
+ explicit constexpr handle(native_handle_type h, caching caching = caching::none, flag flags = flag::none) noexcept : _caching(caching), _flags(flags), _v(std::move(h)) {}
AFIO_HEADERS_ONLY_VIRTUAL_SPEC ~handle();
//! No copy construction (use clone())
handle(const handle &) = delete;
diff --git a/include/afio/v2.0/io_handle.hpp b/include/afio/v2.0/io_handle.hpp
index 4a5ba9bb..f7d759f8 100644
--- a/include/afio/v2.0/io_handle.hpp
+++ b/include/afio/v2.0/io_handle.hpp
@@ -168,7 +168,7 @@ public:
//! Default constructor
constexpr io_handle() = default;
//! Construct a handle from a supplied native handle
- QUICKCPPLIB_CONSTEXPR io_handle(native_handle_type h, caching caching = caching::none, flag flags = flag::none)
+ constexpr io_handle(native_handle_type h, caching caching = caching::none, flag flags = flag::none)
: handle(h, caching, flags)
{
}
@@ -181,6 +181,10 @@ public:
/*! \brief Read data from the open handle.
+ \warning Depending on the implementation backend, **very** different buffers may be returned than you
+ supplied. You should **always** use the buffers returned and assume that they point to different
+ memory and that each buffer's size will have changed.
+
\return The buffers read, which may not be the buffers input. The size of each scatter-gather
buffer is updated with the number of bytes of that buffer transferred, and the pointer to
the data may be \em completely different to what was submitted (e.g. it may point into a
@@ -194,7 +198,7 @@ public:
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
The asynchronous implementation in async_file_handle performs one calloc and one free.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<buffers_type> read(io_request<buffers_type> reqs, deadline d = deadline()) noexcept;
//! \overload
io_result<buffer_type> read(extent_type offset, char *data, size_type bytes, deadline d = deadline()) noexcept
@@ -207,6 +211,12 @@ public:
/*! \brief Write data to the open handle.
+ \warning Depending on the implementation backend, not all of the buffers input may be written and
+ the some buffers at the end of the returned buffers may return with zero bytes written.
+ For example, with a zeroed deadline, some backends may only consume as many buffers as the system has available write slots
+ for, thus for those backends this call is "non-blocking" in the sense that it will return immediately even if it
+ could not schedule a single buffer write.
+
\return The buffers written, which may not be the buffers input. The size of each scatter-gather
buffer is updated with the number of bytes of that buffer transferred.
\param reqs A scatter-gather and offset request.
@@ -218,7 +228,7 @@ public:
\mallocs The default synchronous implementation in file_handle performs no memory allocation.
The asynchronous implementation in async_file_handle performs one calloc and one free.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> write(io_request<const_buffers_type> reqs, deadline d = deadline()) noexcept;
//! \overload
io_result<const_buffer_type> write(extent_type offset, const char *data, size_type bytes, deadline d = deadline()) noexcept
@@ -259,8 +269,8 @@ public:
\errors Any of the values POSIX fdatasync() or Windows NtFlushBuffersFileEx() can return.
\mallocs None.
*/
- //[[bindlib::make_free]]
- virtual io_result<const_buffers_type> barrier(io_request<const_buffers_type> reqs = io_request<const_buffers_type>(), bool wait_for_device = false, bool and_metadata = false, deadline d = deadline()) noexcept = 0;
+ AFIO_MAKE_FREE_FUNCTION
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> barrier(io_request<const_buffers_type> reqs = io_request<const_buffers_type>(), bool wait_for_device = false, bool and_metadata = false, deadline d = deadline()) noexcept = 0;
/*! \class extent_guard
\brief RAII holder a locked extent of bytes in a file.
diff --git a/include/afio/v2.0/map_handle.hpp b/include/afio/v2.0/map_handle.hpp
index 1939888a..a2bc04f6 100644
--- a/include/afio/v2.0/map_handle.hpp
+++ b/include/afio/v2.0/map_handle.hpp
@@ -114,13 +114,13 @@ public:
\errors Any of the values POSIX dup() or NtCreateSection() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<section_handle> section(file_handle &backing, extent_type maximum_size = 0, flag _flag = flag::read | flag::write) noexcept;
//! \overload
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static inline result<section_handle> section(extent_type maximum_size, file_handle &backing, flag _flag = flag::read | flag::write) noexcept { return section(backing, maximum_size, _flag); }
//! \overload
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static inline result<section_handle> section(extent_type maximum_size) noexcept
{
file_handle backing;
@@ -140,7 +140,7 @@ public:
\errors Any of the values NtExtendSection() can return. On POSIX this is a no op.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<extent_type> truncate(extent_type newsize) noexcept;
};
inline std::ostream &operator<<(std::ostream &s, const section_handle::flag &v)
@@ -260,7 +260,7 @@ public:
\errors Any of the values POSIX mmap() or NtMapViewOfSection() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<map_handle> map(size_type bytes, section_handle::flag _flag = section_handle::flag::read | section_handle::flag::write) noexcept;
/*! Create a memory mapped view of a backing storage.
@@ -271,7 +271,7 @@ public:
\errors Any of the values POSIX mmap() or NtMapViewOfSection() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<map_handle> map(section_handle &section, size_type bytes = 0, extent_type offset = 0, section_handle::flag _flag = section_handle::flag::read | section_handle::flag::write) noexcept;
//! The memory section this handle is using
@@ -331,7 +331,7 @@ public:
\errors None, though the various signals and structured exception throws common to using memory maps may occur.
\mallocs None.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<buffers_type> read(io_request<buffers_type> reqs, deadline d = deadline()) noexcept override;
using io_handle::read;
@@ -344,7 +344,7 @@ public:
\errors None, though the various signals and structured exception throws common to using memory maps may occur.
\mallocs None.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
AFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> write(io_request<const_buffers_type> reqs, deadline d = deadline()) noexcept override;
using io_handle::write;
};
diff --git a/include/afio/v2.0/native_handle_type.hpp b/include/afio/v2.0/native_handle_type.hpp
index 1c5a7716..b327cb48 100644
--- a/include/afio/v2.0/native_handle_type.hpp
+++ b/include/afio/v2.0/native_handle_type.hpp
@@ -78,7 +78,7 @@ struct native_handle_type
//! Copy construct
constexpr native_handle_type(const native_handle_type &) = default;
//! Move construct
- QUICKCPPLIB_CONSTEXPR native_handle_type(native_handle_type &&o) noexcept : behaviour(std::move(o.behaviour)), _init(std::move(o._init))
+ constexpr native_handle_type(native_handle_type &&o) noexcept : behaviour(std::move(o.behaviour)), _init(std::move(o._init))
{
o.behaviour = disposition();
o._init = -1;
diff --git a/include/afio/v2.0/path_handle.hpp b/include/afio/v2.0/path_handle.hpp
index 9624ae76..e85bd15d 100644
--- a/include/afio/v2.0/path_handle.hpp
+++ b/include/afio/v2.0/path_handle.hpp
@@ -79,10 +79,10 @@ public:
\errors Any of the values POSIX open() or CreateFile() can return.
*/
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<path_handle> path(const path_handle &base, path_view_type _path) noexcept;
//! \overload
- //[[bindlib::make_free]]
+ AFIO_MAKE_FREE_FUNCTION
static AFIO_HEADERS_ONLY_MEMFUNC_SPEC result<path_handle> path(path_view_type _path) noexcept { return path(path_handle(), _path); }
};
diff --git a/release_notes.md b/release_notes.md
index b561f7f9..88662d37 100644
--- a/release_notes.md
+++ b/release_notes.md
@@ -20,6 +20,26 @@ You need these compilers or better:
Todo list for already implemented parts: https://ned14.github.io/afio/todo.html
+To build and test (make, ninja etc):
+
+~~~
+mkdir build
+cd build
+cmake ..
+cmake --build .
+ctest -R afio_sl
+~~~
+
+To build and test (Visual Studio, XCode etc):
+
+~~~
+mkdir build
+cd build
+cmake ..
+cmake --build . --config Release
+ctest -C Release -R afio_sl
+~~~
+
## v2 architecture and design implemented:
| NEW in v2 | Boost peer review feedback | |
@@ -44,6 +64,7 @@ Todo list for already implemented parts: https://ned14.github.io/afio/todo.html
| ✔ | | Much more granular, micro level internal logging of every code path taken.
| ✔ | | Path views used throughout, thus avoiding string copying and allocation in `std::filesystem::path`.
| ✔ | | Paths are equally interpreted as UTF-8 on all platforms.
+| ✔ | | We never store nor retain a path, as they are inherently racy and are best avoided.
Todo:
@@ -70,6 +91,7 @@ Todo:
| ✔ | | | Linux KAIO support for native async `O_DIRECT` i/o
| ✔ | ✔ | ✔ | i/o deadlines and cancellation.
| | ✔ | ✔ | Retrieving and setting the current maximum extent (size) of an open file.
+| | ✔ | ✔ | Retrieving the current path of an open file irrespective of where it has been renamed to by third parties.
| | ✔ | ✔ | statfs_t ported over from AFIO v1.
| | ✔ | ✔ | utils namespace ported over from AFIO v1.
| ✔ | ✔ | ✔ | `shared_fs_mutex` shared/exclusive entities locking based on lock files
diff --git a/test/kerneltest b/test/kerneltest
-Subproject 4fca8b3d2288f83eb6485da1a8c1a55802e4ce3
+Subproject 4223c1ef17449b794265fc706fa49f60954bb34