diff options
author | Asahi Lina <lina@asahilina.net> | 2025-04-11 01:55:25 +0200 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-04-24 14:11:58 +0200 |
commit | a98a73be9ee9c42495690b2fe56e1ce27768289a (patch) | |
tree | 0bff4bb62cb35944fe70b9f438a391d9766e4de8 /rust/kernel/drm/mod.rs | |
parent | 0600032c54b7adc309d334c109374433ce3ab243 (diff) |
rust: drm: file: Add File abstraction
A DRM File is the DRM counterpart to a kernel file structure,
representing an open DRM file descriptor.
Add a Rust abstraction to allow drivers to implement their own File types
that implement the DriverFile trait.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://lore.kernel.org/r/20250410235546.43736-7-dakr@kernel.org
[ Rework of drm::File
* switch to the Opaque<T> type
* fix (mutable) references to struct drm_file (which in this context
is UB)
* restructure and rename functions to align with common kernel
schemes
* write and fix safety and invariant comments
* remove necessity for and convert 'as' casts
* original source archive: https://archive.is/GH8oy
- Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/drm/mod.rs')
-rw-r--r-- | rust/kernel/drm/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/kernel/drm/mod.rs b/rust/kernel/drm/mod.rs index 2d88e70ba607..b36223e5bd98 100644 --- a/rust/kernel/drm/mod.rs +++ b/rust/kernel/drm/mod.rs @@ -4,12 +4,14 @@ pub mod device; pub mod driver; +pub mod file; pub mod ioctl; pub use self::device::Device; pub use self::driver::Driver; pub use self::driver::DriverInfo; pub use self::driver::Registration; +pub use self::file::File; pub(crate) mod private { pub trait Sealed {} |