[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+8fCgDZ40S+uawyr0Y+Hhq=rDRULkmo+6neFqozWUZZQ@mail.gmail.com>
Date: Wed, 15 Mar 2023 16:16:11 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org,
eric.dumazet@...il.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH net-next 1/8] inet: preserve const qualifier in inet_sk()
On Wed, Mar 15, 2023 at 4:08 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Wed, 15 Mar 2023 15:37:50 -0700 Eric Dumazet wrote:
> > I did see container_of_const() but the default: case was not appealing to me.
> >
> > Maybe something like this?
> >
> > diff --git a/include/linux/container_of.h b/include/linux/container_of.h
> > index 713890c867bea78804defe1a015e3c362f40f85d..9a24d8db1f4c46166c07589bb084eda9b9ede8ba
> > 100644
> > --- a/include/linux/container_of.h
> > +++ b/include/linux/container_of.h
> > @@ -35,4 +35,10 @@
> > default: ((type *)container_of(ptr, type, member)) \
> > )
> >
> > +#define promote_to_type(ptr, oldtype, newtype) \
> > + _Generic(ptr, \
> > + const oldtype *: ((const newtype *)(ptr)), \
> > + oldtype *: ((newtype *)(ptr)) \
> > + )
>
> Perfect, I'll defer to you on whether you want to patch it on top
> or repost the series.
I'll post a v2 tomorrow, thank you.
Powered by blists - more mailing lists