[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5z7/9OVzZd1ols1@liuwe-devbox-debian-v2>
Date: Fri, 16 Dec 2022 23:15:11 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Wedson Almeida Filho <wedsonaf@...il.com>
Cc: Wei Liu <wei.liu@...nel.org>, rust-for-linux@...r.kernel.org,
Linux Kernel List <linux-kernel@...r.kernel.org>,
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>
Subject: Re: [PATCH] rust: kernel: drop repetition in offset_of macro
On Fri, Dec 16, 2022 at 06:26:57PM +0000, Wedson Almeida Filho wrote:
> On Fri, 16 Dec 2022 at 17:49, Wei Liu <wei.liu@...nel.org> wrote:
> >
> > It doesn't make sense to allow multiple fields to be specified in
> > offset_of.
>
> Why do you say it doesn't make sense?
>
> Here's what I had in mind:
> ```
> struct Y {
> z: u32
> }
> struct X {
> y: Y
> }
> offset_of!(X, y.z)
> ```
>
> Which is something very plausible.
>
> > No functional change.
> >
> > Signed-off-by: Wei Liu <wei.liu@...nel.org>
> > ---
> > Cc: Miguel Ojeda <ojeda@...nel.org>
> > Cc: Alex Gaynor <alex.gaynor@...il.com>
> > Cc: Wedson Almeida Filho <wedsonaf@...il.com>
> > Cc: Boqun Feng <boqun.feng@...il.com>
> > Cc: Gary Guo <gary@...yguo.net>
> > Cc: Björn Roy Baron <bjorn3_gh@...tonmail.com>
> > ---
> > rust/kernel/lib.rs | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
> > index 6a322effa60c..2f3601e4e27e 100644
> > --- a/rust/kernel/lib.rs
> > +++ b/rust/kernel/lib.rs
> > @@ -208,7 +208,7 @@ impl<'a> Drop for KParamGuard<'a> {
> > /// ```
> > #[macro_export]
> > macro_rules! offset_of {
> > - ($type:ty, $($f:tt)*) => {{
Shouldn't this be + instead of *?
offset_of!(X,) is valid according to this pattern.
Thanks,
Wei.
Powered by blists - more mailing lists