[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230315142841.3a2ac99a@kernel.org>
Date: Wed, 15 Mar 2023 14:28:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
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, 15 Mar 2023 15:42:38 +0000 Eric Dumazet wrote:
> -static inline struct inet_sock *inet_sk(const struct sock *sk)
> -{
> - return (struct inet_sock *)sk;
> -}
> +#define inet_sk(sk) \
> + _Generic(sk, \
> + const struct sock * : ((const struct inet_sock *)(sk)), \
> + struct sock * : ((struct inet_sock *)(sk)) \
> + )
Could we possibly use container_of_const() or define a new common
macro for this downcast? I'm worried it will spread and it's a bit
verbose.
(I think Greg is constifying things too so let me add him and Linus.)
Powered by blists - more mailing lists