linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Philipp Stanner <pstanner@redhat.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Asahi Lina" <lina@asahilina.net>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@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@samsung.com>,
	"Matthew Wilcox" <willy@infradead.org>,
	rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	kernel-dev@igalia.com
Subject: Re: [PATCH v8 2/2] rust: xarray: Add an abstraction for XArray
Date: Tue, 26 Mar 2024 18:03:59 +0100	[thread overview]
Message-ID: <CANiq72=5ajtjKK5+XihiCuK32TALDi4qaMSJ-0UHDXq5mxtdCw@mail.gmail.com> (raw)
In-Reply-To: <5e19d7959d43afe0d95d5b8e9a9b58472fe56656.camel@redhat.com>

On Tue, Mar 26, 2024 at 2:53 PM Philipp Stanner <pstanner@redhat.com> wrote:
>
> You mean if `ret` was a pointer that, consequently, would have to be
> checked for equality rather then for less-than 0?

No, I meant a C function that happens to return an `int` with
different semantics (e.g. encoding for the error) than the usual ones
(Rust does not allow to compare a raw pointer with an integer).

> The difference is that checkpatch is an additional tool that is not
> tied to the compiler or build chain.

Perhaps a better comparison would be Sparse or Coccinelle then? (i.e.
in that we ideally would test the source code, not the patches, all
the time).

In any case, if you mean to have kernel-only lints, Gary created klint
[1] for that and Julia and Tathagata announced Coccinelle for Rust [2]
some months ago.

We hope we can start putting these tools into good use soon (not to
say they are not useful already, e.g. klint already found actual
issues in the past), ideally running them all the time for all code.

Unless you mean replicating all the compiler diagnostics -- that is
not really feasible (bandwidth-wise) and I am not sure what we would
gain in practice. We don't do that either for kernel C.

[1] https://rust-for-linux.com/klint
[2] https://rust-for-linux.com/coccinelle-for-rust

> Yes, and I think that shouldn't be done. The C coding guideline is more
> of a recommendation.

Kernel C is quite consistent (relative to what you could randomly do
in C), even including the big differences from some subsystems. So, in
practice, some of the guidelines are rules.

For Rust, we had the chance to be even more consistent (thanks to
having the tooling available from the start), and we went for that,
because we see that as a good thing that will pay off long term.

Cheers,
Miguel

  reply	other threads:[~2024-03-26 17:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 23:57 [PATCH v8 0/2] rust: xarray: Add an abstraction for XArray Maíra Canal
2024-03-09 23:57 ` [PATCH v8 1/2] rust: types: add FOREIGN_ALIGN to ForeignOwnable Maíra Canal
2024-03-15 12:19   ` Benno Lossin
2024-03-09 23:57 ` [PATCH v8 2/2] rust: xarray: Add an abstraction for XArray Maíra Canal
2024-03-18 12:10   ` Alice Ryhl
2024-03-19  9:32     ` Philipp Stanner
2024-03-22  0:22       ` John Hubbard
2024-03-22  1:20         ` Boqun Feng
2024-03-22  1:34           ` John Hubbard
2024-03-26  7:41           ` Philipp Stanner
2024-03-26 12:23             ` Miguel Ojeda
2024-03-26 13:53               ` Philipp Stanner
2024-03-26 17:03                 ` Miguel Ojeda [this message]
2024-03-26 12:16           ` Miguel Ojeda
2024-03-22 11:12   ` Benno Lossin

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='CANiq72=5ajtjKK5+XihiCuK32TALDi4qaMSJ-0UHDXq5mxtdCw@mail.gmail.com' \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=kernel-dev@igalia.com \
    --cc=lina@asahilina.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mcanal@igalia.com \
    --cc=ojeda@kernel.org \
    --cc=pstanner@redhat.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    --cc=willy@infradead.org \
    /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).