]> git.neil.brown.name Git - history.git/commitdiff
[NET]: Do type checking in {udp,inet6,raw6,inet}_sk().
authorIngo Molnar <mingo@elte.hu>
Thu, 1 Jan 2004 04:28:44 +0000 (20:28 -0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 1 Jan 2004 04:28:44 +0000 (20:28 -0800)
include/linux/ip.h
include/linux/ipv6.h
include/linux/udp.h

index 1adc75a76926a2e717ee7634b4bc07054a60a6b1..ab799b48b4851ac01fdf48a88d64984b669f5799 100644 (file)
@@ -159,7 +159,10 @@ struct inet_sock {
        struct inet_opt   inet;
 };
 
-#define inet_sk(__sk) (&((struct inet_sock *)__sk)->inet)
+static inline struct inet_opt * inet_sk(const struct sock *__sk)
+{
+       return &((struct inet_sock *)__sk)->inet;
+}
 
 #endif
 
index da2e64899c9574e04f67e65df58255352feaa05b..7f5a5c4280f75452a2802728d2e4dd2fd60cf460 100644 (file)
@@ -270,8 +270,15 @@ struct tcp6_sock {
        struct ipv6_pinfo inet6;
 };
 
-#define inet6_sk(__sk) ((struct raw6_sock *)__sk)->pinet6
-#define raw6_sk(__sk) (&((struct raw6_sock *)__sk)->raw6)
+static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
+{
+       return ((struct raw6_sock *)__sk)->pinet6;
+}
+
+static inline struct raw6_opt * raw6_sk(const struct sock *__sk)
+{
+       return &((struct raw6_sock *)__sk)->raw6;
+}
 
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 #define __ipv6_only_sock(sk)   (inet6_sk(sk)->ipv6only)
index 492b258c76c84e8fc9e674f7db87b47c0ca793e2..cecbccdc1835d436b2b9b86adceb7eb31ef42282 100644 (file)
@@ -60,7 +60,10 @@ struct udp_sock {
        struct udp_opt    udp;
 };
 
-#define udp_sk(__sk) (&((struct udp_sock *)__sk)->udp)
+static inline struct udp_opt * udp_sk(const struct sock *__sk)
+{
+       return &((struct udp_sock *)__sk)->udp;
+}
 
 #endif