public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Zack Weinberg <zack@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/zack/no-nested-includes] Minimize includes by networking headers 3/3: netinet
Date: Wed, 05 Jun 2019 12:25:00 -0000	[thread overview]
Message-ID: <20190605122510.18387.qmail@sourceware.org> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 33596 bytes --]

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b3599a0c82457e9c2278b1c6fc8926bf819e034d

commit b3599a0c82457e9c2278b1c6fc8926bf819e034d
Author: Zack Weinberg <zackw@panix.com>
Date:   Mon Jun 3 10:59:30 2019 -0400

    Minimize includes by networking headers 3/3: netinet
    
    Much the same as the other two, except for two things: the only copies
    of ip_icmp.h and udp.h in the source tree are moved from sysdeps/gnu
    to inet (after which there are no longer any netinet/ headers in
    sysdeps/gnu), and much as sys/un.h needs to duplicate the prototype
    for strlen, netinet/icmp6.h needs to duplicate the prototype for
    memset.  I am open to better ideas on that front.
    
    Many netinet/*.h headers continue to include netinet/in.h even if they do
    not technically need to.  I suspect removing it would cause more trouble
    than it’s worth.
    
    	* inet/netinet/icmp6.h: Include features.h, bits/endian.h,
    	bits/types.h, and bits/types/size_t.h.  Don’t include inttypes.h,
    	string.h, or sys/types.h.  Duplicate prototype of memset here.
    	Use __uintN_t instead of uintN_t types.
    	* inet/netinet/igmp.h: Include bits/types.h.  Don’t include sys/types.h.
    	Use __uintN_t instead of uintN_t types.
    	* inet/netinet/ip.h: Include bits/types.h.  Don’t include
    	bits/stdint-uintn.h.  Use __uintN_t instead of uintN_t types.
    	* inet/netinet/ip6.h: Include features.h, bits/endian.h, and
    	bits/types.h.  Don’t include inttypes.h.  Use __uintN_t instead of
    	uintN_t types.
    
    	* inet/netinet/ip_icmp.h: Include features.h and bits/types.h.
    	Don’t include sys/types.h or stdint.h.  Use __uintN_t instead of
    	uintN_t types.
    	* inet/netinet/udp.h: Likewise.
    	* sysdeps/generic/netinet/if_ether.h: Likewise.
    	* sysdeps/unix/sysv/linux/netinet/if_ether.h: Likewise.
    	* sysdeps/unix/sysv/linux/netinet/if_fddi.h: Likewise.
    	* sysdeps/unix/sysv/linux/netinet/if_tr.h: Likewise.
    
    	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
    	Update.
    
    	* sysdeps/gnu/netinet/ip_icmp.h: Move to inet/netinet/ip_icmp.h.
    	* sysdeps/gnu/netinet/udp.h: Move to inet/netinet/udp.h.
    	* include/netinet/ip_icmp.h, include/netinet/udp.h: New wrappers.
    	* sysdeps/gnu/Makefile: Remove $(subdir)==inet stanza.
    	* inet/Makefile (headers): Add netinet/ip_icmp.h and
    	netinet/udp.h. Don’t use $(wildcard *.h) for arpa and protocols
    	headers.  Sort list.

Diff:
---
 include/netinet/ip_icmp.h                  |   1 +
 include/netinet/udp.h                      |   1 +
 inet/Makefile                              |  11 ++-
 inet/netinet/icmp6.h                       | 123 +++++++++++++++--------------
 inet/netinet/igmp.h                        |   9 +--
 inet/netinet/ip.h                          |  40 +++++-----
 inet/netinet/ip6.h                         |  86 ++++++++++----------
 {sysdeps/gnu => inet}/netinet/ip_icmp.h    |  56 ++++++-------
 {sysdeps/gnu => inet}/netinet/udp.h        |  20 ++---
 scripts/check-obsolete-constructs.py       |  16 ++--
 sysdeps/generic/netinet/if_ether.h         |   6 +-
 sysdeps/gnu/Makefile                       |   5 --
 sysdeps/unix/sysv/linux/netinet/if_ether.h |   7 +-
 sysdeps/unix/sysv/linux/netinet/if_fddi.h  |  14 ++--
 sysdeps/unix/sysv/linux/netinet/if_tr.h    |  68 ++++++++--------
 15 files changed, 230 insertions(+), 233 deletions(-)

diff --git a/include/netinet/ip_icmp.h b/include/netinet/ip_icmp.h
new file mode 100644
index 0000000..f8d0080
--- /dev/null
+++ b/include/netinet/ip_icmp.h
@@ -0,0 +1 @@
+#include <inet/netinet/ip_icmp.h>
diff --git a/include/netinet/udp.h b/include/netinet/udp.h
new file mode 100644
index 0000000..c45cb0b
--- /dev/null
+++ b/include/netinet/udp.h
@@ -0,0 +1 @@
+#include <inet/netinet/udp.h>
diff --git a/inet/Makefile b/inet/Makefile
index e237103..a58278a 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -22,10 +22,13 @@ subdir	:= inet
 
 include ../Makeconfig
 
-headers	:= netinet/ether.h netinet/in.h netinet/in_systm.h \
-	   netinet/if_ether.h netinet/igmp.h \
-	   netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
-	   aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h
+headers	:= aliases.h ifaddrs.h bits/in.h				     \
+           netinet/ether.h netinet/icmp6.h netinet/if_ether.h netinet/igmp.h \
+           netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h	     \
+	   netinet/ip_icmp.h netinet/tcp.h netinet/udp.h		     \
+	   arpa/ftp.h arpa/inet.h arpa/telnet.h arpa/tftp.h		     \
+           protocols/routed.h protocols/rwhod.h protocols/talkd.h	     \
+	   protocols/timed.h
 
 routines := htonl htons		\
 	    inet_lnaof inet_mkadr	\
diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h
index 92e84cf..5119085 100644
--- a/inet/netinet/icmp6.h
+++ b/inet/netinet/icmp6.h
@@ -18,9 +18,10 @@
 #ifndef _NETINET_ICMP6_H
 #define _NETINET_ICMP6_H 1
 
-#include <inttypes.h>
-#include <string.h>
-#include <sys/types.h>
+#include <features.h>
+#include <bits/endian.h>
+#include <bits/types.h>
+#include <bits/types/size_t.h>
 #include <netinet/in.h>
 
 #define ICMP6_FILTER 1
@@ -32,19 +33,19 @@
 
 struct icmp6_filter
   {
-    uint32_t icmp6_filt[8];
+    __uint32_t icmp6_filt[8];
   };
 
 struct icmp6_hdr
   {
-    uint8_t     icmp6_type;   /* type field */
-    uint8_t     icmp6_code;   /* code field */
-    uint16_t    icmp6_cksum;  /* checksum field */
+    __uint8_t     icmp6_type;   /* type field */
+    __uint8_t     icmp6_code;   /* code field */
+    __uint16_t    icmp6_cksum;  /* checksum field */
     union
       {
-	uint32_t  icmp6_un_data32[1]; /* type-specific field */
-	uint16_t  icmp6_un_data16[2]; /* type-specific field */
-	uint8_t   icmp6_un_data8[4];  /* type-specific field */
+	__uint32_t  icmp6_un_data32[1]; /* type-specific field */
+	__uint16_t  icmp6_un_data16[2]; /* type-specific field */
+	__uint8_t   icmp6_un_data8[4];  /* type-specific field */
       } icmp6_dataun;
   };
 
