[PATCH 30/32] utils/net: Rearrange includes

Florian Bezdeka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <20260508-wip-flo-refactor-includes-v1-30-e449f2bd4fc2@siemens.com>
Moving from "local to global" should help us to keep headers
self-contained.

Signed-off-by: Florian Bezdeka <[email protected]>
---
 utils/net/nomaccfg.c   |  8 +++-----
 utils/net/rtcfg.c      | 17 ++++++-----------
 utils/net/rtifconfig.c | 17 +++++++----------
 utils/net/rtiwconfig.c | 12 ++++--------
 utils/net/rtping.c     | 16 ++++++----------
 utils/net/rtroute.c    | 13 +++++--------
 utils/net/tdmacfg.c    |  9 +++------
 7 files changed, 34 insertions(+), 58 deletions(-)

diff --git a/utils/net/nomaccfg.c b/utils/net/nomaccfg.c
index f0b5dafde6dcef2b8d9f3494415b1a7d38acd79f..97a1c657c53194742ede378ab6fbc32d488bc2cd 100644
--- a/utils/net/nomaccfg.c
+++ b/utils/net/nomaccfg.c
@@ -23,16 +23,14 @@
  *
  */
 
+#include <nomac_chrdev.h>
+
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-#include <fcntl.h>
 #include <sys/ioctl.h>
 
-#include <nomac_chrdev.h>
-
-
 static int                     f;
 static struct nomac_config     nomac_cfg;
 
diff --git a/utils/net/rtcfg.c b/utils/net/rtcfg.c
index e68bf8786cc2c1c688a3dc486674f1e66a0d52bf..4f05a2a23b7e81c5afbfa780c5f853d021317296 100644
--- a/utils/net/rtcfg.c
+++ b/utils/net/rtcfg.c
@@ -22,24 +22,19 @@
  *
  */
 
+#include <rtcfg_chrdev.h>
+
+#include <arpa/inet.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
+#include <netinet/ether.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/ether.h>
-#include <arpa/inet.h>
-
-#include <rtcfg_chrdev.h>
-
+#include <sys/stat.h>
+#include <unistd.h>
 
 #define DFLT_PACKET_SIZE        1500 /* Ethernet packet */
 #define DFLT_CLIENT_BURST_RATE  4
diff --git a/utils/net/rtifconfig.c b/utils/net/rtifconfig.c
index 9a9abfc4c9b5ec2817acd0844872d1ec07ea1300..84e127215b752f805cb5fc56de5fd65503f4c934 100644
--- a/utils/net/rtifconfig.c
+++ b/utils/net/rtifconfig.c
@@ -23,20 +23,17 @@
  *
  */
 
+#include <rtnet_chrdev.h>
+
+#include <arpa/inet.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netinet/ether.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <fcntl.h>
 #include <sys/ioctl.h>
-#include <net/ethernet.h>
-#include <net/if_arp.h>
-#include <netinet/ether.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <rtnet_chrdev.h>
 
 /* Some old toolchains don't ARPHRD_IEEE1394 defined */
 #ifndef ARPHRD_IEEE1394
diff --git a/utils/net/rtiwconfig.c b/utils/net/rtiwconfig.c
index eecb2939b1c27f8d1a807f8c29344851d031fa0a..2d4dd2a20fc755aa0fd40b32059c6a588e56801a 100644
--- a/utils/net/rtiwconfig.c
+++ b/utils/net/rtiwconfig.c
@@ -1,15 +1,11 @@
+#include <rtwlan_io.h>
+
+#include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-#include <fcntl.h>
 #include <sys/ioctl.h>
-#include <net/ethernet.h>
-#include <net/if_arp.h>
-#include <netinet/ether.h>
-#include <netinet/in.h>
-
-#include <rtwlan_io.h>
 
 #define PRINT_FLAG_ALL          1
 #define PRINT_FLAG_INACTIVE     2
diff --git a/utils/net/rtping.c b/utils/net/rtping.c
index bdaf6cb15a3e8b981877bcf3884851a3c315e083..fd3e66e6a7c2f5f1745da97e66fa4f878f8156c8 100644
--- a/utils/net/rtping.c
+++ b/utils/net/rtping.c
@@ -22,22 +22,18 @@
  *
  */
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <ipv4_chrdev.h>
+
+#include <arpa/inet.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <ipv4_chrdev.h>
-
+#include <unistd.h>
 
 int             f;
 struct ipv4_cmd cmd;
diff --git a/utils/net/rtroute.c b/utils/net/rtroute.c
index ef6b56ecf023d2c6733dd8caf476f21bbf4103ed..a8eecf3a0b04ac85aa6dcdedc36ea24a48a74896 100644
--- a/utils/net/rtroute.c
+++ b/utils/net/rtroute.c
@@ -22,20 +22,17 @@
  *
  */
 
+#include <ipv4_chrdev.h>
+
+#include <arpa/inet.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <netinet/ether.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-#include <netinet/ether.h>
-#include <arpa/inet.h>
-
-#include <ipv4_chrdev.h>
-
+#include <unistd.h>
 
 int             f;
 struct ipv4_cmd cmd;
diff --git a/utils/net/tdmacfg.c b/utils/net/tdmacfg.c
index b1937b37feb8fb3bbadbefebdf459266e93a7b15..053b07b7e980a12c47b1bb99e22597c4ce534e28 100644
--- a/utils/net/tdmacfg.c
+++ b/utils/net/tdmacfg.c
@@ -23,18 +23,15 @@
  *
  */
 
-#include <errno.h>
+#include <tdma_chrdev.h>
+
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-#include <arpa/inet.h>
-
-#include <tdma_chrdev.h>
-
+#include <unistd.h>
 
 static int                  f;
 static struct tdma_config   tdma_cfg;

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.