summaryrefslogtreecommitdiff
path: root/rust/kernel/drm/driver.rs
diff options
context:
space:
mode:
authorAsahi Lina <lina@asahilina.net>2025-04-11 01:55:25 +0200
committerDanilo Krummrich <dakr@kernel.org>2025-04-24 14:11:58 +0200
commita98a73be9ee9c42495690b2fe56e1ce27768289a (patch)
tree0bff4bb62cb35944fe70b9f438a391d9766e4de8 /rust/kernel/drm/driver.rs
parent0600032c54b7adc309d334c109374433ce3ab243 (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/driver.rs')
-rw-r--r--rust/kernel/drm/driver.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/rust/kernel/drm/driver.rs b/rust/kernel/drm/driver.rs
index 4f80bc448c09..f0c2936c3374 100644
--- a/rust/kernel/drm/driver.rs
+++ b/rust/kernel/drm/driver.rs
@@ -105,6 +105,9 @@ pub trait Driver {
/// The type used to manage memory for this driver.
type Object: AllocImpl;
+ /// The type used to represent a DRM File (client)
+ type File: drm::file::DriverFile;
+
/// Driver metadata
const INFO: DriverInfo;