@@ -96,6 +97,8 @@ struct icmp6_hdr
 #define ICMP6_FILTER_SETBLOCK(type, filterp) \
 	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
 
+extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
+
 #define ICMP6_FILTER_SETPASSALL(filterp) \
 	memset (filterp, 0, sizeof (struct icmp6_filter));
 
@@ -122,8 +125,8 @@ struct nd_router_solicit      /* router solicitation */
 struct nd_router_advert       /* router advertisement */
   {
     struct icmp6_hdr  nd_ra_hdr;
-    uint32_t   nd_ra_reachable;   /* reachable time */
-    uint32_t   nd_ra_retransmit;  /* retransmit timer */
+    __uint32_t   nd_ra_reachable;   /* reachable time */
+    __uint32_t   nd_ra_retransmit;  /* retransmit timer */
     /* could be followed by options */
   };
 
@@ -185,8 +188,8 @@ struct nd_redirect            /* redirect */
 
 struct nd_opt_hdr             /* Neighbor discovery option header */
   {
-    uint8_t  nd_opt_type;
-    uint8_t  nd_opt_len;        /* in units of 8 octets */
+    __uint8_t  nd_opt_type;
+    __uint8_t  nd_opt_len;        /* in units of 8 octets */
     /* followed by option specific data */
   };
 
@@ -200,13 +203,13 @@ struct nd_opt_hdr             /* Neighbor discovery option header */
 
 struct nd_opt_prefix_info     /* prefix information */
   {
-    uint8_t   nd_opt_pi_type;
-    uint8_t   nd_opt_pi_len;
-    uint8_t   nd_opt_pi_prefix_len;
-    uint8_t   nd_opt_pi_flags_reserved;
-    uint32_t  nd_opt_pi_valid_time;
-    uint32_t  nd_opt_pi_preferred_time;
-    uint32_t  nd_opt_pi_reserved2;
+    __uint8_t   nd_opt_pi_type;
+    __uint8_t   nd_opt_pi_len;
+    __uint8_t   nd_opt_pi_prefix_len;
+    __uint8_t   nd_opt_pi_flags_reserved;
+    __uint32_t  nd_opt_pi_valid_time;
+    __uint32_t  nd_opt_pi_preferred_time;
+    __uint32_t  nd_opt_pi_reserved2;
     struct in6_addr  nd_opt_pi_prefix;
   };
 
@@ -216,19 +219,19 @@ struct nd_opt_prefix_info     /* prefix information */
 
 struct nd_opt_rd_hdr          /* redirected header */
   {
-    uint8_t   nd_opt_rh_type;
-    uint8_t   nd_opt_rh_len;
-    uint16_t  nd_opt_rh_reserved1;
-    uint32_t  nd_opt_rh_reserved2;
+    __uint8_t   nd_opt_rh_type;
+    __uint8_t   nd_opt_rh_len;
+    __uint16_t  nd_opt_rh_reserved1;
+    __uint32_t  nd_opt_rh_reserved2;
     /* followed by IP header and data */
   };
 
 struct nd_opt_mtu             /* MTU option */
   {
-    uint8_t   nd_opt_mtu_type;
-    uint8_t   nd_opt_mtu_len;
-    uint16_t  nd_opt_mtu_reserved;
-    uint32_t  nd_opt_mtu_mtu;
+    __uint8_t   nd_opt_mtu_type;
+    __uint8_t   nd_opt_mtu_len;
+    __uint16_t  nd_opt_mtu_reserved;
+    __uint32_t  nd_opt_mtu_mtu;
   };
 
 struct mld_hdr
