Skip to content

Commit

Permalink
af_unix: Convert the unix_sk macro to an inline function for type safety
Browse files Browse the repository at this point in the history
As suggested by Eric Dumazet this change replaces the
#define with a static inline function to enjoy
complaints by the compiler when misusing the API.

Signed-off-by: Aaron Conole <aconole@bytheb.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Aaron Conole authored and David S. Miller committed Sep 29, 2015
1 parent 2103d6b commit 4613012
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/net/af_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ struct unix_sock {
#define UNIX_GC_MAYBE_CYCLE 1
struct socket_wq peer_wq;
};
#define unix_sk(__sk) ((struct unix_sock *)__sk)

static inline struct unix_sock *unix_sk(struct sock *sk)
{
return (struct unix_sock *)sk;
}

#define peer_wait peer_wq.wait

Expand Down

0 comments on commit 4613012

Please sign in to comment.