diff options
Diffstat (limited to 'include/llfio/v2.0/native_handle_type.hpp')
-rw-r--r-- | include/llfio/v2.0/native_handle_type.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llfio/v2.0/native_handle_type.hpp b/include/llfio/v2.0/native_handle_type.hpp index cd2a42cd..23915d98 100644 --- a/include/llfio/v2.0/native_handle_type.hpp +++ b/include/llfio/v2.0/native_handle_type.hpp @@ -52,6 +52,7 @@ struct native_handle_type // NOLINT nonblocking = 1U << 4U, //!< Requires additional synchronisation (Windows: `OVERLAPPED`; POSIX: `O_NONBLOCK`) seekable = 1U << 5U, //!< Is seekable aligned_io = 1U << 6U, //!< Requires sector aligned i/o (typically 512 or 4096) + kernel_handle = 1U << 7U, //!< Handle is a valid kernel handle file = 1U << 8U, //!< Is a regular file directory = 1U << 9U, //!< Is a directory @@ -63,6 +64,8 @@ struct native_handle_type // NOLINT section = 1U << 15U, //!< Is a memory section allocation = 1U << 16U, //!< Is a memory allocation path = 1U << 17U, //!< Is a path + tls_socket = 1U << 18U, //!< Is a TLS socket + http_socket = 1U << 19U, //!< Is a HTTP or HTTPS socket safety_barriers = 1U << 20U, //!< Issue write reordering barriers at various points cache_metadata = 1U << 21U, //!< Is serving metadata from the kernel cache @@ -85,6 +88,8 @@ struct native_handle_type // NOLINT int pid; // NOLINT //! A Windows HANDLE win::handle h; // NOLINT + //! A Windows SOCKET + win::socket sock; //! A third party pointer void *ptr; }; @@ -166,6 +171,8 @@ struct native_handle_type // NOLINT constexpr bool is_seekable() const noexcept { return (behaviour & disposition::seekable) ? true : false; } //! True if requires aligned i/o constexpr bool requires_aligned_io() const noexcept { return (behaviour & disposition::aligned_io) ? true : false; } + //! True if handle is a valid kernel handle + constexpr bool is_kernel_handle() const noexcept { return (behaviour & disposition::kernel_handle) ? true : false; } //! True if a regular file or device constexpr bool is_regular() const noexcept { return (behaviour & disposition::file) ? true : false; } @@ -187,6 +194,10 @@ struct native_handle_type // NOLINT constexpr bool is_allocation() const noexcept { return (behaviour & disposition::allocation) ? true : false; } //! True if a path or a directory constexpr bool is_path() const noexcept { return (behaviour & disposition::path) ? true : false; } + //! True if a TLS socket + constexpr bool is_tls_socket() const noexcept { return (behaviour & disposition::tls_socket) ? true : false; } + //! True if a HTTP socket + constexpr bool is_http_socket() const noexcept { return (behaviour & disposition::http_socket) ? true : false; } }; static_assert((sizeof(void *) == 4 && sizeof(native_handle_type) == 8) || (sizeof(void *) == 8 && sizeof(native_handle_type) == 12), "native_handle_type is not 8 or 12 bytes in size!"); |