@@ -3,6 +3,7 @@
#include <errno.h>
#include <sys/socket.h>
#include <netax25/ax25.h>
+#include <stddef.h>
#include "utils.h"
@@ -13,14 +13,13 @@
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
-#include <linux/types.h>
-#include <linux/limits.h>
#include <ftw.h>
-#include "cg_map.h"
#include "list.h"
#include "utils.h"
+#include "cg_map.h"
+
struct cg_cache {
struct hlist_node id_hash;
__u64 id;
@@ -5,10 +5,11 @@
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
-#include <sys/types.h>
+#include <stdbool.h>
#include <linux/if.h>
#include "color.h"
+
#include "utils.h"
static void set_color_palette(void);
@@ -3,9 +3,11 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
#include "utils.h"
-#include "namespace.h"
int cmd_exec(const char *cmd, char **argv, bool do_fork,
int (*setup)(void *), void *arg)
@@ -10,19 +10,19 @@
*
*/
-#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/socket.h>
#include <sys/mount.h>
#include <ctype.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
+
#include "utils.h"
#ifndef HAVE_HANDLE_AT
@@ -12,10 +12,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
@@ -9,10 +9,16 @@
* Authors: Julien Fortin, <julien@cumulusnetworks.com>
*/
-#include <stdarg.h>
+
#include <stdio.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/time.h>
#include "utils.h"
+#include "color.h"
+#include "json_writer.h"
#include "json_print.h"
static json_writer_t *_jw;
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0+
-#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#include "utils.h"
#include "json_print.h"
+#include "color.h"
char *sprint_size(__u32 sz, char *buf)
{
@@ -12,9 +12,9 @@
#include <stdbool.h>
#include <stdarg.h>
#include <assert.h>
-#include <malloc.h>
#include <inttypes.h>
#include <stdint.h>
+#include <stdlib.h>
#include "json_writer.h"
@@ -6,9 +6,13 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
+#include <string.h>
#include <linux/genetlink.h>
+
+#include "libnetlink.h"
+#include "linux/netlink.h"
+
#include "libgenl.h"
static int genl_parse_getfamily(struct nlmsghdr *nlh)
@@ -14,20 +14,20 @@
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <net/if_arp.h>
#include <sys/socket.h>
-#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <sys/uio.h>
+#include <stdint.h>
+#include <sys/param.h>
#include <linux/fib_rules.h>
#include <linux/if_addrlabel.h>
#include <linux/if_bridge.h>
#include <linux/nexthop.h>
#include "libnetlink.h"
+
#include "utils.h"
#ifndef __aligned
@@ -10,19 +10,10 @@
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
-
-#include <linux/netdevice.h>
#include <linux/if_arp.h>
-#include <linux/sockios.h>
-
#include "rt_names.h"
#include "utils.h"
@@ -12,17 +12,19 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <sys/socket.h>
-#include <netinet/in.h>
#include <string.h>
#include <net/if.h>
+#include <stdbool.h>
#include "libnetlink.h"
-#include "ll_map.h"
#include "list.h"
#include "utils.h"
+#include "linux/if_link.h"
+#include "linux/netlink.h"
+#include "linux/rtnetlink.h"
+
+#include "ll_map.h"
struct ll_cache {
struct hlist_node idx_hash;
@@ -10,21 +10,12 @@
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-
-#include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/sockios.h>
+#include <strings.h>
#include "utils.h"
#include "rt_names.h"
+#include "linux/if_ether.h"
#define __PF(f,n) { ETH_P_##f, #n },
@@ -10,19 +10,7 @@
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-
-#include <linux/netdevice.h>
#include <linux/if_arp.h>
-#include <linux/sockios.h>
-
#include "rt_names.h"
#include "utils.h"
@@ -7,11 +7,15 @@
#include <string.h>
#include <time.h>
#include <libmnl/libmnl.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <linux/genetlink.h>
+#include <linux/netlink.h>
-#include "libnetlink.h"
-#include "mnl_utils.h"
#include "utils.h"
+#include "mnl_utils.h"
+
struct mnl_socket *mnlu_socket_open(int bus)
{
@@ -2,8 +2,10 @@
#include <errno.h>
#include <string.h>
-#include <sys/types.h>
#include <netinet/in.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/socket.h>
#include <linux/mpls.h>
#include "utils.h"
@@ -2,8 +2,10 @@
#include <errno.h>
#include <string.h>
-#include <sys/types.h>
#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/socket.h>
#include <linux/mpls.h>
#include "utils.h"
@@ -14,7 +14,6 @@
#include <errno.h>
#include "names.h"
-#include "utils.h"
#define MAX_ENTRIES 256
#define NAME_MAX_LEN 512
@@ -11,8 +11,13 @@
#include <fcntl.h>
#include <dirent.h>
#include <limits.h>
+#include <errno.h>
+#include <sched.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <unistd.h>
-#include "utils.h"
#include "namespace.h"
static void bind_etc(const char *name)
@@ -2,6 +2,7 @@
#include <sys/socket.h>
#include <errno.h>
+#include <stddef.h>
#include <linux/ax25.h>
#include "utils.h"
@@ -1,22 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0+ */
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
#include <errno.h>
-
-#include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/sockios.h>
#include <linux/rose.h>
-#include "rt_names.h"
#include "utils.h"
static const char *rose_ntop1(const rose_address *src, char *dst,
@@ -11,19 +11,13 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/time.h>
-#include <sys/socket.h>
#include <dirent.h>
#include <limits.h>
-#include <asm/types.h>
#include <linux/rtnetlink.h>
#include "rt_names.h"
-#include "utils.h"
#define NAME_MAX_LEN 512
@@ -12,9 +12,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
#include <math.h>
#include <unistd.h>
-#include <fcntl.h>
#include <limits.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -22,9 +23,9 @@
#include <ctype.h>
#include <netdb.h>
#include <arpa/inet.h>
-#include <asm/types.h>
-#include <linux/pkt_sched.h>
-#include <linux/param.h>
+#include <asm/param.h>
+#include <linux/capability.h>
+#include <strings.h>
#include <linux/if_arp.h>
#include <linux/mpls.h>
#include <linux/snmp.h>
@@ -36,9 +37,9 @@
#endif
#include "rt_names.h"
+#include "color.h"
+
#include "utils.h"
-#include "ll_map.h"
-#include "namespace.h"
int resolve_hosts;
int timestamp_short;
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <asm/types.h>
+#include <strings.h>
#include "utils.h"
Used iwyu as first attempt to do better at headers in iproute2. Needed some manual cleanup because iwyu tends to use some headers that might be system specific (example is sys/uio.h). Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/ax25_ntop.c | 1 + lib/cg_map.c | 5 ++--- lib/color.c | 3 ++- lib/exec.c | 4 +++- lib/fs.c | 4 ++-- lib/inet_proto.c | 4 ---- lib/json_print.c | 8 +++++++- lib/json_print_math.c | 2 +- lib/json_writer.c | 2 +- lib/libgenl.c | 6 +++++- lib/libnetlink.c | 6 +++--- lib/ll_addr.c | 9 --------- lib/ll_map.c | 10 ++++++---- lib/ll_proto.c | 13 ++----------- lib/ll_types.c | 12 ------------ lib/mnl_utils.c | 8 ++++++-- lib/mpls_ntop.c | 4 +++- lib/mpls_pton.c | 4 +++- lib/names.c | 1 - lib/namespace.c | 7 ++++++- lib/netrom_ntop.c | 1 + lib/rose_ntop.c | 12 ------------ lib/rt_names.c | 6 ------ lib/utils.c | 13 +++++++------ lib/utils_math.c | 2 +- 25 files changed, 62 insertions(+), 85 deletions(-)