batman-adv: Use includes instead of fwdecls
authorSven Eckelmann <sven@narfation.org>
Fri, 24 May 2019 18:11:17 +0000 (20:11 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Sat, 25 May 2019 10:59:53 +0000 (12:59 +0200)
While it can be slightly beneficial for the build performance to use
forward declarations instead of includes, the handling of them together
with changes in the included headers makes it unnecessary complicated and
fragile. Just replace them with actual includes since some parts (hwmon,
..) of the kernel even request avoidance of forward declarations and net/
is mostly not using them in *.c file.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
28 files changed:
net/batman-adv/bat_algo.h
net/batman-adv/bat_v.c
net/batman-adv/bat_v_elp.h
net/batman-adv/bat_v_ogm.h
net/batman-adv/bridge_loop_avoidance.h
net/batman-adv/debugfs.h
net/batman-adv/distributed-arp-table.h
net/batman-adv/fragmentation.h
net/batman-adv/gateway_client.h
net/batman-adv/gateway_common.h
net/batman-adv/hard-interface.h
net/batman-adv/hash.h
net/batman-adv/icmp_socket.h
net/batman-adv/main.h
net/batman-adv/multicast.h
net/batman-adv/netlink.c
net/batman-adv/netlink.h
net/batman-adv/network-coding.h
net/batman-adv/originator.h
net/batman-adv/routing.h
net/batman-adv/send.h
net/batman-adv/soft-interface.c
net/batman-adv/soft-interface.h
net/batman-adv/sysfs.h
net/batman-adv/tp_meter.h
net/batman-adv/translation-table.h
net/batman-adv/tvlv.h
net/batman-adv/types.h

index cb7d57d16c9dd6425b4b32ab02764732803ad28a..37898da8ad48493f9455ea96ff72a669477261cd 100644 (file)
@@ -9,12 +9,11 @@
 
 #include "main.h"
 
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
 
-struct netlink_callback;
-struct seq_file;
-struct sk_buff;
-
 extern char batadv_routing_algo[];
 extern struct list_head batadv_hardif_list;
 
index 231b4aab4d8de491c6a687db0680e46c677ed514..22672cb3e25dc4b43930c66e6f4ac228fd7cfcda 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/rculist.h>
 #include <linux/rcupdate.h>
 #include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/spinlock.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
@@ -41,8 +42,6 @@
 #include "netlink.h"
 #include "originator.h"
 
-struct sk_buff;
-
 static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
 {
        struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
index bb3d40f73bfebf1f0940b716709c75269444f3e4..1a29505f4f6653e0c5e65609829327d91ef7fdc8 100644 (file)
@@ -9,8 +9,8 @@
 
 #include "main.h"
 
-struct sk_buff;
-struct work_struct;
+#include <linux/skbuff.h>
+#include <linux/workqueue.h>
 
 int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface);
 void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface);
index 616bf2ea8755742b688f07a1166b7cb98bf50dd4..2a50df7fc2bfe77ec0b37016ce912f767c1a1b4f 100644 (file)
@@ -9,10 +9,9 @@
 
 #include "main.h"
 
+#include <linux/skbuff.h>
 #include <linux/types.h>
 
-struct sk_buff;
-
 int batadv_v_ogm_init(struct batadv_priv *bat_priv);
 void batadv_v_ogm_free(struct batadv_priv *bat_priv);
 int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface);
index 012d72c8d06463d64ed2374b0a9963577a5c25ab..02b24a861a85477820f80b97f4c095e526dfce12 100644 (file)
 #include "main.h"
 
 #include <linux/compiler.h>
+#include <linux/netdevice.h>
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 
-struct net_device;
-struct netlink_callback;
-struct seq_file;
-struct sk_buff;
-
 /**
  * batadv_bla_is_loopdetect_mac() - check if the mac address is from a loop
  *  detect frame sent by bridge loop avoidance
index 7fac680cf74056a749760c00e9607adee7272ae4..ed33431954662ffaa813899b0d76ef1d89e23057 100644 (file)
@@ -9,8 +9,8 @@
 
 #include "main.h"
 
-struct file;
-struct net_device;
+#include <linux/fs.h>
+#include <linux/netdevice.h>
 
 #define BATADV_DEBUGFS_SUBDIR "batman_adv"
 
index 110c27447d706ea43894e44167a529c384576059..67c7729add55fd07bfd9b9b67aa03d1d492c2d5c 100644 (file)
 
 #include <linux/compiler.h>
 #include <linux/netdevice.h>
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
 #include <uapi/linux/batadv_packet.h>
 
 #include "originator.h"
 
-struct netlink_callback;
-struct seq_file;
-struct sk_buff;
-
 #ifdef CONFIG_BATMAN_ADV_DAT
 
 /* BATADV_DAT_ADDR_MAX - maximum address value in the DHT space */
index d6074ba2ada7ee7ad06ada719a4d3b74b31cbd84..abfe8c6556de30e56bcef0ddcedd0f631ba4d19f 100644 (file)
 
 #include <linux/compiler.h>
 #include <linux/list.h>
