This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[glibc/zack/no-nested-includes] Minimize includes by networking headers 2/3: ipx, rose, protocols


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

commit 852c0727b2568265f6b0a52bb4ce46d5854a714b
Author: Zack Weinberg <zackw@panix.com>
Date:   Sun Jun 2 11:17:36 2019 -0400

    Minimize includes by networking headers 2/3: ipx, rose, protocols
    
    In this chunk, we do everything that sorts alphabetically _after_
    netinet/.  Note that Rose and NetROM are based on AX.25 so it
    makes practical sense for netrose/rose.h and netrom/netrom.h to
    continue including netax25/ax25.h.
    
    	* inet/protocols/rwhod.h: Include features.h and bits/types.h.
    	Donâ??t include sys/types.h.  Use __int32_t instead of int32_t.
    	* inet/protocols/talkd.h: Include features.h and bits/types.h.
    	Donâ??t include sys/types.h, sys/socket.h, or stdint.h. Use
    	__int32_t and __uint32_t instead of int32_t and uint32_t.
    	* inet/protocols/timed.h: Include features.h, bits/types.h,
    	and bits/types/struct_timeval.h. Donâ??t include sys/types.h or
    	sys/time.h.
    	* sysdeps/unix/sysv/linux/netipx/ipx.h: Include features.h and
    	bits/types.h.  Donâ??t include sys/types.h or stdint.h. Use
    	__uint16_t and __uint32_t instead of uint16_t and uint32_t.
    	* sysdeps/unix/sysv/linux/netrose/rose.h: Include features.h.
    	Donâ??t include sys/socket.h.
    
    	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
    	Update.

Diff:
---
 inet/protocols/rwhod.h                 |  5 +++--
 inet/protocols/talkd.h                 | 11 +++++------
 inet/protocols/timed.h                 |  5 +++--
 scripts/check-obsolete-constructs.py   | 12 +++++-------
 sysdeps/unix/sysv/linux/netipx/ipx.h   | 10 +++++-----
 sysdeps/unix/sysv/linux/netrose/rose.h |  2 +-
 6 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/inet/protocols/rwhod.h b/inet/protocols/rwhod.h
index 446d6f9..74fe1f9 100644
--- a/inet/protocols/rwhod.h
+++ b/inet/protocols/rwhod.h
@@ -32,7 +32,8 @@
 #ifndef _PROTOCOLS_RWHOD_H
 #define	_PROTOCOLS_RWHOD_H 1
 
-#include <sys/types.h>
+#include <features.h>
+#include <bits/types.h>
 
 /*
  * rwho protocol packet format.
@@ -40,7 +41,7 @@
 struct	outmp {
 	char	out_line[8];		/* tty name */
 	char	out_name[8];		/* user id */