@@ -248,10 +251,10 @@ struct mld_hdr
 struct icmp6_router_renum    /* router renumbering header */
   {
     struct icmp6_hdr    rr_hdr;
-    uint8_t             rr_segnum;
-    uint8_t             rr_flags;
-    uint16_t            rr_maxdelay;
-    uint32_t            rr_reserved;
+    __uint8_t           rr_segnum;
+    __uint8_t           rr_flags;
+    __uint16_t          rr_maxdelay;
+    __uint32_t          rr_reserved;
   };
 
 #define rr_type		rr_hdr.icmp6_type
@@ -268,13 +271,13 @@ struct icmp6_router_renum    /* router renumbering header */
 
 struct rr_pco_match    /* match prefix part */
   {
-    uint8_t             rpm_code;
-    uint8_t             rpm_len;
-    uint8_t             rpm_ordinal;
-    uint8_t             rpm_matchlen;
-    uint8_t             rpm_minlen;
-    uint8_t             rpm_maxlen;
-    uint16_t            rpm_reserved;
+    __uint8_t           rpm_code;
+    __uint8_t           rpm_len;
+    __uint8_t           rpm_ordinal;
+    __uint8_t           rpm_matchlen;
+    __uint8_t           rpm_minlen;
+    __uint8_t           rpm_maxlen;
+    __uint16_t          rpm_reserved;
     struct in6_addr     rpm_prefix;
   };
 
@@ -285,13 +288,13 @@ struct rr_pco_match    /* match prefix part */
 
 struct rr_pco_use      /* use prefix part */
   {
-    uint8_t             rpu_uselen;
-    uint8_t             rpu_keeplen;
-    uint8_t             rpu_ramask;
-    uint8_t             rpu_raflags;
-    uint32_t            rpu_vltime;
-    uint32_t            rpu_pltime;
-    uint32_t            rpu_flags;
+    __uint8_t           rpu_uselen;
+    __uint8_t           rpu_keeplen;
+    __uint8_t           rpu_ramask;
+    __uint8_t           rpu_raflags;
+    __uint32_t          rpu_vltime;
+    __uint32_t          rpu_pltime;
+    __uint32_t          rpu_flags;
     struct in6_addr     rpu_prefix;
   };
 
@@ -308,10 +311,10 @@ struct rr_pco_use      /* use prefix part */
 
 struct rr_result       /* router renumbering result message */
   {
-    uint16_t            rrr_flags;
-    uint8_t             rrr_ordinal;
-    uint8_t             rrr_matchedlen;
-    uint32_t            rrr_ifid;
+    __uint16_t          rrr_flags;
+    __uint8_t           rrr_ordinal;
+    __uint8_t           rrr_matchedlen;
+    __uint32_t          rrr_ifid;
     struct in6_addr     rrr_prefix;
   };
 
@@ -326,20 +329,20 @@ struct rr_result       /* router renumbering result message */
 /* Mobile IPv6 extension: Advertisement Interval.  */
 struct nd_opt_adv_interval
   {
-    uint8_t   nd_opt_adv_interval_type;
-    uint8_t   nd_opt_adv_interval_len;
-    uint16_t  nd_opt_adv_interval_reserved;
-    uint32_t  nd_opt_adv_interval_ival;
+    __uint8_t   nd_opt_adv_interval_type;
+    __uint8_t   nd_opt_adv_interval_len;
+    __uint16_t  nd_opt_adv_interval_reserved;
+    __uint32_t  nd_opt_adv_interval_ival;
   };
 
 /* Mobile IPv6 extension: Home Agent Info.  */
 struct nd_opt_home_agent_info
   {
-    uint8_t   nd_opt_home_agent_info_type;
-    uint8_t   nd_opt_home_agent_info_len;
-    uint16_t  nd_opt_home_agent_info_reserved;
-    uint16_t  nd_opt_home_agent_info_preference;
-    uint16_t  nd_opt_home_agent_info_lifetime;
+    __uint8_t   nd_opt_home_agent_info_type;
+    __uint8_t   nd_opt_home_agent_info_len;
+    __uint16_t  nd_opt_home_agent_info_reserved;
+    __uint16_t  nd_opt_home_agent_info_preference;
+    __uint16_t  nd_opt_home_agent_info_lifetime;
   };
 
 #endif /* netinet/icmpv6.h */
diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h
index 2f5be95..9386d76 100644
--- a/inet/netinet/igmp.h
+++ b/inet/netinet/igmp.h
@@ -20,11 +20,10 @@
 
 #include <features.h>
 
-#include <sys/types.h>
-
 #ifdef __USE_MISC
 
 #include <netinet/in.h>
+#include <bits/types.h>
 
 __BEGIN_DECLS
 
