rust: drm: file: Add File abstraction
authorAsahi Lina <lina@asahilina.net>
Thu, 10 Apr 2025 23:55:25 +0000 (01:55 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Thu, 24 Apr 2025 12:11:58 +0000 (14:11 +0200)
commita98a73be9ee9c42495690b2fe56e1ce27768289a
tree0bff4bb62cb35944fe70b9f438a391d9766e4de8
parent0600032c54b7adc309d334c109374433ce3ab243
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>
rust/bindings/bindings_helper.h
rust/kernel/drm/device.rs
rust/kernel/drm/driver.rs
rust/kernel/drm/file.rs [new file with mode: 0644]
rust/kernel/drm/mod.rs