Re: [PATCH 3/5] rust: add pr_*_ratelimit! macros for printing
From: Miguel Ojeda
Date: Tue Jun 23 2026 - 15:34:02 EST
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`]
I can change all these on apply.
Cheers,
Miguel