[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72mm5Anx+MPc15Qunq3ewdmQQjkzNTcV7rx78z9UniT9CQ@mail.gmail.com>
Date: Thu, 1 May 2025 12:00:36 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Matthew Maurer <mmaurer@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Sami Tolvanen <samitolvanen@...gle.com>,
Timur Tabi <ttabi@...dia.com>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 1/4] rust: debugfs: Bind DebugFS directory creation
On Thu, May 1, 2025 at 1:32 AM Matthew Maurer <mmaurer@...gle.com> wrote:
>
> +// INVARIANT: The wrapped pointer will always be NULL, an error, or an owned DebugFS `dentry`
We do it the other way around, i.e. `# Invariants` section for the
type, and `// INVARIANT: ...` comments for the places that ensure the
type invariant.
+ /// // parent exists in DebugFS here.
Parent ...
> + // * If parent is None, parent accepts null pointers to mean create at root
> + // * If parent is Some, parent accepts live dentry debugfs pointers
`None`, `Some` (also please end sentences with periods)
> + /// Returns the pointer representation of the DebugFS directory.
> + ///
> + /// # Invariant
> + ///
> + /// The value returned from this function will always be an error code, NUL, or a live DebugFS
Hmm... so far we use `# Invariants` only for types. Perhaps you could
say something like "Thanks to the type invariant, the return value
will always be ..."
`NULL`?
Thanks!
Cheers,
Miguel
Powered by blists - more mailing lists