rust: dmi: add basic DMI matching abstraction
PATCH v2 1/1 rust: dmi: add basic DMI matching abstraction
Exposes linux/dmi.h to bindgen, adds MAINTAINERS entry and adds an MVP of kernel::dmi module.
---
This abstraction is used by:
https://lore.kernel.org/all/[email protected]/
This patch adds an initial Rust abstraction for DMI, exposing get_system_info().
---
Changes in v2:
- Small improvements - formatting and comments (Miguel)
- get_system_info() has been marked unsafe to avoid an unnecessary soundness hole (Miguel). The safety requirement is easy to prove, so in my opinion this is sufficient for an MVP. This could potentially be upgraded to a safe function at a later stage with a C change.
- Added #[inline] to small helper (Sashiko).
- Resolved invalid enum variant (Sashiko) and renamed to better reflect the available variants.
- Link to v1: https://patch.msgid.link/[email protected]
--- MAINTAINERS | 1 + rust/bindings/bindings_helper.h | 1 + rust/kernel/dmi.rs | 99 +++++++++++++++++++++++++++++++++++++++++ rust/kernel/lib.rs | 1 + 4 files changed, 102 insertions(+)
MAINTAINERS +1 -0
@@ -7977,6 +7977,7 @@ F: Documentation/ABI/testing/sysfs-firmware-dmi-tables F: drivers/firmware/dmi-id.c F: drivers/firmware/dmi_scan.c F: include/linux/dmi.h +F: rust/kernel/dmi.rs DOCUMENTATION M: Jonathan Corbet <[email protected]>
rust/bindings/bindings_helper.h +1 -0
@@ -56,6 +56,7 @@#include <linux/dma-fence.h> #include <linux/dma-mapping.h> #include <linux/dma-resv.h> +#include <linux/dmi.h> #include <linux/errname.h> #include <linux/ethtool.h> #include <linux/fdtable.h>
rust/kernel/dmi.rs new file +99 -0
99 lines not on this page · raw message
rust/kernel/lib.rs +1 -0
@@ -69,6 +69,7 @@pub mod dma;#[cfg( CONFIG_DMA_SHARED_BUFFER )] pub mod dma_buf; +pub mod dmi;pub mod driver;#[cfg( CONFIG_DRM = "y" )] pub mod drm;
---
base-commit: 4843f6873f7c4835e62f2c73ba0fd538e57a2f22
change-id: 20261121-rust-dmi-c49d2041d7e2
Best regards,
Signature · 1 line
Nick Dowsett <[email protected]>