ublk-cpp v0.0
Loading...
Searching...
No Matches
query.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "ublk/ublk_cmd.h"
9#include <condy.hpp>
10#include <utility>
11
12namespace ublk {
13
14namespace detail {
15namespace ex = condy::detail::ex;
16}
17
23 template <typename Env>
24 requires requires(const Env &env) {
25 env.query(std::declval<fetch_dev_info_t>());
26 }
27 constexpr const ublksrv_ctrl_dev_info *
28 operator()(const Env &env) const noexcept {
29 return env.query(fetch_dev_info_t{});
30 }
31
32 template <typename Env>
33 requires(!requires(const Env &env) {
34 env.query(std::declval<fetch_dev_info_t>());
35 })
36 constexpr const ublksrv_ctrl_dev_info *
37 operator()(const Env &) const noexcept {
38 return nullptr;
39 }
40
41 [[nodiscard]]
42 static consteval bool query(detail::ex::forwarding_query_t) noexcept {
43 return true;
44 }
45};
46
49
50} // namespace ublk
The main namespace of the ublk-cpp library.
Definition ublk.hpp:21
constexpr fetch_dev_info_t fetch_dev_info
Query object instance of fetch_dev_info_t.
Definition query.hpp:48
Environment query for the cached ublk device info. Returns nullptr if the environment doesn't provide...
Definition query.hpp:22