Re: [PATCH] rust: seq_file: add puts, putc, write, and hex_dump methods
From: Alice Ryhl
Date: Tue Apr 07 2026 - 04:20:34 EST
On Fri, Apr 03, 2026 at 11:39:32PM +0000, Christian Benton wrote:
> The SeqFile abstraction currently only exposes seq_printf via the
> seq_print! macro. This leaves several commonly used seq_file operations
> unavailable to Rust kernel code.
>
> Add the following methods to SeqFile:
>
> - puts(): writes a C string using __seq_puts()
> - putc(): writes a single byte using seq_putc()
> - write(): writes raw bytes using seq_write()
> - hex_dump(): dumps binary data as formatted hex using seq_hex_dump()
>
> Also add HexDumpPrefix, a Rust enum wrapping the DUMP_PREFIX_NONE,
> DUMP_PREFIX_ADDRESS, and DUMP_PREFIX_OFFSET constants, replacing the
> raw integer interface with a type-safe alternative that makes invalid
> prefix values unrepresentable.
>
> Signed-off-by: Christian Benton <t1bur0n.kernel.org@xxxxxxxxxxxxx>
What is the use-case that motivated this patch?
It's possible that Rust Binder has some use-cases that can be converted
to puts(), but I don't think it has use-cases for the other methods.
Alice