From: Josef Ippisch via B4 Relay <devnull+josef.ippisch.dev.mailbox.org@kernel.org>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"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>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>
Cc: driver-core@lists.linux.dev, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org,
Joshua Liebow-Feeser <joshlf@google.com>,
Miguel Ojeda <ojeda@kernel.org>,
Josef Ippisch <josef.ippisch.dev@mailbox.org>
Subject: [PATCH v2 0/2] rust: debugfs: migrate debugfs traits requirements to zerocopy
Date: Tue, 28 Jul 2026 19:31:18 +0200 [thread overview]
Message-ID: <20260728-migrate-binarywriter-to-zerocopy-intobytes-v2-0-0a4ec1d3ead4@mailbox.org> (raw)
Migrate `BinaryWriter` and `BinaryReaderMut`'s default implementation's
requirements on T from `kernel::transmute` traits to `zerocopy` traits.
This is part of a bigger migration from rust/kernel/transmute.rs to the
zerocopy crate, see also [1] and [2]
[1] https://github.com/Rust-for-Linux/linux/issues/975
[2] https://github.com/Rust-for-Linux/linux/issues/1241
The crate zerocopy was introduced with
c37398010a05 rust: zerocopy: import crate
This introduced among other things the `FromBytes` and `IntoBytes` traits
that, when derived, do better checks on the actual requirements of the
types they are implemented on than the existing
`kernel::transmute::FromBytes` and `kernel::transmute::AsBytes` traits,
respectively.
This is my first kernel patch so please let me know if I do anything wrong
process wise or regarding some other aspect!
I noticed that we could probably get rid of the `BinaryWriter` and
`BinaryReaderMut` implementations for `Vec` altogether if we implemented
`FromBytes`, `Immutable` and `IntoBytes` for `Vec`. These are already
implemented for [T] after all. What do you think?
Suggested-by: Joshua Liebow-Feeser <joshlf@google.com>
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/975
Link: https://github.com/Rust-for-Linux/linux/issues/1241
Signed-off-by: Josef Ippisch <josef.ippisch.dev@mailbox.org>
---
Changes in v2:
- Addresses Sashiko AI review's comment about also migrating
`BinaryReaderMut` to zerocopy to not bifurcate the API requirements of
debugfs/traits.rs.
- Do not `use zerocopy::{FromBytes, IntoBytes}` as they are part of
`use kernel::prelude::*`.
- For some reason sending v2 via SMTP server did not reach the mailing
list. I apologize if some of you receive this twice now. I did not
mark this RESEND because of the email never reaching the mailing list.
- Link to v1: https://patch.msgid.link/20260719-migrate-binarywriter-to-zerocopy-intobytes-v1-0-27ed30512e75@mailbox.org
---
Josef Ippisch (2):
rust: debugfs: migrate debugfs traits requirements to zerocopy
rust: debugfs: remove unsafe blocks from traits impl for Vec
rust/kernel/debugfs/traits.rs | 41 +++++++++++------------------------------
1 file changed, 11 insertions(+), 30 deletions(-)
---
base-commit: 7059bdf4f04a3e14f4fafb3ac35fdca913e3e21a
change-id: 20260719-migrate-binarywriter-to-zerocopy-intobytes-1e8f4ef93a60
Best regards,
--
Josef Ippisch <josef.ippisch.dev@mailbox.org>
next reply other threads:[~2026-07-28 17:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 17:31 Josef Ippisch via B4 Relay [this message]
2026-07-28 17:31 ` [PATCH v2 1/2] " Josef Ippisch via B4 Relay
2026-07-28 17:31 ` [PATCH v2 2/2] rust: debugfs: remove unsafe blocks from traits impl for Vec Josef Ippisch via B4 Relay
2026-07-31 9:09 ` [PATCH v2 0/2] rust: debugfs: migrate debugfs traits requirements to zerocopy Greg Kroah-Hartman
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=20260728-migrate-binarywriter-to-zerocopy-intobytes-v2-0-0a4ec1d3ead4@mailbox.org \
--to=devnull+josef.ippisch.dev.mailbox.org@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=josef.ippisch.dev@mailbox.org \
--cc=joshlf@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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
all inboxes | Powered by JetHome®