[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240327032337.188938-1-wedsonaf@gmail.com>
Date: Wed, 27 Mar 2024 00:23:35 -0300
From: Wedson Almeida Filho <wedsonaf@...il.com>
To: rust-for-linux@...r.kernel.org
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>,
linux-kernel@...r.kernel.org,
Wedson Almeida Filho <walmeida@...rosoft.com>
Subject: [PATCH 0/2] In-place module initialisation
From: Wedson Almeida Filho <walmeida@...rosoft.com>
Introduce `InPlaceModule`, which allows modules to be initialised
inplace, as opposed to the current state where modules must return an
instance which is moved to its final memory location.
This allows us to have modules whose state hold objects that must be
initialised inplace like locks. It also allows us to implement
registrations (e.g., driver registration) inplace and have them similar
to their C counterparts where no new allocations are needed.
This is built on top of the allocation APIs because the sample module is
a modified version of rust_minimal, which would be incompatible with the
allocation API series because it uses vectors.
Wedson Almeida Filho (2):
rust: introduce `InPlaceModule`
samples: rust: add in-place initialisation sample
rust/kernel/lib.rs | 25 ++++++++++++++++++++-
rust/macros/module.rs | 18 ++++++----------
samples/rust/Kconfig | 11 ++++++++++
samples/rust/Makefile | 1 +
samples/rust/rust_inplace.rs | 42 ++++++++++++++++++++++++++++++++++++
5 files changed, 84 insertions(+), 13 deletions(-)
create mode 100644 samples/rust/rust_inplace.rs
base-commit: e0ff891dbadea6226042574a0cbfc24df0318b13
--
2.34.1
Powered by blists - more mailing lists