diff options
| author | David S. Miller <davem@davemloft.net> | 2023-03-18 12:23:48 +0000 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2023-03-18 12:23:48 +0000 |
| commit | df28e8690e7126fa5c99e8863c27574204589f31 (patch) | |
| tree | fd943e26281cfd7a7e0948d1949d6e0009c19510 /include/net/raw.h | |
| parent | 39a86d059a78bf29b66dd8bbeab04af1d55c02ba (diff) | |
| parent | e9d9da91548b21e189fcd0259a0f2d26d1afc509 (diff) | |
Merge branch 'net-better-const'
Eric Dumazet says:
====================
net: better const qualifier awareness
This is a follow-up of d27d367d3b78 ("inet: better const qualifier awareness")
Adopting container_of_const() to perform (struct sock *)->(protocol sock *)
operation is allowing us to propagate const qualifier and thus detect
misuses at compile time.
Most conversions are trivial, because most protocols did not adopt yet
const sk pointers where it could make sense.
Only mptcp and tcp patches (end of this series) are requiring small
adjustments.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/raw.h')
| -rw-r--r-- | include/net/raw.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/include/net/raw.h b/include/net/raw.h index 7ad15830cf38..c215af02f758 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) |
