public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] rust: seq_file: add puts, putc, write, and hex_dump methods
@ 2026-04-08 21:55 Christian Benton
  2026-04-08 21:56 ` [PATCH v2 1/1] " Christian Benton
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Benton @ 2026-04-08 21:55 UTC (permalink / raw)
  To: rust-for-linux, linux-kernel, linux-fsdevel
  Cc: aliceryhl, ojeda, boqun, gary, bjorn3_gh, lossin, a.hindborg,
	tmgross, dakr, viro, brauner, jack, Christian Benton

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-12  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 21:55 [PATCH v2 0/1] rust: seq_file: add puts, putc, write, and hex_dump methods Christian Benton
2026-04-08 21:56 ` [PATCH v2 1/1] " Christian Benton
2026-04-12  0:45   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox