[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DDO3T1NMVRJR.3OPF5GW5UQAGH@kernel.org>
Date: Tue, 21 Oct 2025 17:26:28 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@...il.com>
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 5:08 PM CEST, Miguel Ojeda wrote:
> On Tue, Oct 21, 2025 at 12:27 AM Danilo Krummrich <dakr@...nel.org> wrote:
>>
>> Add a type alias for file offsets, i.e. bindings::loff_t. Trying to
>> avoid using raw bindings types, this seems to be the better alternative
>> compared to just using i64.
>
> Would a newtype be too painful?
>
> Note: I didn't actually check if it is a sensible idea, but when I see
> an alias I tend to ask myself that so it would be nice to know the
> pros/cons (we could ideally mention why in the commit message in cases
> like this).
Yeah, I don't think there's any value making this a new type in this case. There
are no type invariants, useful methods, etc.
In fact, not even the type alias is strictly needed, as i64 would be sufficient
as well.
The main motivation for the type alias is that I think i64 is not super
intuitive for an offset value (people would rather expect usize or isize) and
it's nice to not have bindings::loff_t exposed to driver APIs.
Powered by blists - more mailing lists