-	int32_t	out_time;		/* time on */
+	__int32_t out_time;		/* time on */
 };
 
 struct	whod {
diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h
index 09bd8a9..5068e98 100644
--- a/inet/protocols/talkd.h
+++ b/inet/protocols/talkd.h
@@ -50,9 +50,8 @@
  * stream connection through which the conversation takes place.
  */
 
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
 #include <bits/types/struct_osockaddr.h>
 
 /*
@@ -63,10 +62,10 @@ typedef struct {
 	unsigned char	type;	/* request type, see below */
 	unsigned char	answer;	/* not used */
 	unsigned char	pad;
-	uint32_t id_num;	/* message id */
+	__uint32_t	id_num;	/* message id */
 	struct	osockaddr addr;		/* old (4.3) style */
 	struct	osockaddr ctl_addr;	/* old (4.3) style */
-	int32_t	pid;		/* caller's process id */
+	__int32_t	pid;		/* caller's process id */
 #define	NAME_SIZE	12
 	char	l_name[NAME_SIZE];/* caller's name */
 	char	r_name[NAME_SIZE];/* callee's name */
@@ -82,7 +81,7 @@ typedef struct {
 	unsigned char	type;	/* type of request message, see below */
 	unsigned char	answer;	/* response to request message, see below */
 	unsigned char	pad;
-	uint32_t	id_num;	/* message id */
+	__uint32_t	id_num;	/* message id */
 	struct	osockaddr addr;	/* address for establishing conversation */
 } CTL_RESPONSE;
 
diff --git a/inet/protocols/timed.h b/inet/protocols/timed.h
index cabdce4..5ec9de8 100644
--- a/inet/protocols/timed.h
+++ b/inet/protocols/timed.h
@@ -32,8 +32,9 @@
 #ifndef	_PROTOCOLS_TIMED_H
 #define	_PROTOCOLS_TIMED_H 1
 
-#include <sys/types.h>
-#include <sys/time.h>
+#include <features.h>
+#include <bits/types.h>
+#include <bits/types/struct_timeval.h>
 
 /*
  * Time Synchronization Protocol
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 288d4e5..ce33154 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -613,13 +613,14 @@ HEADER_ALLOWED_INCLUDES = {
     "resolv.h":                    [ "arpa/nameser.h", "netinet/in.h" ],
     "arpa/nameser.h":              [ "arpa/nameser_compat.h" ],
 
-    "net/ethernet.h":              [ "stdint.h", "net/if_ether.h" ],
+    "net/ethernet.h":              [ "net/if_ether.h" ],
     "net/if_arp.h":                [ "sys/socket.h" ],
     "net/if_ppp.h":                [ "net/if.h", "net/ppp_defs.h",
                                      "sys/ioctl.h" ],
     "net/if_shaper.h":             [ "net/if.h", "sys/ioctl.h" ],
     "net/route.h":                 [ "netinet/in.h", "sys/socket.h" ],
     "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" ],
@@ -633,14 +634,11 @@ HEADER_ALLOWED_INCLUDES = {
     "netinet/ip_icmp.h":           [ "netinet/in.h", "netinet/ip.h",
                                      "stdint.h", "sys/types.h" ],
     "netinet/udp.h":               [ "stdint.h", "sys/types.h" ],
-    "netipx/ipx.h":                [ "stdint.h", "sys/types.h" ],
+
     "netrom/netrom.h":             [ "netax25/ax25.h" ],
-    "netrose/rose.h":              [ "netax25/ax25.h", "sys/socket.h" ],
+    "netrose/rose.h":              [ "netax25/ax25.h" ],
     "protocols/routed.h":          [ "sys/socket.h" ],
-    "protocols/rwhod.h":           [ "paths.h", "sys/types.h" ],
-    "protocols/talkd.h":           [ "stdint.h", "sys/socket.h",
-                                     "sys/types.h" ],
-    "protocols/timed.h":           [ "sys/time.h", "sys/types.h" ],
+    "protocols/rwhod.h":           [ "paths.h" ],
 
     # Internal headers
     "features.h":                  [ "gnu/stubs.h", "stdc-predef.h",
diff --git a/sysdeps/unix/sysv/linux/netipx/ipx.h b/sysdeps/unix/sysv/linux/netipx/ipx.h
index 6ccbb88..fbd3d9f 100644
--- a/sysdeps/unix/sysv/linux/netipx/ipx.h
+++ b/sysdeps/unix/sysv/linux/netipx/ipx.h
@@ -18,8 +18,8 @@
 #ifndef __NETIPX_IPX_H
 #define __NETIPX_IPX_H 1
 
-#include <sys/types.h>
-#include <stdint.h>
+#include <features.h>
+#include <bits/types.h>
 #include <bits/sockaddr.h>
 
 __BEGIN_DECLS
@@ -33,10 +33,10 @@ __BEGIN_DECLS
 struct sockaddr_ipx
   {
     sa_family_t sipx_family;
-    uint16_t sipx_port;
-    uint32_t sipx_network;
+    __uint16_t sipx_port;
+    __uint32_t sipx_network;
     unsigned char sipx_node[IPX_NODE_LEN];
-    uint8_t sipx_type;
+    __uint8_t sipx_type;
     unsigned char sipx_zero;	/* 16 byte fill */
   };
 
diff --git a/sysdeps/unix/sysv/linux/netrose/rose.h b/sysdeps/unix/sysv/linux/netrose/rose.h
index ab2afb3..1c4bd26 100644
--- a/sysdeps/unix/sysv/linux/netrose/rose.h
+++ b/sysdeps/unix/sysv/linux/netrose/rose.h
@@ -21,7 +21,7 @@
 #ifndef _NETROSE_ROSE_H
 #define _NETROSE_ROSE_H 1
 
-#include <sys/socket.h>
+#include <features.h>
 #include <netax25/ax25.h>
 
 /* Socket level values.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]