From: Ben Hutchings <ben@decadent.org.uk>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
Date: Thu, 25 Aug 2011 05:44:15 +0100 [thread overview]
Message-ID: <1314247456.27179.122.camel@deadeye> (raw)
In-Reply-To: <1314247131.27179.116.camel@deadeye>
[-- Attachment #1: Type: text/plain, Size: 3210 bytes --]
Commit 9c501935a3cdcf6b1d35aaee3aa11c7a7051a305 ('net: Support
inclusion of <linux/socket.h> before <sys/socket.h>') removed the
definition of struct sockaddr for userland.
But we still have several headers using struct sockaddr, and we
shouldn't make them include <sys/socket.h> as that risks recursive
inclusion in future. Define and use an identical struct
__kernel_sockaddr instead.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
include/linux/if.h | 12 ++++++------
include/linux/phonet.h | 3 ++-
include/linux/socket.h | 17 +++++++++--------
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/include/linux/if.h b/include/linux/if.h
index db20bd4..f9ce5fb 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -20,7 +20,7 @@
#define _LINUX_IF_H
#include <linux/types.h> /* for "__kernel_caddr_t" et al */
-#include <linux/socket.h> /* for "struct sockaddr" et al */
+#include <linux/socket.h> /* for "struct __kernel_sockaddr" et al */
#include <linux/compiler.h> /* for "__user" et al */
#define IFNAMSIZ 16
@@ -176,11 +176,11 @@ struct ifreq {
} ifr_ifrn;
union {
- struct sockaddr ifru_addr;
- struct sockaddr ifru_dstaddr;
- struct sockaddr ifru_broadaddr;
- struct sockaddr ifru_netmask;
- struct sockaddr ifru_hwaddr;
+ struct __kernel_sockaddr ifru_addr;
+ struct __kernel_sockaddr ifru_dstaddr;
+ struct __kernel_sockaddr ifru_broadaddr;
+ struct __kernel_sockaddr ifru_netmask;
+ struct __kernel_sockaddr ifru_hwaddr;
short ifru_flags;
int ifru_ivalue;
int ifru_mtu;
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index f53a416..9aba9ce 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -101,7 +101,8 @@ struct sockaddr_pn {
__u8 spn_obj;
__u8 spn_dev;
__u8 spn_resource;
- __u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
+ __u8 spn_zero[sizeof(struct __kernel_sockaddr) -
+ sizeof(__kernel_sa_family_t) - 3];
} __attribute__((packed));
/* Well known address */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index d0e77f6..f13ad7b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -10,6 +10,14 @@
typedef unsigned short __kernel_sa_family_t;
+/*
+ * 1003.1g requires sa_family_t and that sa_data is char.
+ */
+struct __kernel_sockaddr {
+ __kernel_sa_family_t sa_family; /* address family, AF_xxx */
+ char sa_data[14]; /* 14 bytes of protocol address */
+};
+
struct __kernel_sockaddr_storage {
__kernel_sa_family_t ss_family; /* address family */
/* Following field(s) are implementation specific */
@@ -39,15 +47,8 @@ extern void socket_seq_show(struct seq_file *seq);
typedef __kernel_sa_family_t sa_family_t;
-/*
- * 1003.1g requires sa_family_t and that sa_data is char.
- */
+#define sockaddr __kernel_sockaddr
-struct sockaddr {
- sa_family_t sa_family; /* address family, AF_xxx */
- char sa_data[14]; /* 14 bytes of protocol address */
-};
-
struct linger {
int l_onoff; /* Linger active */
int l_linger; /* How long to linger for */
--
1.7.5.4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2011-08-25 4:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 4:38 [PATCH net-next v2 00/10] Fix net header dependencies Ben Hutchings
2011-08-25 4:40 ` [PATCH net-next v2 01/10] headers, pppox: Add missing #include to <linux/if_pppox.h> Ben Hutchings
2011-08-25 4:43 ` [PATCH net-next v2 02/10] headers, ax25: Add missing #include to <linux/netrom.h>, <linux/rose.h> Ben Hutchings
2011-08-25 4:43 ` [PATCH net-next v2 03/10] headers, pppol2tp: Use __kernel_pid_t in <linux/pppol2tp.h> Ben Hutchings
2011-08-25 4:43 ` [PATCH net-next v2 04/10] headers, net: Use __kernel_sa_family_t in more definitions shared with userland Ben Hutchings
2011-08-25 4:44 ` Ben Hutchings [this message]
2011-08-26 15:08 ` [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr David Miller
2011-08-26 15:42 ` Ben Hutchings
2011-08-26 16:04 ` David Miller
2011-08-26 16:20 ` David Miller
2011-08-28 16:22 ` Ben Hutchings
2011-08-25 4:44 ` [PATCH net-next v2 06/10] headers, netfilter: Use kernel type names __u8, __u16, __u32 Ben Hutchings
2011-08-25 4:45 ` [PATCH net-next v2 07/10] headers, tipc: Add missing #include to <linux/tipc_config.h> for userland Ben Hutchings
2011-08-25 4:45 ` [PATCH net-next v2 08/10] headers, netfilter: Add missing #include <limits.h> " Ben Hutchings
2011-08-25 4:45 ` [PATCH net-next v2 09/10] headers, xtables: Add missing #include <linux/netfilter.h> Ben Hutchings
2011-08-25 4:46 ` [PATCH net-next v2 10/10] headers, can: Add missing #include to <linux/can/bcm.h> Ben Hutchings
2011-08-26 16:09 ` [PATCH net-next v2 00/10] Fix net header dependencies David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314247456.27179.122.camel@deadeye \
--to=ben@decadent.org.uk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).