+#include <linux/skbuff.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 
-struct sk_buff;
-
 void batadv_frag_purge_orig(struct batadv_orig_node *orig,
                            bool (*check_cb)(struct batadv_frag_table_entry *));
 bool batadv_frag_skb_fwd(struct sk_buff *skb,
index 0e14026feebd3117d64eb8e2fce5ab1d900f8e81..0be8e7178ec787a52d09476c411f01111834a325 100644 (file)
@@ -9,12 +9,11 @@
 
 #include "main.h"
 
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
-
-struct batadv_tvlv_gateway_data;
-struct netlink_callback;
-struct seq_file;
-struct sk_buff;
+#include <uapi/linux/batadv_packet.h>
 
 void batadv_gw_check_client_stop(struct batadv_priv *bat_priv);
 void batadv_gw_reselect(struct batadv_priv *bat_priv);
index 5cf50736c635f996169cc980cb0690a358f119a2..211b14b37db816e6e14fba956da4305c3e6b0c32 100644 (file)
@@ -9,10 +9,9 @@
 
 #include "main.h"
 
+#include <linux/netdevice.h>
 #include <linux/types.h>
 
-struct net_device;
-
 /**
  * enum batadv_bandwidth_units - bandwidth unit types
  */
index c8ef6aa0e86500c73f644a39e02fd376775271f4..bbb8a6f18d6b8bc3098d757113c093cfaf08c3c4 100644 (file)
 
 #include <linux/compiler.h>
 #include <linux/kref.h>
+#include <linux/netdevice.h>
 #include <linux/notifier.h>
 #include <linux/rcupdate.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
-
-struct net_device;
-struct net;
+#include <net/net_namespace.h>
 
 /**
  * enum batadv_hard_if_state - State of a hard interface
index ceef171f7f98d02b12ef099d6fdc1f9df2209553..57877f0b78e02979a26b8dc13b99408ad6078dc6 100644 (file)
 #include <linux/atomic.h>
 #include <linux/compiler.h>
 #include <linux/list.h>
+#include <linux/lockdep.h>
 #include <linux/rculist.h>
 #include <linux/spinlock.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 
-struct lock_class_key;
-
 /* callback to a compare function.  should compare 2 element datas for their
  * keys
  *
index 35eecbfd2e65bbbe11b26066fefeaf2111468534..1fc0b0de290ee1937eb5bd8ea3e3bb187b3902ef 100644 (file)
@@ -10,8 +10,7 @@
 #include "main.h"
 
 #include <linux/types.h>
-
-struct batadv_icmp_header;
+#include <uapi/linux/batadv_packet.h>
 
 #define BATADV_ICMP_SOCKET "socket"
 
index 821a7de45256210459b4dbc209a5c779bf407321..3d4c04d87ff38de3c7b71c5a2bd0b1d25468ce73 100644 (file)
@@ -210,16 +210,15 @@ enum batadv_uev_type {
 #include <linux/etherdevice.h>
 #include <linux/if_vlan.h>
 #include <linux/jiffies.h>
+#include <linux/netdevice.h>
 #include <linux/percpu.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
 #include <uapi/linux/batadv_packet.h>
 
 #include "types.h"
-
-struct net_device;
-struct packet_type;
-struct seq_file;
-struct sk_buff;
+#include "main.h"
 
 /**
  * batadv_print_vid() - return printable version of vid information
index 653b9b76fabe68ee7dbe038ef86b7e631848c18a..5d9e2bb29c9710e22c409629b99c6a4bbbe44d04 100644 (file)
@@ -9,9 +9,9 @@
 
 #include "main.h"
 
-struct netlink_callback;
-struct seq_file;
-struct sk_buff;
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 
 /**
  * enum batadv_forw_mode - the way a packet should be forwarded as
index 7253699c3151982976ea1a32037c1778591ee48d..6f08fd122a8ddea43600c856a6be171dc7625d9c 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <net/genetlink.h>
+#include <net/net_namespace.h>
 #include <net/netlink.h>
 #include <net/sock.h>
 #include <uapi/linux/batadv_packet.h>
@@ -50,8 +51,6 @@
 #include "tp_meter.h"
 #include "translation-table.h"
 
-struct net;
-
 struct genl_family batadv_netlink_family;
 
 /* multicast groups */
index d1e0681b87438c3d9c52bddbbec7dc27c1830df6..ddc674e47dbbdda8dc796f226ccb9ab9dc02ce91 100644 (file)
@@ -9,11 +9,10 @@
 
 #include "main.h"
 
+#include <linux/netlink.h>
 #include <linux/types.h>
 #include <net/genetlink.h>
 
-struct nlmsghdr;
-
 void batadv_netlink_register(void);
 void batadv_netlink_unregister(void);
 int batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype);
index 74f56113a5d06f0afaa02706c7318a8d6762527e..4801d0891cc84740b35b922047c8620418322716 100644 (file)
@@ -9,12 +9,11 @@
 
 #include "main.h"
 
+#include <linux/netdevice.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
-
-struct batadv_ogm_packet;
-struct net_device;
-struct seq_file;
-struct sk_buff;
+#include <uapi/linux/batadv_packet.h>
 
 #ifdef CONFIG_BATMAN_ADV_NC
 
