From: Alice Ryhl <aliceryhl@google.com>
To: Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Miguel Ojeda <ojeda@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "Kees Cook" <kees@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust: add seqfile abstraction
Date: Tue, 1 Oct 2024 11:10:07 +0200 [thread overview]
Message-ID: <CAH5fLggH_uThjbdNW6pwOTT72ogLbyZGXDAnTLoJyvmfZ8kf_A@mail.gmail.com> (raw)
In-Reply-To: <20241001-seqfile-v1-1-dfcd0fc21e96@google.com>
On Tue, Oct 1, 2024 at 11:07 AM Alice Ryhl <aliceryhl@google.com> 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(())
> }
>
> The `SeqFile` type is marked not thread safe so that `call_printf` can
> be a `&self` method. The alternative is to use `self: Pin<&mut Self>`
> which is inconvenient, or to have `SeqFile` wrap a pointer instead of
> wrapping the C struct directly.
>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
It's supposed to say this below the --- line:
This series is based on top of vfs.rust.file for the NotThreadSafe type.
I have no idea why b4 decided to drop this information ...
Alice
next prev parent reply other threads:[~2024-10-01 9:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 9:07 [PATCH] rust: add seqfile abstraction Alice Ryhl
2024-10-01 9:10 ` Alice Ryhl [this message]
2024-10-01 10:23 ` Christian Brauner
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=CAH5fLggH_uThjbdNW6pwOTT72ogLbyZGXDAnTLoJyvmfZ8kf_A@mail.gmail.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alex.gaynor@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=brauner@kernel.org \
--cc=gary@garyguo.net \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).