From: Wei Liu <wei.liu@kernel.org>
To: Wedson Almeida Filho <wedsonaf@gmail.com>
Cc: "Wei Liu" <wei.liu@kernel.org>,
rust-for-linux@vger.kernel.org,
"Linux Kernel List" <linux-kernel@vger.kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>
Subject: Re: [PATCH] rust: kernel: drop repetition in offset_of macro
Date: Fri, 16 Dec 2022 23:15:11 +0000 [thread overview]
Message-ID: <Y5z7/9OVzZd1ols1@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <CANeycqo2qKUnyh6XVkBHyAcVjvN9NKJ9sb9bTzkHq7jC1C-B0w@mail.gmail.com>
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@kernel.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@kernel.org>
> > ---
> > Cc: Miguel Ojeda <ojeda@kernel.org>
> > Cc: Alex Gaynor <alex.gaynor@gmail.com>
> > Cc: Wedson Almeida Filho <wedsonaf@gmail.com>
> > Cc: Boqun Feng <boqun.feng@gmail.com>
> > Cc: Gary Guo <gary@garyguo.net>
> > Cc: Björn Roy Baron <bjorn3_gh@protonmail.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.
prev parent reply other threads:[~2022-12-16 23:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 17:49 [PATCH] rust: kernel: drop repetition in offset_of macro Wei Liu
2022-12-16 18:26 ` Wedson Almeida Filho
2022-12-16 22:15 ` Boqun Feng
2022-12-16 23:30 ` Wei Liu
2022-12-16 23:57 ` Miguel Ojeda
2022-12-16 23:08 ` Wei Liu
2022-12-16 23:15 ` Wei Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y5z7/9OVzZd1ols1@liuwe-devbox-debian-v2 \
--to=wei.liu@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).