batman-adv: Include main.h in all files
Sven Eckelmann
maintainerPATCH v3 1/6 batman-adv: Include main.h in all files
main.h includes statements which (re)define preprocessor variables which influence the compiled code. This makes it necessary to include it in all files. For example, it redefines pr_fmt used to the module as prefix for each pr_* message.
---
v3:
- no change
v2:
- never existed
--- net/batman-adv/bat_algo.h | 2 +- net/batman-adv/bat_v_ogm.h | 4 ++-- net/batman-adv/netlink.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-)
net/batman-adv/bat_algo.h +1 -1
@@ -18,7 +18,7 @@#ifndef _NET_BATMAN_ADV_BAT_ALGO_H_#define _NET_BATMAN_ADV_BAT_ALGO_H_ -struct batadv_priv ; +#include "main.h" int batadv_iv_init (void );
net/batman-adv/bat_v_ogm.h +2 -2
@@ -18,10 +18,10 @@#ifndef _BATMAN_ADV_BATADV_V_OGM_H_#define _BATMAN_ADV_BATADV_V_OGM_H_ +#include "main.h" +#include <linux/types.h> -struct batadv_hard_iface ; -struct batadv_priv ;struct sk_buff ;int batadv_v_ogm_init (struct batadv_priv *bat_priv);
net/batman-adv/netlink.h +2 -0
@@ -18,6 +18,8 @@#ifndef _NET_BATMAN_ADV_NETLINK_H_#define _NET_BATMAN_ADV_NETLINK_H_ +#include "main.h" +void batadv_netlink_register (void );void batadv_netlink_unregister (void );
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH v3 2/6 batman-adv: Keep includes ordered by filename
It is easier to detect if a include is already there for a used functionality when the includes are ordered. Using an alphabetic order together with the grouping in commit 7df620092727 ("batman-adv: Add required includes to all files") makes includes better manageable.
---
v3:
- adjusted title
v2:
- never existed
--- net/batman-adv/bat_iv_ogm.c | 2 +- net/batman-adv/gateway_common.c | 2 +- net/batman-adv/hard-interface.c | 2 +- net/batman-adv/main.h | 6 +++--- net/batman-adv/multicast.c | 2 +- net/batman-adv/netlink.c | 4 ++-- net/batman-adv/send.c | 2 +- net/batman-adv/sysfs.c | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-)
net/batman-adv/bat_iv_ogm.c +1 -1
@@ -31,8 +31,8 @@#include <linux/init.h> #include <linux/jiffies.h> #include <linux/kernel.h> -#include <linux/list.h> #include <linux/kref.h> +#include <linux/list.h> #include <linux/lockdep.h> #include <linux/netdevice.h> #include <linux/pkt_sched.h>
net/batman-adv/gateway_common.c +1 -1
@@ -19,8 +19,8 @@#include "main.h" #include <linux/atomic.h> -#include <linux/errno.h> #include <linux/byteorder/generic.h> +#include <linux/errno.h> #include <linux/kernel.h> #include <linux/math64.h> #include <linux/netdevice.h>
net/batman-adv/hard-interface.c +1 -1
@@ -23,9 +23,9 @@#include <linux/byteorder/generic.h> #include <linux/errno.h> #include <linux/fs.h> +#include <linux/if.h> #include <linux/if_arp.h> #include <linux/if_ether.h> -#include <linux/if.h> #include <linux/kernel.h> #include <linux/kref.h> #include <linux/list.h>
net/batman-adv/main.h +3 -3
@@ -181,12 +181,12 @@ enum batadv_uev_type {#include <linux/cpumask.h> #include <linux/etherdevice.h> #include <linux/if_ether.h> /* for packet.h */ +#include <linux/if_vlan.h> +#include <linux/jiffies.h> #include <linux/netdevice.h> +#include <linux/percpu.h> #include <linux/printk.h> #include <linux/types.h> -#include <linux/percpu.h> -#include <linux/jiffies.h> -#include <linux/if_vlan.h> #include "types.h"
net/batman-adv/multicast.c +1 -1
@@ -29,8 +29,8 @@#include <linux/if_bridge.h> #include <linux/if_ether.h> #include <linux/igmp.h> -#include <linux/in6.h> #include <linux/in.h> +#include <linux/in6.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/kernel.h>
net/batman-adv/netlink.c +2 -2
@@ -15,8 +15,8 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#include "main.h" #include "netlink.h" +#include "main.h" #include <linux/errno.h> #include <linux/fs.h>
@@ -25,8 +25,8 @@#include <linux/init.h> #include <linux/netdevice.h> #include <linux/netlink.h> -#include <linux/stddef.h> #include <linux/printk.h> +#include <linux/stddef.h> #include <net/genetlink.h> #include <net/netlink.h> #include <uapi/linux/batman_adv.h>
net/batman-adv/send.c +1 -1
@@ -22,8 +22,8 @@#include <linux/byteorder/generic.h> #include <linux/etherdevice.h> #include <linux/fs.h> -#include <linux/if_ether.h> #include <linux/if.h> +#include <linux/if_ether.h> #include <linux/jiffies.h> #include <linux/kernel.h> #include <linux/kref.h>
net/batman-adv/sysfs.c +2 -2
@@ -25,8 +25,8 @@#include <linux/fs.h> #include <linux/if.h> #include <linux/if_vlan.h> -#include <linux/kref.h> #include <linux/kernel.h> +#include <linux/kref.h> #include <linux/netdevice.h> #include <linux/printk.h> #include <linux/rculist.h>
@@ -38,10 +38,10 @@#include <linux/string.h> #include <linux/stringify.h> +#include "bridge_loop_avoidance.h" #include "distributed-arp-table.h" #include "gateway_client.h" #include "gateway_common.h" -#include "bridge_loop_avoidance.h" #include "hard-interface.h" #include "network-coding.h" #include "packet.h"
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH v3 3/6 batman-adv: split tvlv into a separate file
In reply to Sven EckelmannFrom: Markus Pargmann <[email protected]>
The tvlv functionality in main.c is mostly unrelated to the rest of the content. It still takes up a large portion of this source file (~45%, 588 lines). Moving it to a separate file makes it better visible as a main component of the batman-adv implementation and hides it less in the other helper functions in main.c
[[email protected]: fix conflicts with current version, fix includes, rewrote commit message]
---
v3:
- Patch was resurrected from https://patchwork.open-mesh.org/patch/4244/
- rewrote commit message
- fixed conflicts
- fixed includes
--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/distributed-arp-table.c | 1 + net/batman-adv/gateway_common.c | 1 + net/batman-adv/main.c | 591 ------------------------------- net/batman-adv/main.h | 34 -- net/batman-adv/multicast.c | 1 + net/batman-adv/network-coding.c | 1 + net/batman-adv/routing.c | 1 + net/batman-adv/translation-table.c | 1 + net/batman-adv/tvlv.c | 630 +++++++++++++++++++++++++++++++++ net/batman-adv/tvlv.h | 61 ++++ 13 files changed, 700 insertions(+), 625 deletions(-) create mode 100644 net/batman-adv/tvlv.c create mode 100644 net/batman-adv/tvlv.h
net/batman-adv/Makefile +1 -0
@@ -41,3 +41,4 @@ batman-adv-y += send.o batman-adv-y += soft-interface.o batman-adv-y += sysfs.o batman-adv-y += translation-table.o +batman-adv-y += tvlv.o
net/batman-adv/bat_iv_ogm.c +1 -0
@@ -58,6 +58,7 @@#include "routing.h" #include "send.h" #include "translation-table.h" +#include "tvlv.h" static void batadv_iv_send_outstanding_bat_ogm_packet (struct work_struct *work);
net/batman-adv/bat_v_ogm.c +1 -0
@@ -46,6 +46,7 @@#include "routing.h" #include "send.h" #include "translation-table.h" +#include "tvlv.h" /** * batadv_v_ogm_orig_get - retrieve and possibly create an originator node
net/batman-adv/distributed-arp-table.c +1 -0
@@ -48,6 +48,7 @@#include "originator.h" #include "send.h" #include "translation-table.h" +#include "tvlv.h" static void batadv_dat_purge (struct work_struct *work);
net/batman-adv/gateway_common.c +1 -0
@@ -29,6 +29,7 @@#include "gateway_client.h" #include "packet.h" +#include "tvlv.h" /** * batadv_parse_throughput - parse supplied string buffer to extract throughput
net/batman-adv/main.c +0 -591
610 lines not on this page · raw message
net/batman-adv/main.h +0 -34
@@ -190,7 +190,6 @@ enum batadv_uev_type {#include "types.h" -struct batadv_ogm_packet ;struct seq_file ;struct sk_buff ;
@@ -372,39 +371,6 @@ static inline u64 batadv_sum_counter(struct batadv_priv *bat_priv, size_t idx)*/ #define BATADV_SKB_CB (__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0])) -void batadv_tvlv_container_register (struct batadv_priv *bat_priv, -u8 type,u8 version, -void *tvlv_value,u16 tvlv_value_len); -u16 batadv_tvlv_container_ogm_append (struct batadv_priv *bat_priv, -unsigned char **packet_buff, -int *packet_buff_len,int packet_min_len); -void batadv_tvlv_ogm_receive (struct batadv_priv *bat_priv, -struct batadv_ogm_packet *batadv_ogm_packet, -struct batadv_orig_node *orig_node); -void batadv_tvlv_container_unregister (struct batadv_priv *bat_priv, -u8 type,u8 version); - -void batadv_tvlv_handler_register (struct batadv_priv *bat_priv, -void (*optr)(struct batadv_priv *bat_priv, -struct batadv_orig_node *orig, -u8 flags, -void *tvlv_value, -u16 tvlv_value_len), -int (*uptr)(struct batadv_priv *bat_priv, -u8 *src,u8 *dst, -void *tvlv_value, -u16 tvlv_value_len), -u8 type,u8 version,u8 flags); -void batadv_tvlv_handler_unregister (struct batadv_priv *bat_priv, -u8 type,u8 version); -int batadv_tvlv_containers_process (struct batadv_priv *bat_priv, -bool ogm_source, -struct batadv_orig_node *orig_node, -u8 *src,u8 *dst, -void *tvlv_buff,u16 tvlv_buff_len); -void batadv_tvlv_unicast_send (struct batadv_priv *bat_priv,u8 *src, -u8 *dst,u8 type,u8 version, -void *tvlv_value,u16 tvlv_value_len);unsigned short batadv_get_vid (struct sk_buff *skb,size_t header_len);bool batadv_vlan_ap_isola_get (struct batadv_priv *bat_priv,unsigned short vid);
net/batman-adv/multicast.c +1 -0
@@ -57,6 +57,7 @@#include "hash.h" #include "packet.h" #include "translation-table.h" +#include "tvlv.h" /** * batadv_mcast_get_bridge - get the bridge on top of the softif if it exists
net/batman-adv/network-coding.c +1 -0
@@ -55,6 +55,7 @@#include "packet.h" #include "routing.h" #include "send.h" +#include "tvlv.h" static struct lock_class_key batadv_nc_coding_hash_lock_class_key;static struct lock_class_key batadv_nc_decoding_hash_lock_class_key;
net/batman-adv/routing.c +1 -0
@@ -46,6 +46,7 @@#include "send.h" #include "soft-interface.h" #include "translation-table.h" +#include "tvlv.h" static int batadv_route_unicast_packet (struct sk_buff *skb,struct batadv_hard_iface *recv_if);
net/batman-adv/translation-table.c +1 -0
@@ -51,6 +51,7 @@#include "originator.h" #include "packet.h" #include "soft-interface.h" +#include "tvlv.h" /* hash class keys */ static struct lock_class_key batadv_tt_local_hash_lock_class_key;
net/batman-adv/tvlv.c new file +630 -0
630 lines not on this page · raw message
net/batman-adv/tvlv.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH v3 4/6 batman-adv: move bat_algo functions into a separate file
In reply to Sven EckelmannThe bat_algo functionality in main.c is mostly unrelated to the rest of the content. It still takes up a large portion of this source file (~15%, 103 lines). Moving it to a separate file makes it better visible as a main component of the batman-adv implementation and hides it less in the other helper functions in main.c.
---
v3:
- introduce this patch
--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_algo.c | 140 +++++++++++++++++++++++++++++++++++++ net/batman-adv/bat_algo.h | 12 ++++ net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/debugfs.c | 1 + net/batman-adv/main.c | 105 +--------------------------- net/batman-adv/main.h | 4 -- net/batman-adv/originator.c | 1 + net/batman-adv/routing.c | 1 + net/batman-adv/soft-interface.c | 1 + net/batman-adv/translation-table.c | 1 + 11 files changed, 160 insertions(+), 108 deletions(-) create mode 100644 net/batman-adv/bat_algo.c
net/batman-adv/Makefile +1 -0
@@ -17,6 +17,7 @@ # obj-$(CONFIG_BATMAN_ADV) += batman-adv.o +batman-adv-y += bat_algo.o batman-adv-y += bat_iv_ogm.o batman-adv-$(CONFIG_BATMAN_ADV_BATMAN_V) += bat_v.o batman-adv-$(CONFIG_BATMAN_ADV_BATMAN_V) += bat_v_elp.o
net/batman-adv/bat_algo.c new file +140 -0
140 lines not on this page · raw message
net/batman-adv/bat_algo.h +12 -0
@@ -20,8 +20,20 @@#include "main.h" +#include <linux/types.h> + +struct seq_file ; +int batadv_iv_init (void ); +extern char batadv_routing_algo[]; +extern struct list_head batadv_hardif_list; + +void batadv_algo_init (void ); +int batadv_algo_register (struct batadv_algo_ops *bat_algo_ops); +int batadv_algo_select (struct batadv_priv *bat_priv,char *name); +int batadv_algo_seq_print_text (struct seq_file *seq,void *offset); +#ifdef CONFIG_BATMAN_ADV_BATMAN_V int batadv_v_init (void );
net/batman-adv/bat_v_ogm.c +1 -0
@@ -39,6 +39,7 @@#include <linux/types.h> #include <linux/workqueue.h> +#include "bat_algo.h" #include "hard-interface.h" #include "hash.h" #include "originator.h"
net/batman-adv/debugfs.c +1 -0
@@ -44,6 +44,7 @@#include <linux/wait.h> #include <stdarg.h> +#include "bat_algo.h" #include "bridge_loop_avoidance.h" #include "distributed-arp-table.h" #include "gateway_client.h"
net/batman-adv/main.c +1 -104
135 lines not on this page · raw message
net/batman-adv/main.h +0 -4
@@ -196,7 +196,6 @@ struct sk_buff;#define BATADV_PRINT_VID (vid) ((vid & BATADV_VLAN_HAS_TAG) ? \ (int)(vid & VLAN_VID_MASK) : -1) -extern char batadv_routing_algo[];extern struct list_head batadv_hardif_list;extern unsigned char batadv_broadcast_addr[];
@@ -217,9 +216,6 @@ batadv_recv_handler_register(u8 packet_type,int (*recv_handler)(struct sk_buff *, struct batadv_hard_iface *));void batadv_recv_handler_unregister (u8 packet_type); -int batadv_algo_register (struct batadv_algo_ops *bat_algo_ops); -int batadv_algo_select (struct batadv_priv *bat_priv,char *name); -int batadv_algo_seq_print_text (struct seq_file *seq,void *offset);__be32 batadv_skb_crc32 (struct sk_buff *skb,u8 *payload_ptr);/**
net/batman-adv/originator.c +1 -0
@@ -34,6 +34,7 @@#include <linux/spinlock.h> #include <linux/workqueue.h> +#include "bat_algo.h" #include "distributed-arp-table.h" #include "fragmentation.h" #include "gateway_client.h"
net/batman-adv/routing.c +1 -0
@@ -34,6 +34,7 @@#include <linux/spinlock.h> #include <linux/stddef.h> +#include "bat_algo.h" #include "bitarray.h" #include "bridge_loop_avoidance.h" #include "distributed-arp-table.h"
net/batman-adv/soft-interface.c +1 -0
@@ -48,6 +48,7 @@#include <linux/types.h> #include <linux/workqueue.h> +#include "bat_algo.h" #include "bridge_loop_avoidance.h" #include "debugfs.h" #include "distributed-arp-table.h"
net/batman-adv/translation-table.c +1 -0
@@ -44,6 +44,7 @@#include <linux/string.h> #include <linux/workqueue.h> +#include "bat_algo.h" #include "bridge_loop_avoidance.h" #include "hard-interface.h" #include "hash.h"
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH v3 5/6 batman-adv: Consolidate logging related functions
In reply to Sven EckelmannThere are several places in batman-adv which provide logging related functions. These should be grouped together in the log.* files to make them easier to find.
---
v3:
- introduce this patch
--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v_elp.c | 1 + net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/bitarray.c | 2 + net/batman-adv/bridge_loop_avoidance.c | 1 + net/batman-adv/debugfs.c | 216 +----------------------------- net/batman-adv/distributed-arp-table.c | 1 + net/batman-adv/gateway_client.c | 1 + net/batman-adv/gateway_common.c | 1 + net/batman-adv/hard-interface.c | 1 + net/batman-adv/icmp_socket.c | 1 + net/batman-adv/log.c | 231 +++++++++++++++++++++++++++++++++ net/batman-adv/log.h | 109 ++++++++++++++++ net/batman-adv/main.c | 2 + net/batman-adv/main.h | 69 +--------- net/batman-adv/multicast.c | 1 + net/batman-adv/network-coding.c | 1 + net/batman-adv/originator.c | 1 + net/batman-adv/routing.c | 1 + net/batman-adv/send.c | 1 + net/batman-adv/sysfs.c | 1 + net/batman-adv/translation-table.c | 1 + 23 files changed, 364 insertions(+), 282 deletions(-) create mode 100644 net/batman-adv/log.c create mode 100644 net/batman-adv/log.h
net/batman-adv/Makefile +1 -0
@@ -32,6 +32,7 @@ batman-adv-y += gateway_common.o batman-adv-y += hard-interface.o batman-adv-y += hash.o batman-adv-y += icmp_socket.o +batman-adv-$(CONFIG_BATMAN_ADV_DEBUG) += log.o batman-adv-y += main.o batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o batman-adv-y += netlink.o
net/batman-adv/bat_iv_ogm.c +1 -0
@@ -52,6 +52,7 @@#include "bitarray.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "network-coding.h" #include "originator.h" #include "packet.h"
net/batman-adv/bat_v_elp.c +1 -0
@@ -43,6 +43,7 @@#include "bat_algo.h" #include "bat_v_ogm.h" #include "hard-interface.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/bat_v_ogm.c +1 -0
@@ -42,6 +42,7 @@#include "bat_algo.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/bitarray.c +2 -0
@@ -20,6 +20,8 @@#include <linux/bitmap.h> +#include "log.h" +/* shift the packet array by n places. */ static void batadv_bitmap_shift_left (unsigned long *seq_bits,s32 n) {
net/batman-adv/bridge_loop_avoidance.c +1 -0
@@ -48,6 +48,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "sysfs.h"
net/batman-adv/debugfs.c +1 -215
247 lines not on this page · raw message
net/batman-adv/distributed-arp-table.c +1 -0
@@ -45,6 +45,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "send.h" #include "translation-table.h"
net/batman-adv/gateway_client.c +1 -0
@@ -42,6 +42,7 @@#include "gateway_common.h" #include "hard-interface.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/gateway_common.c +1 -0
@@ -28,6 +28,7 @@#include <linux/string.h> #include "gateway_client.h" +#include "log.h" #include "packet.h" #include "tvlv.h"
net/batman-adv/hard-interface.c +1 -0
@@ -41,6 +41,7 @@#include "debugfs.h" #include "distributed-arp-table.h" #include "gateway_client.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "send.h"
net/batman-adv/icmp_socket.c +1 -0
@@ -45,6 +45,7 @@#include <linux/wait.h> #include "hard-interface.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "send.h"
net/batman-adv/log.c new file +231 -0
231 lines not on this page · raw message
net/batman-adv/log.h new file +109 -0
109 lines not on this page · raw message
net/batman-adv/main.c +2 -0
@@ -33,6 +33,7 @@#include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> +#include <linux/printk.h> #include <linux/rculist.h> #include <linux/rcupdate.h> #include <linux/seq_file.h>
@@ -52,6 +53,7 @@#include "gateway_common.h" #include "hard-interface.h" #include "icmp_socket.h" +#include "log.h" #include "multicast.h" #include "netlink.h" #include "network-coding.h"
net/batman-adv/main.h +2 -67
92 lines not on this page · raw message
net/batman-adv/multicast.c +1 -0
@@ -55,6 +55,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "packet.h" #include "translation-table.h" #include "tvlv.h"
net/batman-adv/network-coding.c +1 -0
@@ -51,6 +51,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/originator.c +1 -0
@@ -40,6 +40,7 @@#include "gateway_client.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "multicast.h" #include "network-coding.h" #include "routing.h"
net/batman-adv/routing.c +1 -0
@@ -41,6 +41,7 @@#include "fragmentation.h" #include "hard-interface.h" #include "icmp_socket.h" +#include "log.h" #include "network-coding.h" #include "originator.h" #include "packet.h"
net/batman-adv/send.c +1 -0
@@ -42,6 +42,7 @@#include "fragmentation.h" #include "gateway_client.h" #include "hard-interface.h" +#include "log.h" #include "network-coding.h" #include "originator.h" #include "routing.h"
net/batman-adv/sysfs.c +1 -0
@@ -43,6 +43,7 @@#include "gateway_client.h" #include "gateway_common.h" #include "hard-interface.h" +#include "log.h" #include "network-coding.h" #include "packet.h" #include "soft-interface.h"
net/batman-adv/translation-table.c +1 -0
@@ -48,6 +48,7 @@#include "bridge_loop_avoidance.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "multicast.h" #include "originator.h" #include "packet.h"
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH v3 6/6 batman-adv: Fix bat_(iv|v) function declaration header
In reply to Sven EckelmannThe bat_algo.h had some functions declared which were not part of the bat_algo.c file. These are instead stored in bat_v.c and bat_iv_ogm.c. The declaration should therefore be also in bat_v.h and bat_iv_ogm,h to make them easier to find.
---
v3:
- introduce this patch
--- net/batman-adv/bat_algo.h | 26 --------------------- net/batman-adv/bat_iv_ogm.c | 3 ++- net/batman-adv/bat_iv_ogm.h | 25 ++++++++++++++++++++ net/batman-adv/bat_v.c | 3 ++- net/batman-adv/bat_v.h | 47 ++++++++++++++++++++++++++++++++++++++ net/batman-adv/main.c | 2 ++ net/batman-adv/routing.c | 1 - net/batman-adv/translation-table.c | 1 - 8 files changed, 78 insertions(+), 30 deletions(-) create mode 100644 net/batman-adv/bat_iv_ogm.h create mode 100644 net/batman-adv/bat_v.h
net/batman-adv/bat_algo.h +0 -26
@@ -24,8 +24,6 @@struct seq_file ; -int batadv_iv_init (void ); -extern char batadv_routing_algo[];extern struct list_head batadv_hardif_list;
@@ -34,28 +32,4 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops);int batadv_algo_select (struct batadv_priv *bat_priv,char *name);int batadv_algo_seq_print_text (struct seq_file *seq,void *offset); -#ifdef CONFIG_BATMAN_ADV_BATMAN_V - -int batadv_v_init (void ); -int batadv_v_mesh_init (struct batadv_priv *bat_priv); -void batadv_v_mesh_free (struct batadv_priv *bat_priv); - -#else - -static inline int batadv_v_init (void ) -{ -return 0 ; -} - -static inline int batadv_v_mesh_init (struct batadv_priv *bat_priv) -{ -return 0 ; -} - -static inline void batadv_v_mesh_free (struct batadv_priv *bat_priv) -{ -} - -#endif /* CONFIG_BATMAN_ADV_BATMAN_V */ -#endif /* _NET_BATMAN_ADV_BAT_ALGO_H_ */
net/batman-adv/bat_iv_ogm.c +2 -1
@@ -15,7 +15,7 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#include "bat_algo.h" +#include "bat_iv_ogm.h" #include "main.h" #include <linux/atomic.h>
@@ -49,6 +49,7 @@#include <linux/types.h> #include <linux/workqueue.h> +#include "bat_algo.h" #include "bitarray.h" #include "hard-interface.h" #include "hash.h"
net/batman-adv/bat_iv_ogm.h new file +25 -0
@@ -0,0 +1,25 @@ +/* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: +* +* Marek Lindner, Simon Wunderlich +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of version 2 of the GNU General Public +* License as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _BATMAN_ADV_BATADV_IV_OGM_H_ +#define _BATMAN_ADV_BATADV_IV_OGM_H_ + +#include "main.h" + +int batadv_iv_init (void ); + +#endif /* _BATMAN_ADV_BATADV_IV_OGM_H_ */
net/batman-adv/bat_v.c +2 -1
@@ -15,7 +15,7 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#include "bat_algo.h" +#include "bat_v.h" #include "main.h" #include <linux/bug.h>
@@ -30,6 +30,7 @@#include <linux/types.h> #include <linux/workqueue.h> +#include "bat_algo.h" #include "bat_v_elp.h" #include "bat_v_ogm.h" #include "hard-interface.h"
net/batman-adv/bat_v.h new file +47 -0
47 lines not on this page · raw message
net/batman-adv/main.c +2 -0
@@ -46,6 +46,8 @@#include <net/rtnetlink.h> #include "bat_algo.h" +#include "bat_iv_ogm.h" +#include "bat_v.h" #include "bridge_loop_avoidance.h" #include "debugfs.h" #include "distributed-arp-table.h"
net/batman-adv/routing.c +0 -1
@@ -34,7 +34,6 @@#include <linux/spinlock.h> #include <linux/stddef.h> -#include "bat_algo.h" #include "bitarray.h" #include "bridge_loop_avoidance.h" #include "distributed-arp-table.h"
net/batman-adv/translation-table.c +0 -1
@@ -44,7 +44,6 @@#include <linux/string.h> #include <linux/workqueue.h> -#include "bat_algo.h" #include "bridge_loop_avoidance.h" #include "hard-interface.h" #include "hash.h"
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH 1/1 batman-adv: Consolidate logging related functions
In reply to Sven EckelmannThere are several places in batman-adv which provide logging related functions. These should be grouped together in the log.* files to make them easier to find.
---
v4:
- remove linux/kernel.h
v3:
- introduce this patch
--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v_elp.c | 1 + net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/bitarray.c | 2 + net/batman-adv/bridge_loop_avoidance.c | 1 + net/batman-adv/debugfs.c | 216 +------------------------------ net/batman-adv/distributed-arp-table.c | 1 + net/batman-adv/gateway_client.c | 1 + net/batman-adv/gateway_common.c | 1 + net/batman-adv/hard-interface.c | 1 + net/batman-adv/icmp_socket.c | 1 + net/batman-adv/log.c | 230 +++++++++++++++++++++++++++++++++ net/batman-adv/log.h | 109 ++++++++++++++++ net/batman-adv/main.c | 2 + net/batman-adv/main.h | 69 +--------- net/batman-adv/multicast.c | 1 + net/batman-adv/network-coding.c | 1 + net/batman-adv/originator.c | 1 + net/batman-adv/routing.c | 1 + net/batman-adv/send.c | 1 + net/batman-adv/sysfs.c | 1 + net/batman-adv/translation-table.c | 1 + 23 files changed, 363 insertions(+), 282 deletions(-) create mode 100644 net/batman-adv/log.c create mode 100644 net/batman-adv/log.h
net/batman-adv/Makefile +1 -0
@@ -32,6 +32,7 @@ batman-adv-y += gateway_common.o batman-adv-y += hard-interface.o batman-adv-y += hash.o batman-adv-y += icmp_socket.o +batman-adv-$(CONFIG_BATMAN_ADV_DEBUG) += log.o batman-adv-y += main.o batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o batman-adv-y += netlink.o
net/batman-adv/bat_iv_ogm.c +1 -0
@@ -52,6 +52,7 @@#include "bitarray.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "network-coding.h" #include "originator.h" #include "packet.h"
net/batman-adv/bat_v_elp.c +1 -0
@@ -43,6 +43,7 @@#include "bat_algo.h" #include "bat_v_ogm.h" #include "hard-interface.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/bat_v_ogm.c +1 -0
@@ -42,6 +42,7 @@#include "bat_algo.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/bitarray.c +2 -0
@@ -20,6 +20,8 @@#include <linux/bitmap.h> +#include "log.h" +/* shift the packet array by n places. */ static void batadv_bitmap_shift_left (unsigned long *seq_bits,s32 n) {
net/batman-adv/bridge_loop_avoidance.c +1 -0
@@ -48,6 +48,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "sysfs.h"
net/batman-adv/debugfs.c +1 -215
247 lines not on this page · raw message
net/batman-adv/distributed-arp-table.c +1 -0
@@ -45,6 +45,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "send.h" #include "translation-table.h"
net/batman-adv/gateway_client.c +1 -0
@@ -42,6 +42,7 @@#include "gateway_common.h" #include "hard-interface.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/gateway_common.c +1 -0
@@ -28,6 +28,7 @@#include <linux/string.h> #include "gateway_client.h" +#include "log.h" #include "packet.h" #include "tvlv.h"
net/batman-adv/hard-interface.c +1 -0
@@ -41,6 +41,7 @@#include "debugfs.h" #include "distributed-arp-table.h" #include "gateway_client.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "send.h"
net/batman-adv/icmp_socket.c +1 -0
@@ -45,6 +45,7 @@#include <linux/wait.h> #include "hard-interface.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "send.h"
net/batman-adv/log.c new file +230 -0
230 lines not on this page · raw message
net/batman-adv/log.h new file +109 -0
109 lines not on this page · raw message
net/batman-adv/main.c +2 -0
@@ -33,6 +33,7 @@#include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h> +#include <linux/printk.h> #include <linux/rculist.h> #include <linux/rcupdate.h> #include <linux/seq_file.h>
@@ -52,6 +53,7 @@#include "gateway_common.h" #include "hard-interface.h" #include "icmp_socket.h" +#include "log.h" #include "multicast.h" #include "netlink.h" #include "network-coding.h"
net/batman-adv/main.h +2 -67
92 lines not on this page · raw message
net/batman-adv/multicast.c +1 -0
@@ -55,6 +55,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "packet.h" #include "translation-table.h" #include "tvlv.h"
net/batman-adv/network-coding.c +1 -0
@@ -51,6 +51,7 @@#include "hard-interface.h" #include "hash.h" +#include "log.h" #include "originator.h" #include "packet.h" #include "routing.h"
net/batman-adv/originator.c +1 -0
@@ -40,6 +40,7 @@#include "gateway_client.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "multicast.h" #include "network-coding.h" #include "routing.h"
net/batman-adv/routing.c +1 -0
@@ -41,6 +41,7 @@#include "fragmentation.h" #include "hard-interface.h" #include "icmp_socket.h" +#include "log.h" #include "network-coding.h" #include "originator.h" #include "packet.h"
net/batman-adv/send.c +1 -0
@@ -42,6 +42,7 @@#include "fragmentation.h" #include "gateway_client.h" #include "hard-interface.h" +#include "log.h" #include "network-coding.h" #include "originator.h" #include "routing.h"
net/batman-adv/sysfs.c +1 -0
@@ -43,6 +43,7 @@#include "gateway_client.h" #include "gateway_common.h" #include "hard-interface.h" +#include "log.h" #include "network-coding.h" #include "packet.h" #include "soft-interface.h"
net/batman-adv/translation-table.c +1 -0
@@ -48,6 +48,7 @@#include "bridge_loop_avoidance.h" #include "hard-interface.h" #include "hash.h" +#include "log.h" #include "multicast.h" #include "originator.h" #include "packet.h"
Marek Lindner
AppliedQuoted 12 lines · On Sunday, May 15, 2016 11:07:41 Sven Eckelmann wrote:
main.hincludes statements which (re)define preprocessor variables which influence the compiled code. This makes it necessary to include it in all files. For example, it redefinespr_fmtused to the module as prefix for each pr_* message.Reported-by Antonio Quartulli <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>---
v3:
- no change
v2:
- never existed
Quoted 5 lines
--- net/batman-adv/bat_algo.h | 2 +- net/batman-adv/bat_v_ogm.h | 4 ++-- net/batman-adv/netlink.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-)
Applied in revision 97d45f9.
Thanks,
Marek
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v3 2/6] batman-adv: Keep includes ordered by filename
In reply to Sven EckelmannQuoted 11 lines · On Sunday, May 15, 2016 11:07:42 Sven Eckelmann wrote:
It is easier to detect if a include is already there for a used functionality when the includes are ordered. Using an alphabetic order together with the grouping in commit
7df620092727("batman-adv: Add required includes to all files") makes includes better manageable.Signed-off-by Sven Eckelmann <[email protected]>---
v3:
- adjusted title
v2:
- never existed
Quoted 10 lines
--- net/batman-adv/bat_iv_ogm.c | 2 +- net/batman-adv/gateway_common.c | 2 +- net/batman-adv/hard-interface.c | 2 +- net/batman-adv/main.h | 6 +++--- net/batman-adv/multicast.c | 2 +- net/batman-adv/netlink.c | 4 ++-- net/batman-adv/send.c | 2 +- net/batman-adv/sysfs.c | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-)
Applied in revision b87df5f.
Thanks,
Marek
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v3 3/6] batman-adv: split tvlv into a separate file
In reply to Sven EckelmannQuoted 29 lines · On Sunday, May 15, 2016 11:07:43 Sven Eckelmann wrote:
From: Markus Pargmann <[email protected]>
The tvlv functionality in
main.cis mostly unrelated to the rest of the content. It still takes up a large portion of this source file (~45%, 588 lines). Moving it to a separate file makes it better visible as a main component of the batman-adv implementation and hides it less in the other helper functions inmain.cSigned-off-by Markus Pargmann <[email protected]>[[email protected]: fix conflicts with current version, fix includes, rewrote commit message]
Signed-off-by Sven Eckelmann <[email protected]>---
v3:
- Patch was resurrected from https://patchwork.open-mesh.org/patch/4244/
- rewrote commit message
- fixed conflicts
- fixed includes--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/distributed-arp-table.c | 1 + net/batman-adv/gateway_common.c | 1 + net/batman-adv/main.c | 591 ------------------------------- net/batman-adv/main.h | 34 -- net/batman-adv/multicast.c | 1 + net/batman-adv/network-coding.c | 1 +
Quoted 8 lines
net/batman-adv/routing.c | 1 + net/batman-adv/translation-table.c | 1 + net/batman-adv/tvlv.c | 630 +++++++++++++++++++++++++++++++++ net/batman-adv/tvlv.h | 61 ++++ 13 files changed, 700 insertions(+), 625 deletions(-) create mode 100644 net/batman-adv/tvlv.c create mode 100644 net/batman-adv/tvlv.h
Applied in revision 65326e3.
Thanks,
Marek
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v3 4/6] batman-adv: move bat_algo functions into a separate file
In reply to Sven EckelmannQuoted 10 lines · On Sunday, May 15, 2016 11:07:44 Sven Eckelmann wrote:
The
bat_algofunctionality inmain.cis mostly unrelated to the rest of the content. It still takes up a large portion of this source file (~15%, 103 lines). Moving it to a separate file makes it better visible as a main component of the batman-adv implementation and hides it less in the other helper functions inmain.c.Signed-off-by Sven Eckelmann <[email protected]>---
v3:
- introduce this patch
Quoted 15 lines
--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_algo.c | 140 +++++++++++++++++++++++++++++++++++++ net/batman-adv/bat_algo.h | 12 ++++ net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/debugfs.c | 1 + net/batman-adv/main.c | 105 +--------------------------- net/batman-adv/main.h | 4 -- net/batman-adv/originator.c | 1 + net/batman-adv/routing.c | 1 + net/batman-adv/soft-interface.c | 1 + net/batman-adv/translation-table.c | 1 + 11 files changed, 160 insertions(+), 108 deletions(-) create mode 100644 net/batman-adv/bat_algo.c
Applied in revision c14a11a.
Thanks,
Marek
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH] batman-adv: Consolidate logging related functions
In reply to Sven EckelmannQuoted 32 lines · On Sunday, May 15, 2016 23:48:31 Sven Eckelmann wrote:
There are several places in batman-adv which provide logging related functions. These should be grouped together in the log.* files to make them easier to find.
Reported-by Markus Pargmann <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>---
v4:
- removelinux/kernel.h
v3:
- introduce this patch--- net/batman-adv/Makefile | 1 + net/batman-adv/bat_iv_ogm.c | 1 + net/batman-adv/bat_v_elp.c | 1 + net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/bitarray.c | 2 + net/batman-adv/bridge_loop_avoidance.c | 1 + net/batman-adv/debugfs.c | 216 +------------------------------ net/batman-adv/distributed-arp-table.c | 1 + net/batman-adv/gateway_client.c | 1 + net/batman-adv/gateway_common.c | 1 + net/batman-adv/hard-interface.c | 1 + net/batman-adv/icmp_socket.c | 1 + net/batman-adv/log.c | 230 +++++++++++++++++++++++++++++++++ net/batman-adv/log.h | 109 ++++++++++++++++ net/batman-adv/main.c | 2 + net/batman-adv/main.h | 69 +--------- net/batman-adv/multicast.c | 1 + net/batman-adv/network-coding.c | 1 +
Quoted 8 lines
net/batman-adv/originator.c | 1 + net/batman-adv/routing.c | 1 + net/batman-adv/send.c | 1 + net/batman-adv/sysfs.c | 1 + net/batman-adv/translation-table.c | 1 + 23 files changed, 363 insertions(+), 282 deletions(-) create mode 100644 net/batman-adv/log.c create mode 100644 net/batman-adv/log.h
Applied in revision 421d988.
Thanks,
Marek
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v3 6/6] batman-adv: Fix bat_(iv|v) function declaration header
In reply to Sven EckelmannQuoted 9 lines · On Sunday, May 15, 2016 11:07:46 Sven Eckelmann wrote:
The
bat_algo.hhad some functions declared which were not part of thebat_algo.cfile. These are instead stored inbat_v.candbat_iv_ogm.c. The declaration should therefore be also inbat_v.hand bat_iv_ogm,h to make them easier to find.Signed-off-by Sven Eckelmann <[email protected]>---
v3:
- introduce this patch
Quoted 13 lines
--- net/batman-adv/bat_algo.h | 26 --------------------- net/batman-adv/bat_iv_ogm.c | 3 ++- net/batman-adv/bat_iv_ogm.h | 25 ++++++++++++++++++++ net/batman-adv/bat_v.c | 3 ++- net/batman-adv/bat_v.h | 47 ++++++++++++++++++++++++++++++++++++++ net/batman-adv/main.c | 2 ++ net/batman-adv/routing.c | 1 - net/batman-adv/translation-table.c | 1 - 8 files changed, 78 insertions(+), 30 deletions(-) create mode 100644 net/batman-adv/bat_iv_ogm.h create mode 100644 net/batman-adv/bat_v.h
Applied in revision 1373a7e.
Thanks,
Marek