All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>, "Jens Axboe" <axboe@kernel.dk>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Josef Bacik" <josef@toxicpanda.com>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: bindings: derive Zeroable for bindgen's opaque array wrappers
Date: Sat, 31 Oct 2026 12:29:31 -0400	[thread overview]
Message-ID: <20261031162931.792607-1-sashal@kernel.org> (raw)
In-Reply-To: <CAH5fLgiSOae48jr65rv6ynLWUhT7xVCjjCEK=9oKXvSxKpdq6g@mail.gmail.com>

On Sat, Oct 31, 2026 at 05:17:46PM +0100, Alice Ryhl wrote:
>Is it possible to instead fix this by adding the impl of Zeroable in
>rust/bindings/lib.rs, similar to this piece of code that we already
>have:
>
>unsafe impl<Storage> Zeroable for __BindgenBitfieldUnit<Storage> where
>Storage: Zeroable {}

I looked at doing it that way, but the wrapper types don't always exist,
so a fixed impl in lib.rs won't build everywhere:

 - bindgen 0.71 and 0.72 (we still support 0.71.1) don't generate them
   at all, the blob is a plain array there.

 - 0.73 only emits the alignments a config actually needs. On x86_64,
   allmodconfig gets __BindgenOpaqueArray, __BindgenOpaqueArray8,
   __BindgenOpaqueArray64 and __BindgenOpaqueArray4096, but defconfig
   with Rust enabled has no __BindgenOpaqueArray4096, so an impl for it
   would break the build there.

__BindgenBitfieldUnit works because it's always generated. We could do it
in lib.rs with a Kconfig symbol for the bindgen version plus some way to
know which alignments a config ends up with, but tagging the wrappers
right after bindgen runs seemed simpler.

--
Thanks,
Sasha

  reply	other threads:[~2026-10-31 16:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 13:50 [GIT PULL] block fixes for 7.4-rc1 Jens Axboe
2026-10-30 18:00 ` pr-tracker-bot
2026-10-31 15:28 ` [PATCH] rust: bindings: derive Zeroable for bindgen's opaque array wrappers Sasha Levin
2026-10-31 16:17   ` Alice Ryhl
2026-10-31 16:29     ` Sasha Levin [this message]
2026-10-31 16:37       ` Alice Ryhl
2026-11-01  0:48   ` Alexandre Courbot

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=20261031162931.792607-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=axboe@kernel.dk \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.