From: Christian Benton <t1bur0n.kernel.org@protonmail.ch>
To: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Cc: aliceryhl@google.com, ojeda@kernel.org, boqun@kernel.org,
gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org,
viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
Christian Benton <t1bur0n.kernel.org@protonmail.ch>
Subject: [PATCH v2 0/1] rust: seq_file: add puts, putc, write, and hex_dump methods
Date: Wed, 08 Apr 2026 21:55:58 +0000 [thread overview]
Message-ID: <20260408215530.446994-1-t1bur0n.kernel.org@protonmail.ch> (raw)
This is v2 of the seq_file methods patch, addressing feedback from
Alice Ryhl and build issues reported by the kernel test robot.
On use-case:
Looking at the existing Rust Binder code in drivers/android/binder/,
there are several places where seq_print! is used purely to output
static strings, for example in freeze.rs and node.rs:
seq_print!(m, "{}has frozen binder\n", prefix);
seq_print!(m, "{}has dead binder\n", prefix);
seq_print!(m, "{}has cleared dead binder\n", prefix);
seq_print!(m, "{}has cleared death notification\n", prefix);
The static string portions of these calls are candidates for puts(),
which avoids the format string parsing overhead of seq_printf entirely.
write() and hex_dump() do not have obvious in-tree users today. The
motivation for including them is API completeness — any Rust driver
needing these operations currently must call C bindings directly,
bypassing the safe abstraction. An out-of-tree user that motivated
the full set is the amdtelem driver, which exposes GPU telemetry
through a misc character device and uses hex_dump() for register
data output.
If the preference is to merge only puts() and putc() now and add
write() and hex_dump() when concrete in-tree users exist, I am happy
to split the patch accordingly.
Changes in v2:
- Reformat use statement to satisfy rustfmt line length requirement
- Rename as_c_int() to to_c_int() to satisfy clippy wrong_self_convention
- Replace rowsize/groupsize as-casts with ffi::c_int::from() to satisfy
clippy cast_lossless lint
Christian Benton (1):
rust: seq_file: add puts, putc, write, and hex_dump methods
rust/kernel/seq_file.rs | 87 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 86 insertions(+), 1 deletion(-)
--
2.53.0
next reply other threads:[~2026-04-08 21:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 21:55 Christian Benton [this message]
2026-04-08 21:56 ` [PATCH v2 1/1] rust: seq_file: add puts, putc, write, and hex_dump methods Christian Benton
2026-04-12 0:45 ` kernel test robot
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=20260408215530.446994-1-t1bur0n.kernel.org@protonmail.ch \
--to=t1bur0n.kernel.org@protonmail.ch \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=brauner@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=jack@suse.cz \
--cc=linux-fsdevel@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 \
--cc=viro@zeniv.linux.org.uk \
/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