@@ -65,9 +64,9 @@ __BEGIN_DECLS
  */
 
 struct igmp {
-  uint8_t igmp_type;             /* IGMP type */
-  uint8_t igmp_code;             /* routing code */
-  uint16_t igmp_cksum;           /* checksum */
+  __uint8_t igmp_type;           /* IGMP type */
+  __uint8_t igmp_code;           /* routing code */
+  __uint16_t igmp_cksum;         /* checksum */
   struct in_addr igmp_group;     /* group address */
 };
 
diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h
index 35f61d1..fa6b588 100644
--- a/inet/netinet/ip.h
+++ b/inet/netinet/ip.h
@@ -22,14 +22,14 @@
 
 #include <netinet/in.h>
 #include <bits/endian.h>
-#include <bits/stdint-uintn.h>
+#include <bits/types.h>
 
 __BEGIN_DECLS
 
 struct timestamp
   {
-    uint8_t len;
-    uint8_t ptr;
+    __uint8_t len;
+    __uint8_t ptr;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
     unsigned int flags:4;
     unsigned int overflow:4;
@@ -39,7 +39,7 @@ struct timestamp
 #else
 # error	"Please fix <bits/endian.h>"
 #endif
-    uint32_t data[9];
+    __uint32_t data[9];
   };
 
 struct iphdr
@@ -53,15 +53,15 @@ struct iphdr
 #else
 # error	"Please fix <bits/endian.h>"
 #endif
-    uint8_t tos;
-    uint16_t tot_len;
-    uint16_t id;
-    uint16_t frag_off;
-    uint8_t ttl;
-    uint8_t protocol;
-    uint16_t check;
-    uint32_t saddr;
-    uint32_t daddr;
+    __uint8_t tos;
+    __uint16_t tot_len;
+    __uint16_t id;
+    __uint16_t frag_off;
+    __uint8_t ttl;
+    __uint8_t protocol;
+    __uint16_t check;
+    __uint32_t saddr;
+    __uint32_t daddr;
     /*The options start here. */
   };
 
@@ -115,7 +115,7 @@ struct ip
     unsigned int ip_v:4;		/* version */
     unsigned int ip_hl:4;		/* header length */
 #endif
-    uint8_t ip_tos;			/* type of service */
+    __uint8_t ip_tos;			/* type of service */
     unsigned short ip_len;		/* total length */
     unsigned short ip_id;		/* identification */
     unsigned short ip_off;		/* fragment offset field */
@@ -123,8 +123,8 @@ struct ip
 #define	IP_DF 0x4000			/* dont fragment flag */
 #define	IP_MF 0x2000			/* more fragments flag */
 #define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
-    uint8_t ip_ttl;			/* time to live */
-    uint8_t ip_p;			/* protocol */
+    __uint8_t ip_ttl;			/* time to live */
+    __uint8_t ip_p;			/* protocol */
     unsigned short ip_sum;		/* checksum */
     struct in_addr ip_src, ip_dst;	/* source and dest address */
   };
@@ -134,9 +134,9 @@ struct ip
  */
 struct ip_timestamp
   {
-    uint8_t ipt_code;			/* IPOPT_TS */
-    uint8_t ipt_len;			/* size of structure (variable) */
-    uint8_t ipt_ptr;			/* index of current entry */
+    __uint8_t ipt_code;			/* IPOPT_TS */
+    __uint8_t ipt_len;			/* size of structure (variable) */
+    __uint8_t ipt_ptr;			/* index of current entry */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
     unsigned int ipt_flg:4;		/* flags, see below */
     unsigned int ipt_oflw:4;		/* overflow counter */
@@ -145,7 +145,7 @@ struct ip_timestamp
     unsigned int ipt_oflw:4;		/* overflow counter */
     unsigned int ipt_flg:4;		/* flags, see below */
 #endif
-    uint32_t data[9];
+    __uint32_t data[9];
   };
 #endif /* __USE_MISC */
 
diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h
index 157a27d..e2a8d2b 100644
--- a/inet/netinet/ip6.h
+++ b/inet/netinet/ip6.h
@@ -18,8 +18,10 @@
 #ifndef _NETINET_IP6_H
 #define _NETINET_IP6_H 1
 
-#include <inttypes.h>
+#include <features.h>
 #include <netinet/in.h>
