[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240821.001419.119790971277689020.fujita.tomonori@gmail.com>
Date: Wed, 21 Aug 2024 00:14:19 +0000 (UTC)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: gregkh@...uxfoundation.org
Cc: fujita.tomonori@...il.com, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, andrew@...n.ch, tmgross@...ch.edu,
miguel.ojeda.sandonis@...il.com, benno.lossin@...ton.me,
aliceryhl@...gle.com
Subject: Re: [PATCH net-next v6 1/6] rust: sizes: add commonly used
constants
On Wed, 21 Aug 2024 07:41:24 +0800
Greg KH <gregkh@...uxfoundation.org> wrote:
>> +/// 0x00000400
>> +pub const SZ_1K: usize = bindings::SZ_1K as usize;
>> +/// 0x00000800
>> +pub const SZ_2K: usize = bindings::SZ_2K as usize;
>> +/// 0x00001000
>> +pub const SZ_4K: usize = bindings::SZ_4K as usize;
>> +/// 0x00002000
>> +pub const SZ_8K: usize = bindings::SZ_8K as usize;
>> +/// 0x00004000
>> +pub const SZ_16K: usize = bindings::SZ_16K as usize;
>> +/// 0x00008000
>> +pub const SZ_32K: usize = bindings::SZ_32K as usize;
>> +/// 0x00010000
>> +pub const SZ_64K: usize = bindings::SZ_64K as usize;
>> +/// 0x00020000
>> +pub const SZ_128K: usize = bindings::SZ_128K as usize;
>> +/// 0x00040000
>> +pub const SZ_256K: usize = bindings::SZ_256K as usize;
>> +/// 0x00080000
>> +pub const SZ_512K: usize = bindings::SZ_512K as usize;
>
> Why only some of the values in sizes.h?
Because this driver needs only some SZ_*K and looks like SZ_*K are
more widely used. But we can add more anytime.
> And why can't sizes.h be directly translated into rust code without
> having to do it "by hand" here? We do that for other header file
> bindings, right?
No. bindings::* are generated from C headers and kernel crates
give them to drivers by hand. For example, rust/kernel/page.rs has:
pub const PAGE_SIZE: usize = bindings::PAGE_SIZE;
Powered by blists - more mailing lists