[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230317155539.2552954-4-edumazet@google.com>
Date: Fri, 17 Mar 2023 15:55:32 +0000
From: Eric Dumazet <edumazet@...gle.com>
To: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, David Ahern <dsahern@...nel.org>,
Simon Horman <simon.horman@...igine.com>,
Willem de Bruijn <willemb@...gle.com>,
Matthieu Baerts <matthieu.baerts@...sares.net>,
eric.dumazet@...il.com, Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH net-next 03/10] raw: preserve const qualifier in raw_sk()
We can change raw_sk() to propagate const qualifier of its argument,
thanks to container_of_const()
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
include/net/raw.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/include/net/raw.h b/include/net/raw.h
index 7ad15830cf38460f1fae3a187986d74faef6dd1d..c215af02f7589ee5e77a7c3f89cb216fab638c4c 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -83,10 +83,7 @@ struct raw_sock {
u32 ipmr_table;
};
-static inline struct raw_sock *raw_sk(const struct sock *sk)
-{
- return (struct raw_sock *)sk;
-}
+#define raw_sk(ptr) container_of_const(ptr, struct raw_sock, inet.sk)
static inline bool raw_sk_bound_dev_eq(struct net *net, int bound_dev_if,
int dif, int sdif)
--
2.40.0.rc2.332.ga46443480c-goog
Powered by blists - more mailing lists