From: "Danilo Krummrich" <dakr@kernel.org>
To: "Andreas Hindborg" <a.hindborg@kernel.org>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Jens Axboe" <axboe@kernel.dk>, "Miguel Ojeda" <ojeda@kernel.org>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Breno Leitao" <leitao@debian.org>,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] configfs: rust: add an API for adding default groups from C
Date: Mon, 16 Feb 2026 10:58:30 +0100 [thread overview]
Message-ID: <DGGAQ7XIDJ3P.1Q2K9WCC25EH3@kernel.org> (raw)
In-Reply-To: <20260215-configfs-c-default-groups-v1-1-e967daef6c36@kernel.org>
On Sun Feb 15, 2026 at 9:33 PM CET, Andreas Hindborg wrote:
> @@ -259,7 +269,13 @@ pub fn new(
> name: CString,
> item_type: &'static ItemType<Group<Data>, Data>,
> data: impl PinInit<Data, Error>,
> + default_groups: impl IntoIterator<Item = Arc<dyn CDefaultGroup>>,
> ) -> impl PinInit<Self, Error> {
> + let mut dg = KVec::new();
> + for group in default_groups {
> + dg.push(group, GFP_KERNEL).unwrap();
We should not panic the kernel on allocation failure.
If you wrap the function body into pin_init::pin_init_scope() you can just use
the '?' operator instead.
> + }
> +
> try_pin_init!(Self {
> group <- pin_init::init_zeroed().chain(|v: &mut Opaque<bindings::config_group>| {
> let place = v.get();
> @@ -268,13 +284,28 @@ pub fn new(
> unsafe {
> bindings::config_group_init_type_name(place, name.cast(), item_type.as_ptr())
> };
> +
> + for default_group in &dg {
> + // SAFETY: We keep the default groups alive until `Self` is dropped.
> + unsafe { bindings::configfs_add_default_group(default_group.group_ptr(), place) }
> + }
> Ok(())
> }),
> data <- data,
> + default_groups: dg,
> })
> }
> }
prev parent reply other threads:[~2026-02-16 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 20:33 [PATCH] configfs: rust: add an API for adding default groups from C Andreas Hindborg
2026-02-16 8:37 ` Alice Ryhl
2026-02-16 9:58 ` Danilo Krummrich [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=DGGAQ7XIDJ3P.1Q2K9WCC25EH3@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=axboe@kernel.dk \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=leitao@debian.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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