index 3829e26f9c5d99332a7bcb837ba491f51e616ca3..512a1f99dd75147c7d179d8494bc60748b1f6762 100644 (file)
 #include <linux/compiler.h>
 #include <linux/if_ether.h>
 #include <linux/jhash.h>
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
 
-struct netlink_callback;
-struct seq_file;
-struct sk_buff;
-
 bool batadv_compare_orig(const struct hlist_node *node, const void *data2);
 int batadv_originator_init(struct batadv_priv *bat_priv);
 void batadv_originator_free(struct batadv_priv *bat_priv);
index b96c6d06d188e7e3d67f70b71764898ff4f01a9c..c20feac951078bf95620261e9f1bbfd313b8c0f1 100644 (file)
@@ -9,10 +9,9 @@
 
 #include "main.h"
 
+#include <linux/skbuff.h>
 #include <linux/types.h>
 
-struct sk_buff;
-
 bool batadv_check_management_packet(struct sk_buff *skb,
                                    struct batadv_hard_iface *hard_iface,
                                    int header_len);
index 5921ee4e107c643bee9255ce2b3f47e5edf8a622..5fc0fd1e5d0855020a3febd205b670be4adb7f08 100644 (file)
 #include "main.h"
 
 #include <linux/compiler.h>
+#include <linux/skbuff.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
 #include <uapi/linux/batadv_packet.h>
 
-struct sk_buff;
-
 void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet,
                             bool dropped);
 struct batadv_forw_packet *
index a7677e1d000fbc6ab60466cf5fc4f1750014268e..499afbce44dc91ec660e2153d08f7f1d92c7f739 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/list.h>
 #include <linux/lockdep.h>
 #include <linux/netdevice.h>
+#include <linux/netlink.h>
 #include <linux/percpu.h>
 #include <linux/printk.h>
 #include <linux/random.h>
index 275442a7acb6d901653dc98aaf0abad410caf639..29139ad769fec2aeb1528750031ac683b10e43b7 100644 (file)
@@ -9,13 +9,12 @@
 
 #include "main.h"
 
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
+#include <net/net_namespace.h>
 #include <net/rtnetlink.h>
 
-struct net_device;
-struct net;
-struct sk_buff;
-
 int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
 void batadv_interface_rx(struct net_device *soft_iface,
                         struct sk_buff *skb, int hdr_size,
index 83fa808b187137827406a3bc41c77ff0c23863db..5e466093dfa5f966bc5f14fe5c1068850430d60c 100644 (file)
@@ -9,12 +9,11 @@
 
 #include "main.h"
 
+#include <linux/kobject.h>
+#include <linux/netdevice.h>
 #include <linux/sysfs.h>
 #include <linux/types.h>
 
-struct kobject;
-struct net_device;
-
 #define BATADV_SYSFS_IF_MESH_SUBDIR "mesh"
 #define BATADV_SYSFS_IF_BAT_SUBDIR "batman_adv"
 /**
index 604b3799c972046bf10fb37ab4f2712ca73d1981..78d310da0ad39948bfd370ba08a7732e9b79310f 100644 (file)
@@ -9,10 +9,9 @@
 
 #include "main.h"
 
+#include <linux/skbuff.h>
 #include <linux/types.h>
 
-struct sk_buff;
-
 void batadv_tp_meter_init(void);
 void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst,
                     u32 test_length, u32 *cookie);
index c8c48d62a430333ae7db63561f08e59dac6292f3..4a98860d7f0e81d3b74272f59f3397a11d3e23c7 100644 (file)
@@ -9,13 +9,12 @@
 
 #include "main.h"
 
+#include <linux/netdevice.h>
+#include <linux/netlink.h>
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/types.h>
 
-struct netlink_callback;
-struct net_device;
-struct seq_file;
-struct sk_buff;
-
 int batadv_tt_init(struct batadv_priv *bat_priv);
 bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
                         unsigned short vid, int ifindex, u32 mark);
index 114ac01e06afa333cbb98771198e792bbd8fefa2..36985000a0a8472b97bdec3e93fcb82adec3db91 100644 (file)
@@ -10,8 +10,7 @@
 #include "main.h"
 
 #include <linux/types.h>
-
-struct batadv_ogm_packet;
+#include <uapi/linux/batadv_packet.h>
 
 void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
                                    u8 type, u8 version,
index 74b644738a36bfe063eef6df016278b45a1a0256..581f93c0e9747d2173021faa85463c57e55029cd 100644 (file)
 #include <linux/average.h>
 #include <linux/bitops.h>
 #include <linux/compiler.h>
+#include <linux/if.h>
 #include <linux/if_ether.h>
 #include <linux/kref.h>
 #include <linux/netdevice.h>
 #include <linux/netlink.h>
 #include <linux/sched.h> /* for linux/wait.h */
+#include <linux/seq_file.h>
+#include <linux/skbuff.h>
 #include <linux/spinlock.h>
+#include <linux/timer.h>
 #include <linux/types.h>
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
-struct seq_file;
-
 #ifdef CONFIG_BATMAN_ADV_DAT
 
 /**