Rust-for-linux archive mirror
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: Wedson Almeida Filho <wedsonaf@gmail.com>
Cc: rust-for-linux@vger.kernel.org, "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	linux-kernel@vger.kernel.org,
	"Wedson Almeida Filho" <walmeida@microsoft.com>
Subject: Re: [PATCH 2/2] samples: rust: add in-place initialisation sample
Date: Fri, 29 Mar 2024 15:07:55 +0000	[thread overview]
Message-ID: <6f789e0a-2e98-4ee8-a905-f2ae7c45cc48@proton.me> (raw)
In-Reply-To: <CANeycqp08CFeh4rO+b1ocGDp_nViN2uYhL6_RZ4PWn5TeVmNVQ@mail.gmail.com>

On 28.03.24 14:00, Wedson Almeida Filho wrote:
> On Wed, 27 Mar 2024 at 10:53, Benno Lossin <benno.lossin@proton.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


      reply	other threads:[~2024-03-29 15:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  3:23 [PATCH 0/2] In-place module initialisation Wedson Almeida Filho
2024-03-27  3:23 ` [PATCH 1/2] rust: introduce `InPlaceModule` Wedson Almeida Filho
2024-03-27  8:13   ` Valentin Obst
2024-03-27 14:23     ` Wedson Almeida Filho
2024-03-27 15:56       ` Benno Lossin
2024-03-28 12:57         ` Wedson Almeida Filho
2024-03-27 16:16   ` Benno Lossin
2024-03-28 12:56     ` Wedson Almeida Filho
2024-03-27  3:23 ` [PATCH 2/2] samples: rust: add in-place initialisation sample Wedson Almeida Filho
2024-03-27 13:53   ` Benno Lossin
2024-03-28 13:00     ` Wedson Almeida Filho
2024-03-29 15:07       ` Benno Lossin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f789e0a-2e98-4ee8-a905-f2ae7c45cc48@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=walmeida@microsoft.com \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).