+#include <bits/endian.h>
+#include <bits/types.h>
 
 struct ip6_hdr
   {
@@ -27,13 +29,13 @@ struct ip6_hdr
       {
 	struct ip6_hdrctl
 	  {
-	    uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
-					20 bits flow-ID */
-	    uint16_t ip6_un1_plen;   /* payload length */
-	    uint8_t  ip6_un1_nxt;    /* next header */
-	    uint8_t  ip6_un1_hlim;   /* hop limit */
+	    __uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
+					  20 bits flow-ID */
+	    __uint16_t ip6_un1_plen;   /* payload length */
+	    __uint8_t  ip6_un1_nxt;    /* next header */
+	    __uint8_t  ip6_un1_hlim;   /* hop limit */
 	  } ip6_un1;
-	uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
+	__uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
       } ip6_ctlun;
     struct in6_addr ip6_src;      /* source address */
     struct in6_addr ip6_dst;      /* destination address */
@@ -49,45 +51,45 @@ struct ip6_hdr
 /* Generic extension header.  */
 struct ip6_ext
   {
-    uint8_t  ip6e_nxt;		/* next header.  */
-    uint8_t  ip6e_len;		/* length in units of 8 octets.  */
+    __uint8_t  ip6e_nxt;	/* next header.  */
+    __uint8_t  ip6e_len;	/* length in units of 8 octets.  */
   };
 
 /* Hop-by-Hop options header.  */
 struct ip6_hbh
   {
-    uint8_t  ip6h_nxt;		/* next header.  */
-    uint8_t  ip6h_len;		/* length in units of 8 octets.  */
+    __uint8_t  ip6h_nxt;	/* next header.  */
+    __uint8_t  ip6h_len;	/* length in units of 8 octets.  */
     /* followed by options */
   };
 
 /* Destination options header */
 struct ip6_dest
   {
-    uint8_t  ip6d_nxt;		/* next header */
-    uint8_t  ip6d_len;		/* length in units of 8 octets */
+    __uint8_t  ip6d_nxt;	/* next header */
+    __uint8_t  ip6d_len;	/* length in units of 8 octets */
     /* followed by options */
   };
 
 /* Routing header */
 struct ip6_rthdr
   {
-    uint8_t  ip6r_nxt;		/* next header */
-    uint8_t  ip6r_len;		/* length in units of 8 octets */
-    uint8_t  ip6r_type;		/* routing type */
-    uint8_t  ip6r_segleft;	/* segments left */
+    __uint8_t  ip6r_nxt;	/* next header */
+    __uint8_t  ip6r_len;	/* length in units of 8 octets */
+    __uint8_t  ip6r_type;	/* routing type */
+    __uint8_t  ip6r_segleft;	/* segments left */
     /* followed by routing type specific data */
   };
 
 /* Type 0 Routing header */
 struct ip6_rthdr0
   {
-    uint8_t  ip6r0_nxt;		/* next header */
-    uint8_t  ip6r0_len;		/* length in units of 8 octets */
-    uint8_t  ip6r0_type;	/* always zero */
-    uint8_t  ip6r0_segleft;	/* segments left */
-    uint8_t  ip6r0_reserved;	/* reserved field */
-    uint8_t  ip6r0_slmap[3];	/* strict/loose bit map */
+    __uint8_t  ip6r0_nxt;	/* next header */
+    __uint8_t  ip6r0_len;	/* length in units of 8 octets */
+    __uint8_t  ip6r0_type;	/* always zero */
+    __uint8_t  ip6r0_segleft;	/* segments left */
+    __uint8_t  ip6r0_reserved;	/* reserved field */
+    __uint8_t  ip6r0_slmap[3];	/* strict/loose bit map */
     /* followed by up to 127 struct in6_addr */
     struct in6_addr ip6r0_addr[0];
   };
@@ -95,10 +97,10 @@ struct ip6_rthdr0
 /* Fragment header */
 struct ip6_frag
   {
-    uint8_t   ip6f_nxt;		/* next header */
-    uint8_t   ip6f_reserved;	/* reserved field */
-    uint16_t  ip6f_offlg;	/* offset, reserved, and flag */
-    uint32_t  ip6f_ident;	/* identification */
+    __uint8_t   ip6f_nxt;	/* next header */
+    __uint8_t   ip6f_reserved;	/* reserved field */
+    __uint16_t  ip6f_offlg;	/* offset, reserved, and flag */
+    __uint32_t  ip6f_ident;	/* identification */
   };
 
 #if __BYTE_ORDER == __BIG_ENDIAN
@@ -114,8 +116,8 @@ struct ip6_frag
 /* IPv6 options */
 struct ip6_opt
   {
-    uint8_t  ip6o_type;
-    uint8_t  ip6o_len;
+    __uint8_t  ip6o_type;
+    __uint8_t  ip6o_len;
   };
 
 /* The high-order 3 bits of the option type define the behavior
@@ -141,19 +143,19 @@ struct ip6_opt
 /* Jumbo Payload Option */
 struct ip6_opt_jumbo
   {
-    uint8_t  ip6oj_type;
-    uint8_t  ip6oj_len;
-    uint8_t  ip6oj_jumbo_len[4];
+    __uint8_t  ip6oj_type;
+    __uint8_t  ip6oj_len;
+    __uint8_t  ip6oj_jumbo_len[4];
   };
 #define IP6OPT_JUMBO_LEN	6
 
 /* NSAP Address Option */
 struct ip6_opt_nsap
   {
-    uint8_t  ip6on_type;
-    uint8_t  ip6on_len;
-    uint8_t  ip6on_src_nsap_len;
-    uint8_t  ip6on_dst_nsap_len;
+    __uint8_t  ip6on_type;
+    __uint8_t  ip6on_len;
+    __uint8_t  ip6on_src_nsap_len;
+    __uint8_t  ip6on_dst_nsap_len;
       /* followed by source NSAP */
       /* followed by destination NSAP */
   };
@@ -161,17 +163,17 @@ struct ip6_opt_nsap
 /* Tunnel Limit Option */
 struct ip6_opt_tunnel
   {
-    uint8_t  ip6ot_type;
-    uint8_t  ip6ot_len;
-    uint8_t  ip6ot_encap_limit;
+    __uint8_t  ip6ot_type;
+    __uint8_t  ip6ot_len;
+    __uint8_t  ip6ot_encap_limit;
   };
 
 /* Router Alert Option */
 struct ip6_opt_router
   {
-    uint8_t  ip6or_type;
-    uint8_t  ip6or_len;
-    uint8_t  ip6or_value[2];
+    __uint8_t  ip6or_type;
+    __uint8_t  ip6or_len;
+    __uint8_t  ip6or_value[2];
   };
 
 /* Router alert values (in network byte order) */
diff --git a/sysdeps/gnu/netinet/ip_icmp.h b/inet/netinet/ip_icmp.h
similarity index 91%
rename from sysdeps/gnu/netinet/ip_icmp.h
rename to inet/netinet/ip_icmp.h
index 2e2bfe9..da7ff3b 100644
--- a/sysdeps/gnu/netinet/ip_icmp.h
+++ b/inet/netinet/ip_icmp.h
@@ -18,28 +18,28 @@
 #ifndef __NETINET_IP_ICMP_H
 #define __NETINET_IP_ICMP_H    1
 
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
 
 __BEGIN_DECLS
 
 struct icmphdr
 {
-  uint8_t type;		/* message type */
-  uint8_t code;		/* type sub-code */
-  uint16_t checksum;
+  __uint8_t type;		/* message type */
+  __uint8_t code;		/* type sub-code */
+  __uint16_t checksum;
   union
   {
     struct
     {
-      uint16_t	id;
-      uint16_t	sequence;
+      __uint16_t	id;
+      __uint16_t	sequence;
     } echo;			/* echo datagram */
-    uint32_t	gateway;	/* gateway address */
+    __uint32_t	gateway;	/* gateway address */
     struct
     {
-      uint16_t	__glibc_reserved;
-      uint16_t	mtu;
+      __uint16_t	__glibc_reserved;
+      __uint16_t	mtu;
     } frag;			/* path mtu discovery */
   } un;
 };
@@ -130,38 +130,38 @@ struct icmphdr
  */
 struct icmp_ra_addr
 {
-  uint32_t ira_addr;
-  uint32_t ira_preference;
+  __uint32_t ira_addr;
+  __uint32_t ira_preference;
 };
 
 struct icmp
 {
-  uint8_t  icmp_type;	/* type of message, see below */
-  uint8_t  icmp_code;	/* type sub code */
-  uint16_t icmp_cksum;	/* ones complement checksum of struct */
+  __uint8_t  icmp_type;	/* type of message, see below */
+  __uint8_t  icmp_code;	/* type sub code */
+  __uint16_t icmp_cksum;	/* ones complement checksum of struct */
   union
   {
     unsigned char ih_pptr;	/* ICMP_PARAMPROB */
     struct in_addr ih_gwaddr;	/* gateway address */
     struct ih_idseq		/* echo datagram */
     {
-      uint16_t icd_id;
-      uint16_t icd_seq;
+      __uint16_t icd_id;
+      __uint16_t icd_seq;
     } ih_idseq;
-    uint32_t ih_void;
+    __uint32_t ih_void;
 
     /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
     struct ih_pmtu
     {
-      uint16_t ipm_void;
-      uint16_t ipm_nextmtu;
+      __uint16_t ipm_void;
+      __uint16_t ipm_nextmtu;
     } ih_pmtu;
 
     struct ih_rtradv
     {
-      uint8_t irt_num_addrs;
-      uint8_t irt_wpa;
-      uint16_t irt_lifetime;
+      __uint8_t irt_num_addrs;
+      __uint8_t irt_wpa;
+      __uint16_t irt_lifetime;
     } ih_rtradv;
   } icmp_hun;
 #define	icmp_pptr	icmp_hun.ih_pptr
@@ -178,9 +178,9 @@ struct icmp
   {
     struct
     {
-      uint32_t its_otime;
-      uint32_t its_rtime;
-      uint32_t its_ttime;
+      __uint32_t its_otime;
+      __uint32_t its_rtime;
+      __uint32_t its_ttime;
     } id_ts;
     struct
     {
@@ -188,8 +188,8 @@ struct icmp
       /* options and then 64 bits of data */
     } id_ip;
     struct icmp_ra_addr id_radv;
-    uint32_t   id_mask;
-    uint8_t    id_data[1];
+    __uint32_t  id_mask;
+    __uint8_t   id_data[1];
   } icmp_dun;
 #define	icmp_otime	icmp_dun.id_ts.its_otime
 #define	icmp_rtime	icmp_dun.id_ts.its_rtime
diff --git a/sysdeps/gnu/netinet/udp.h b/inet/netinet/udp.h
similarity index 91%
rename from sysdeps/gnu/netinet/udp.h
rename to inet/netinet/udp.h
index b6822cb..481cbea 100644
--- a/sysdeps/gnu/netinet/udp.h
+++ b/inet/netinet/udp.h
@@ -47,8 +47,8 @@
 #ifndef __NETINET_UDP_H
 #define __NETINET_UDP_H    1
 
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
 
 /* UDP header as specified by RFC 768, August 1980. */
 
@@ -58,17 +58,17 @@ struct udphdr
   {
     struct
     {
-      uint16_t uh_sport;	/* source port */
-      uint16_t uh_dport;	/* destination port */
-      uint16_t uh_ulen;		/* udp length */
-      uint16_t uh_sum;		/* udp checksum */
+      __uint16_t uh_sport;	/* source port */
+      __uint16_t uh_dport;	/* destination port */
+      __uint16_t uh_ulen;	/* udp length */
+      __uint16_t uh_sum;	/* udp checksum */
     };
     struct
     {
-      uint16_t source;
-      uint16_t dest;
-      uint16_t len;
-      uint16_t check;
+      __uint16_t source;
+      __uint16_t dest;
+      __uint16_t len;
+      __uint16_t check;
     };
   };
 };
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index ce33154..dcb1175 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -622,18 +622,12 @@ HEADER_ALLOWED_INCLUDES = {
     "netatalk/at.h":               [ "sys/socket.h", "sys/ioctl.h" ],
 
     "netinet/ether.h":             [ "netinet/if_ether.h" ],
-    "netinet/icmp6.h":             [ "inttypes.h", "netinet/in.h", "string.h",
-                                     "sys/types.h" ],
-    "netinet/if_ether.h":          [ "net/ethernet.h", "net/if_arp.h",
-                                     "sys/types.h", "stdint.h" ],
-    "netinet/if_fddi.h":           [ "stdint.h", "sys/types.h" ],
-    "netinet/if_tr.h":             [ "stdint.h", "sys/types.h" ],
-    "netinet/igmp.h":              [ "netinet/in.h", "sys/types.h" ],
+    "netinet/icmp6.h":             [ "netinet/in.h" ],
+    "netinet/if_ether.h":          [ "net/ethernet.h", "net/if_arp.h" ],
+    "netinet/igmp.h":              [ "netinet/in.h" ],
     "netinet/ip.h":                [ "netinet/in.h" ],
-    "netinet/ip6.h":               [ "inttypes.h", "netinet/in.h" ],
-    "netinet/ip_icmp.h":           [ "netinet/in.h", "netinet/ip.h",
-                                     "stdint.h", "sys/types.h" ],
-    "netinet/udp.h":               [ "stdint.h", "sys/types.h" ],
+    "netinet/ip6.h":               [ "netinet/in.h" ],
+    "netinet/ip_icmp.h":           [ "netinet/in.h", "netinet/ip.h" ],
 
     "netrom/netrom.h":             [ "netax25/ax25.h" ],
     "netrose/rose.h":              [ "netax25/ax25.h" ],
diff --git a/sysdeps/generic/netinet/if_ether.h b/sysdeps/generic/netinet/if_ether.h
index 9855817..f4fd66d 100644
--- a/sysdeps/generic/netinet/if_ether.h
+++ b/sysdeps/generic/netinet/if_ether.h
@@ -18,8 +18,8 @@
 #ifndef __NETINET_IF_ETHER_H
 #define __NETINET_IF_ETHER_H	1
 
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
 
 #define ETH_ALEN	6	/* Octets in one ethernet address.  */
 
@@ -27,7 +27,7 @@
    systems.  */
 struct ether_addr
 {
-  uint8_t ether_addr_octet[ETH_ALEN];
+  __uint8_t ether_addr_octet[ETH_ALEN];
 } __attribute__ ((__packed__));
 
 #endif /* netinet/if_ether.h */
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index fdfbfc4..9da12c5 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -59,11 +59,6 @@ $(foreach o,$(object-suffixes) $(object-suffixes:=.d),\
 endif
 
 
-ifeq ($(subdir),inet)
-sysdep_headers += netinet/udp.h netinet/ip_icmp.h
-endif
-
-
 ifeq ($(subdir),csu)
 routines += unwind-resume
 shared-only-routines += unwind-resume
diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h
index 3856905..51acbfd 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_ether.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h
@@ -16,10 +16,10 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef __NETINET_IF_ETHER_H
-
 #define __NETINET_IF_ETHER_H	1
+
 #include <features.h>
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Get definitions from kernel header file.  */
 #include <linux/if_ether.h>
@@ -56,9 +56,6 @@
  *	@(#)if_ether.h	8.3 (Berkeley) 5/2/95
  *	$FreeBSD$
  */
-
-#include <features.h>
-#include <bits/types.h>
 #include <net/ethernet.h>
 #include <net/if_arp.h>
 
diff --git a/sysdeps/unix/sysv/linux/netinet/if_fddi.h b/sysdeps/unix/sysv/linux/netinet/if_fddi.h
index 2e4bb93..6a0e0d8 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_fddi.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_fddi.h
@@ -18,16 +18,18 @@
 #ifndef _NETINET_IF_FDDI_H
 #define	_NETINET_IF_FDDI_H 1
 
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
+
 #include <linux/if_fddi.h>
 
 #ifdef __USE_MISC
 
-struct fddi_header {
-  uint8_t fddi_fc;                    /* Frame Control (FC) value */
-  uint8_t fddi_dhost[FDDI_K_ALEN];    /* Destination host */
-  uint8_t fddi_shost[FDDI_K_ALEN];    /* Source host */
+struct fddi_header
+{
+  __uint8_t fddi_fc;                    /* Frame Control (FC) value */
+  __uint8_t fddi_dhost[FDDI_K_ALEN];    /* Destination host */
+  __uint8_t fddi_shost[FDDI_K_ALEN];    /* Source host */
 };
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
index 9db6b7a..6d6fd4f 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_tr.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -16,49 +16,49 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef _NETINET_IF_TR_H
-#define	_NETINET_IF_TR_H 1
+#define _NETINET_IF_TR_H 1
 
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
 
 /* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
    and FCS/CRC (frame check sequence). */
 #define TR_ALEN		6		/* Octets in one token-ring addr */
-#define TR_HLEN 	(sizeof (struct trh_hdr) + sizeof (struct trllc))
+#define TR_HLEN		(sizeof (struct trh_hdr) + sizeof (struct trllc))
 #define AC		0x10
-#define LLC_FRAME 	0x40
+#define LLC_FRAME	0x40
 
 /* LLC and SNAP constants */
-#define EXTENDED_SAP 	0xAA
-#define UI_CMD       	0x03
+#define EXTENDED_SAP	0xAA
+#define UI_CMD		0x03
 
 /* This is an Token-Ring frame header. */
 struct trh_hdr
 {
-  uint8_t  ac;			/* access control field */
-  uint8_t  fc;			/* frame control field */
-  uint8_t  daddr[TR_ALEN];	/* destination address */
-  uint8_t  saddr[TR_ALEN];	/* source address */
-  uint16_t rcf;			/* route control field */
-  uint16_t rseg[8];		/* routing registers */
+  __uint8_t  ac;		/* access control field */
+  __uint8_t  fc;		/* frame control field */
+  __uint8_t  daddr[TR_ALEN];	/* destination address */
+  __uint8_t  saddr[TR_ALEN];	/* source address */
+  __uint16_t rcf;		/* route control field */
+  __uint16_t rseg[8];		/* routing registers */
 };
 
 /* This is an Token-Ring LLC structure */
 struct trllc
 {
-  uint8_t  dsap;		/* destination SAP */
-  uint8_t  ssap;		/* source SAP */
-  uint8_t  llc;			/* LLC control field */
-  uint8_t  protid[3];		/* protocol id */
-  uint16_t ethertype;		/* ether type field */
+  __uint8_t  dsap;		/* destination SAP */
+  __uint8_t  ssap;		/* source SAP */
+  __uint8_t  llc;		/* LLC control field */
+  __uint8_t  protid[3];		/* protocol id */
+  __uint16_t ethertype;		/* ether type field */
 };
 
 /* Token-Ring statistics collection data. */
 struct tr_statistics
 {
-  unsigned long rx_packets;     /* total packets received	*/
+  unsigned long rx_packets;	/* total packets received	*/
   unsigned long tx_packets;	/* total packets transmitted	*/
-  unsigned long rx_bytes;	/* total bytes received   	*/
+  unsigned long rx_bytes;	/* total bytes received		*/
   unsigned long tx_bytes;	/* total bytes transmitted	*/
   unsigned long rx_errors;	/* bad packets received		*/
   unsigned long tx_errors;	/* packet transmit problems	*/
@@ -84,27 +84,27 @@ struct tr_statistics
 };
 
 /* source routing stuff */
-#define TR_RII 			0x80
-#define TR_RCF_DIR_BIT 		0x80
-#define TR_RCF_LEN_MASK 	0x1f00
-#define TR_RCF_BROADCAST 	0x8000	/* all-routes broadcast */
+#define TR_RII			 0x80
+#define TR_RCF_DIR_BIT		 0x80
+#define TR_RCF_LEN_MASK		 0x1f00
+#define TR_RCF_BROADCAST	 0x8000	/* all-routes broadcast */
 #define TR_RCF_LIMITED_BROADCAST 0xC000	/* single-route broadcast */
-#define TR_RCF_FRAME2K 		0x20
-#define TR_RCF_BROADCAST_MASK 	0xC000
-#define TR_MAXRIFLEN 		18
+#define TR_RCF_FRAME2K		 0x20
+#define TR_RCF_BROADCAST_MASK	 0xC000
+#define TR_MAXRIFLEN		 18
 
 #ifdef __USE_MISC
 
 struct trn_hdr
 {
-  uint8_t trn_ac;                /* access control field */
-  uint8_t trn_fc;                /* field control field */
-  uint8_t trn_dhost[TR_ALEN];    /* destination host */
-  uint8_t trn_shost[TR_ALEN];    /* source host */
-  uint16_t trn_rcf;              /* route control field */
-  uint16_t trn_rseg[8];          /* routing registers */
+  __uint8_t  trn_ac;		   /* access control field */
+  __uint8_t  trn_fc;		   /* field control field */
+  __uint8_t  trn_dhost[TR_ALEN];   /* destination host */
+  __uint8_t  trn_shost[TR_ALEN];   /* source host */
+  __uint16_t trn_rcf;		   /* route control field */
+  __uint16_t trn_rseg[8];	   /* routing registers */
 };
 
 #endif
 
-#endif	/* netinet/if_tr.h */
+#endif /* netinet/if_tr.h */


             reply	other threads:[~2019-06-05 12:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 12:25 Zack Weinberg [this message]
2019-06-18 15:36 Zack Weinberg

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=20190605122510.18387.qmail@sourceware.org \
    --to=zack@sourceware.org \
    --cc=glibc-cvs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).