summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>2004-12-27 19:57:10 -0200
committerDavid S. Miller <davem@nuts.davemloft.net>2004-12-27 19:57:10 -0200
commit018b2fb54b77b14ed667844fded529f371de7f81 (patch)
tree9e6c6170d303a28e49cb6832b2c71a87d50d734d /include/linux
parent463f7d6a320c2af5721f73e048458e249dcccb2b (diff)
[INET] move inet_sock into inet_opt and rename it to inet_sock
With this we can remove all the cut'n'pasted layouts in all inet_sock derived classes, such as tcp_sock, udp_sock, sctp_sock, etc. Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ip.h24
-rw-r--r--include/linux/ipv6.h14
-rw-r--r--include/linux/tcp.h6
-rw-r--r--include/linux/udp.h6
4 files changed, 16 insertions, 34 deletions
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 12d504ef8df0..3fe93474047d 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -107,7 +107,14 @@ struct ip_options {
#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
-struct inet_opt {
+struct ipv6_pinfo;
+
+struct inet_sock {
+ /* sk and pinet6 has to be the first two members of inet_sock */
+ struct sock sk;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+ struct ipv6_pinfo *pinet6;
+#endif
/* Socket demultiplex comparisons on incoming packets. */
__u32 daddr; /* Foreign IPv4 addr */
__u32 rcv_saddr; /* Bound local IPv4 addr */
@@ -146,20 +153,9 @@ struct inet_opt {
#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
-struct ipv6_pinfo;
-
-/* WARNING: don't change the layout of the members in inet_sock! */
-struct inet_sock {
- struct sock sk;
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- struct ipv6_pinfo *pinet6;
-#endif
- struct inet_opt inet;
-};
-
-static inline struct inet_opt * inet_sk(const struct sock *__sk)
+static inline struct inet_sock *inet_sk(const struct sock *sk)
{
- return &((struct inet_sock *)__sk)->inet;
+ return (struct inet_sock *)sk;
}
#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index d7d1673880d5..d7c28b9db4fd 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -256,32 +256,26 @@ struct raw6_opt {
/* WARNING: don't change the layout of the members in {raw,udp,tcp}6_sock! */
struct raw6_sock {
- struct sock sk;
- struct ipv6_pinfo *pinet6;
- struct inet_opt inet;
+ struct inet_sock inet;
struct raw6_opt raw6;
struct ipv6_pinfo inet6;
};
struct udp6_sock {
- struct sock sk;
- struct ipv6_pinfo *pinet6;
- struct inet_opt inet;
+ struct inet_sock inet;
struct udp_opt udp;
struct ipv6_pinfo inet6;
};
struct tcp6_sock {
- struct sock sk;
- struct ipv6_pinfo *pinet6;
- struct inet_opt inet;
+ struct inet_sock inet;
struct tcp_opt tcp;
struct ipv6_pinfo inet6;
};
static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
{
- return ((struct raw6_sock *)__sk)->pinet6;
+ return inet_sk(__sk)->pinet6;
}
static inline struct raw6_opt * raw6_sk(const struct sock *__sk)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0902b9f496c3..61de59d3cef4 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -440,11 +440,7 @@ struct tcp_opt {
/* WARNING: don't change the layout of the members in tcp_sock! */
struct tcp_sock {
- struct sock sk;
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- struct ipv6_pinfo *pinet6;
-#endif
- struct inet_opt inet;
+ struct inet_sock inet;
struct tcp_opt tcp;
};
diff --git a/include/linux/udp.h b/include/linux/udp.h
index facf661dd65a..831a3f532a10 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -53,11 +53,7 @@ struct udp_opt {
/* WARNING: don't change the layout of the members in udp_sock! */
struct udp_sock {
- struct sock sk;
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- struct ipv6_pinfo *pinet6;
-#endif
- struct inet_opt inet;
+ struct inet_sock inet;
struct udp_opt udp;
};