[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40e412fb-5b45-46d4-ad62-252dea0b9ac1@nvidia.com>
Date: Fri, 5 Sep 2025 14:29:07 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Alexandre Courbot <acourbot@...dia.com>,
Danilo Krummrich <dakr@...nel.org>
Cc: Joel Fernandes <joelagnelf@...dia.com>, linux-kernel@...r.kernel.org,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
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 <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Alistair Popple <apopple@...dia.com>, nouveau@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 1/2] nova-core: Add a library for bitfields in Rust
structs
On 9/4/25 4:06 AM, Alexandre Courbot wrote:
> On Thu Sep 4, 2025 at 4:16 PM JST, Danilo Krummrich wrote:
>> On Thu Sep 4, 2025 at 5:16 AM CEST, Alexandre Courbot wrote:
>>> On Thu Sep 4, 2025 at 12:15 AM JST, Joel Fernandes wrote:
>>> <snip>
>> pub struct PageTableEntry {
>> 63:63 nx as bool,
>> 62:52 available2 as u16,
>> 51:12 pfn as u64,
>> 11:9 available as u8,
>> 1:1 writable as bool,
>> 0:0 present as bool,
>> }
>>
>> This is also what would be my preferred style for the kernel in general.
>
> Sorry for the confusion. The discussion was whether to keep using the
> `H:L` syntax of the current macro, or use Rust's inclusive ranges syntax
> (i.e. `L..=H`), as the `genmask_*` macros currently do.
>
The H:L (for example "11:9 available as u8", above) is elegant and readable.
The Rust native syntax "L..=H", much less so.
For this part of the kernel, dealing specifically with bits, feel pretty
strongly that we should go with "H:L".
thanks,
--
John Hubbard
Powered by blists - more mailing lists