| From: |
| Daniel Sedlak <daniel-AT-sedlak.dev> |
| To: |
| Miguel Ojeda <ojeda-AT-kernel.org>, Alex Gaynor <alex.gaynor-AT-gmail.com> |
| Subject: |
| [RFC PATCH 0/3] rust abstractions for interacting with sysfs |
| Date: |
| Sun, 08 Dec 2024 14:15:42 +0100 |
| Message-ID: |
| <20241208131545.386897-1-daniel@sedlak.dev> |
| Cc: |
| Boqun Feng <boqun.feng-AT-gmail.com>, Gary Guo <gary-AT-garyguo.net>, Björn Roy Baron <bjorn3_gh-AT-protonmail.com>, Benno Lossin <benno.lossin-AT-proton.me>, Andreas Hindborg <a.hindborg-AT-kernel.org>, Alice Ryhl <aliceryhl-AT-google.com>, Trevor Gross <tmgross-AT-umich.edu>, rust-for-linux-AT-vger.kernel.org, Daniel Sedlak <daniel-AT-sedlak.dev> |
| Archive-link: |
| Article |
Hello,
For now, there are no facilities for the Rust side to tune modules written
in Rust in runtime or for just simple debug output/statistics from
the module. For exactly this purpose, the C has the sysfs. In this
patch series, I implemented a minimal sysfs wrapper utilizing kobject API.
I would like to collect your thoughts on whether:
- Do we want something like this in the rust part of the kernel?
- Do we want to support all sysfs capabilities?
I implemented a sample to present the API I have chosen for the Rust part.
It is a straightforward example that does not represent all capabilities
of the sysfs. The documentation will be potentially improved, but I would
like to first settle the abstractions.
Thank you
Daniel
Daniel Sedlak (3):
rust: kernel: types: add mode wrapper
rust: kernel: kobject: basic sysfs implementation
samples: rust: add kobject sample
rust/kernel/kobject.rs | 271 ++++++++++++++++++++++++++++++++
rust/kernel/lib.rs | 2 +
rust/kernel/types.rs | 17 ++
samples/rust/Kconfig | 8 +
samples/rust/Makefile | 1 +
samples/rust/kobject_example.rs | 66 ++++++++
6 files changed, 365 insertions(+)
create mode 100644 rust/kernel/kobject.rs
create mode 100644 samples/rust/kobject_example.rs
base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
--
2.47.1