Re: [PATCH 3/5] rust: add pr_*_ratelimit! macros for printing
From: Alice Ryhl
Date: Tue Jun 23 2026 - 16:05:22 EST
On Tue, Jun 23, 2026 at 9:32 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Tue, Jun 23, 2026 at 5:38 PM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> >
> > Printing can be very expensive if it occurs often, so printing that can
> > be triggered by userspace should be rate limited. For this purpose, add
> > a Rust wrapper around `struct ratelimit_state` and use it in the new
> > macros.
> >
> > Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>
> Link: https://github.com/Rust-for-Linux/linux/issues/122
>
> (I back-linked to this thread from there too.)
>
> > + // SAFETY: This is a repr(transparent) wrapper, and the invariants are satisfied.
>
> `repr(transparent)`
>
> > + /// Returns `true` if the action is allowed, and `false` if it should be suppressed.
>
> [`true`]
> [`false`]
Thanks!
> I can change all these on apply.
This series has conflicts with other Rust Binder series, so it may be
easier if Greg takes it.
Alice