[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=N+--1bhg+nSTDhvx3mFDcvppXo9Jxa__OPQRiSgEo2w@mail.gmail.com>
Date: Tue, 21 Oct 2025 18:47:41 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, lossin@...nel.org, a.hindborg@...nel.org,
aliceryhl@...gle.com, tmgross@...ch.edu, mmaurer@...gle.com,
rust-for-linux@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH v2 1/8] rust: fs: add file::Offset type alias
On Tue, Oct 21, 2025 at 6:25 PM Danilo Krummrich <dakr@...nel.org> wrote:
>
> We need arithmetic operations (e.g. checked_add()) and type conversions (e.g.
> from/into usize). That'd be quite some code to write that just forwards to the
> inner primitive.
If it is just e.g. add/sub and a few from/into, then it sounds ideal
(i.e. I am worried if it wants to be used as essentially a primitive,
in which case I agree it would need to be automated to some degree).
> So, I think as by now a new type makes sense if there is some reasonable
> additional semantics to capture.
To me, part of that is restricting what can be done with the type to
prevent mistakes.
i.e. a type alias is essentially the wild west, and this kind of
type/concept is common enough that it sounds a good idea to pay the
price to provide a proper type for it.
> Maybe the action to take from this is to add this to the list of (good first)
> issues (not sure this is actually a _good first_ issue though :).
So I don't want to delay real work, and as long as we do it early
enough that we don't have many users, that sounds like a good idea to
me -- done:
https://github.com/Rust-for-Linux/linux/issues/1198
Also took the chance to ask for a couple examples/tests.
I hope that helps.
Cheers,
Miguel
Powered by blists - more mailing lists