[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6f789e0a-2e98-4ee8-a905-f2ae7c45cc48@proton.me>
Date: Fri, 29 Mar 2024 15:07:55 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Wedson Almeida Filho <wedsonaf@...il.com>
Cc: rust-for-linux@...r.kernel.org, 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>, Andreas Hindborg <a.hindborg@...sung.com>, Alice Ryhl <aliceryhl@...gle.com>, linux-kernel@...r.kernel.org, Wedson Almeida Filho <walmeida@...rosoft.com>
Subject: Re: [PATCH 2/2] samples: rust: add in-place initialisation sample
On 28.03.24 14:00, Wedson Almeida Filho wrote:
> On Wed, 27 Mar 2024 at 10:53, Benno Lossin <benno.lossin@...ton.me> wrote:
>> On 27.03.24 04:23, Wedson Almeida Filho wrote:
>>> + pr_info!("Am I built-in? {}\n", !cfg!(MODULE));
>>> + try_pin_init!(Self {
>>> + numbers: {
>>> + let mut numbers = Vec::new();
>>> + numbers.push(72, GFP_KERNEL)?;
>>> + numbers.push(108, GFP_KERNEL)?;
>>> + numbers.push(200, GFP_KERNEL)?;
>>> + numbers
>>> + },
>>> + })
>>
>> I think it might be useful to also have a field that needs pin-init, eg
>> a `Mutex` or similar. What about placing the `Vec` inside of a mutex?
>
> I'm not sure this belongs in a "minimal" example.
>
> But I added it in v2 because we're already violating minimality with
> vectors anyway. Perhaps we should later have minimal samples and
> rename these to something else.
I think a fully minimal example would be less valuable as a learning
resource. We can of course have both, but I think having real usage of
pin-init in this example can help people get familiar with it.
--
Cheers,
Benno
Powered by blists - more mailing lists