Re: [PATCH] rust: add seqfile abstraction

From: Christian Brauner
Date: Tue Oct 01 2024 - 06:25:36 EST


On Tue, 01 Oct 2024 09:07:02 +0000, Alice Ryhl wrote:
> This adds a simple seq file abstraction that lets you print to a seq
> file using ordinary Rust printing syntax.
>
> An example user from Rust Binder:
>
> pub(crate) fn full_debug_print(
> &self,
> m: &SeqFile,
> owner_inner: &mut ProcessInner,
> ) -> Result<()> {
> let prio = self.node_prio();
> let inner = self.inner.access_mut(owner_inner);
> seq_print!(
> m,
> " node {}: u{:016x} c{:016x} pri {}:{} hs {} hw {} cs {} cw {}",
> self.debug_id,
> self.ptr,
> self.cookie,
> prio.sched_policy,
> prio.prio,
> inner.strong.has_count,
> inner.weak.has_count,
> inner.strong.count,
> inner.weak.count,
> );
> if !inner.refs.is_empty() {
> seq_print!(m, " proc");
> for node_ref in &inner.refs {
> seq_print!(m, " {}", node_ref.process.task.pid());
> }
> }
> seq_print!(m, "\n");
> for t in &inner.oneway_todo {
> t.debug_print_inner(m, " pending async transaction ");
> }
> Ok(())
> }
>
> [...]

Seems straightforward.

---

Applied to the vfs.rust.file branch of the vfs/vfs.git tree.
Patches in the vfs.rust.file branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.rust.file

[1/1] rust: add seqfile abstraction
https://git.kernel.org/vfs/vfs/c/66423ace209c