|
SimpleKernel 1.17.0
|
驱动注册表 — 以 ETL vector 存储 DriverEntry,并附带 flat_map 兼容索引。 More...
#include <driver_registry.hpp>

Public Member Functions | |
| auto | Register (const DriverEntry &entry) -> Expected< void > |
| 注册一个驱动条目。 | |
| auto | FindDriver (const DeviceNode &node) -> const DriverEntry * |
| 查找 match_table 中含有 node.compatible 字符串的第一个驱动 (flat_map 查找,O(Cn · log T))。 | |
构造 / 析构 | |
| DriverRegistry ()=default | |
| ~DriverRegistry ()=default | |
| DriverRegistry (const DriverRegistry &)=delete | |
| DriverRegistry (DriverRegistry &&)=delete | |
| auto | operator= (const DriverRegistry &) -> DriverRegistry &=delete |
| auto | operator= (DriverRegistry &&) -> DriverRegistry &=delete |
Private Attributes | |
| etl::vector< DriverEntry, kMaxDrivers > | drivers_ |
| etl::flat_map< const char *, size_t, kMaxCompatEntries, CStrLess > | compat_map_ |
| SpinLock | lock_ {"driver_registry"} |
Static Private Attributes | |
| static constexpr size_t | kMaxDrivers = 32 |
| static constexpr size_t | kMaxCompatEntries = 96 |
| 所有驱动 MatchEntry 行数上限(32 个驱动 × 约 3 条 compatible 字符串) | |
驱动注册表 — 以 ETL vector 存储 DriverEntry,并附带 flat_map 兼容索引。
注册时构建 etl::flat_map(compatible 字符串 → 驱动索引), 将 FindDriver 的复杂度从 O(N·M·K) 降至 O(Cn · log T)。
Definition at line 62 of file driver_registry.hpp.
|
default |
|
default |
|
delete |
|
delete |
|
inline |
查找 match_table 中含有 node.compatible 字符串的第一个驱动 (flat_map 查找,O(Cn · log T))。
Definition at line 93 of file driver_registry.hpp.
|
delete |
|
delete |
|
inline |
注册一个驱动条目。
Definition at line 70 of file driver_registry.hpp.
|
private |
Definition at line 126 of file driver_registry.hpp.
|
private |
Definition at line 125 of file driver_registry.hpp.
|
staticconstexprprivate |
所有驱动 MatchEntry 行数上限(32 个驱动 × 约 3 条 compatible 字符串)
Definition at line 123 of file driver_registry.hpp.
|
staticconstexprprivate |
Definition at line 121 of file driver_registry.hpp.
|
private |
Definition at line 127 of file driver_registry.hpp.