]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
batman-adv: Allow to disable debugfs support
authorSven Eckelmann <sven@narfation.org>
Sat, 16 Jul 2016 07:31:20 +0000 (09:31 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Tue, 9 Aug 2016 05:54:54 +0000 (07:54 +0200)
The files provided by batman-adv via debugfs are currently converted to
netlink. Tools which are not yet converted to use the netlink interface may
still rely on the old debugfs files. But systems which already upgraded
their tools can save some space by disabling this feature. The default
configuration of batman-adv on amd64 can reduce the size of the module by
around 11% when this feature is disabled.

    $ size net/batman-adv/batman-adv.ko*
       text    data     bss     dec     hex filename
     150507   10395    4160  165062   284c6 net/batman-adv/batman-adv.ko.y
     137106    7099    2112  146317   23b8d net/batman-adv/batman-adv.ko.n

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
16 files changed:
net/batman-adv/Kconfig
net/batman-adv/Makefile
net/batman-adv/bat_algo.c
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_v.c
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/debugfs.h
net/batman-adv/distributed-arp-table.c
net/batman-adv/gateway_client.c
net/batman-adv/icmp_socket.h
net/batman-adv/main.c
net/batman-adv/multicast.c
net/batman-adv/network-coding.c
net/batman-adv/originator.c
net/batman-adv/translation-table.c
net/batman-adv/types.h

index 833bb145ba3ce445d585dd86b7e925d4350476c8..f20742cbae6d3d69cd959a8baa53922f3d45c356 100644 (file)
@@ -73,10 +73,21 @@ config BATMAN_ADV_MCAST
          reduce the air overhead while improving the reliability of
          multicast messages.
 
-config BATMAN_ADV_DEBUG
-       bool "B.A.T.M.A.N. debugging"
+config BATMAN_ADV_DEBUGFS
+       bool "batman-adv debugfs entries"
        depends on BATMAN_ADV
        depends on DEBUG_FS
+       default y
+       help
+         Enable this to export routing related debug tables via debugfs.
+         The information for each soft-interface and used hard-interface can be
+         found under batman_adv/
+
+         If unsure, say Y.
+
+config BATMAN_ADV_DEBUG
+       bool "B.A.T.M.A.N. debugging"
+       depends on BATMAN_ADV_DEBUGFS
        help
          This is an option for use by developers; most people should
          say N here. This enables compilation of support for
index a83fc6c58d19b1a1daece247d8501dbf9fc7a49f..f724d3c98a816d1fb437a1f371b3e04cff2341ed 100644 (file)
@@ -24,14 +24,14 @@ batman-adv-$(CONFIG_BATMAN_ADV_BATMAN_V) += bat_v_elp.o
 batman-adv-$(CONFIG_BATMAN_ADV_BATMAN_V) += bat_v_ogm.o
 batman-adv-y += bitarray.o
 batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
-batman-adv-$(CONFIG_DEBUG_FS) += debugfs.o
+batman-adv-$(CONFIG_BATMAN_ADV_DEBUGFS) += debugfs.o
 batman-adv-$(CONFIG_BATMAN_ADV_DAT) += distributed-arp-table.o
 batman-adv-y += fragmentation.o
 batman-adv-y += gateway_client.o
 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_DEBUGFS) += icmp_socket.o
 batman-adv-$(CONFIG_BATMAN_ADV_DEBUG) += log.o
 batman-adv-y += main.o
 batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o
index f2cc50d354d94ee1964ada9a15aa6ce0d2dfa787..623d04302aa2ae766bf3f608a284fb9a1b9104a7 100644 (file)
@@ -101,6 +101,7 @@ int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
        return 0;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
 {
        struct batadv_algo_ops *bat_algo_ops;
@@ -113,6 +114,7 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
 
        return 0;
 }
+#endif
 
 static int batadv_param_set_ra(const char *val, const struct kernel_param *kp)
 {
index 3c7900d543ca95b1e633e28d383a32db8fec4d3c..e2d18d0b1f06260ad69cb0d8c012ded379f582c3 100644 (file)
@@ -1855,6 +1855,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
        return NET_RX_SUCCESS;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_iv_ogm_orig_print_neigh - print neighbors for the originator table
  * @orig_node: the orig_node for which the neighbors are printed
@@ -1952,6 +1953,7 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv,
        if (batman_count == 0)
                seq_puts(seq, "No batman nodes in range ...\n");
 }
+#endif
 
 /**
  * batadv_iv_ogm_neigh_get_tq_avg - Get the TQ average for a neighbour on a
@@ -2182,6 +2184,7 @@ batadv_iv_ogm_orig_dump(struct sk_buff *msg, struct netlink_callback *cb,
        cb->args[2] = sub;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_iv_hardif_neigh_print - print a single hop neighbour node
  * @seq: neighbour table seq_file struct
@@ -2232,6 +2235,7 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv,
        if (batman_count == 0)
                seq_puts(seq, "No batman nodes in range ...\n");
 }
+#endif
 
 /**
  * batadv_iv_ogm_neigh_diff - calculate tq difference of two neighbors
@@ -2618,6 +2622,7 @@ static bool batadv_iv_gw_is_eligible(struct batadv_priv *bat_priv,
        return ret;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /* fails if orig_node has no router */
 static int batadv_iv_gw_write_buffer_text(struct batadv_priv *bat_priv,
                                          struct seq_file *seq,
@@ -2681,6 +2686,7 @@ static void batadv_iv_gw_print(struct batadv_priv *bat_priv,
        if (gw_count == 0)
                seq_puts(seq, "No gateways in range ...\n");
 }
+#endif
 
 /**
  * batadv_iv_gw_dump_entry - Dump a gateway into a message
@@ -2798,11 +2804,15 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
        .neigh = {
                .cmp = batadv_iv_ogm_neigh_cmp,
                .is_similar_or_better = batadv_iv_ogm_neigh_is_sob,
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
                .print = batadv_iv_neigh_print,
+#endif
                .dump = batadv_iv_ogm_neigh_dump,
        },
        .orig = {
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
                .print = batadv_iv_ogm_orig_print,
+#endif
                .dump = batadv_iv_ogm_orig_dump,
                .free = batadv_iv_ogm_orig_free,
                .add_if = batadv_iv_ogm_orig_add_if,
@@ -2811,7 +2821,9 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
        .gw = {
                .get_best_gw_node = batadv_iv_gw_get_best_gw_node,
                .is_eligible = batadv_iv_gw_is_eligible,
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
                .print = batadv_iv_gw_print,
+#endif
                .dump = batadv_iv_gw_dump,
        },
 };
index 9e872dcc126094b677263b32534ca40d7f3740fd..e79f6f01182eb6731927aea1bc0cba553fb600ff 100644 (file)
@@ -129,6 +129,7 @@ batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
                  batadv_v_elp_throughput_metric_update);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_v_orig_print_neigh - print neighbors for the originator table
  * @orig_node: the orig_node for which the neighbors are printed
@@ -212,6 +213,7 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv,
        if (batman_count == 0)
                seq_puts(seq, "No batman nodes in range ...\n");
 }
+#endif
 
 /**
  * batadv_v_neigh_dump_neigh - Dump a neighbour into a message
@@ -345,6 +347,7 @@ batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb,
        cb->args[1] = idx;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_v_orig_print - print the originator table
  * @bat_priv: the bat priv with all the soft interface information
@@ -411,6 +414,7 @@ static void batadv_v_orig_print(struct batadv_priv *bat_priv,
        if (batman_count == 0)
                seq_puts(seq, "No batman nodes in range ...\n");
 }
+#endif
 
 /**
  * batadv_v_orig_dump_subentry - Dump an originator subentry into a
@@ -827,6 +831,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
        return ret;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /* fails if orig_node has no router */
 static int batadv_v_gw_write_buffer_text(struct batadv_priv *bat_priv,
                                         struct seq_file *seq,
@@ -896,6 +901,7 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv,
        if (gw_count == 0)
                seq_puts(seq, "No gateways in range ...\n");
 }
+#endif
 
 /**
  * batadv_v_gw_dump_entry - Dump a gateway into a message
@@ -1034,11 +1040,15 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
                .hardif_init = batadv_v_hardif_neigh_init,
                .cmp = batadv_v_neigh_cmp,
                .is_similar_or_better = batadv_v_neigh_is_sob,
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
                .print = batadv_v_neigh_print,
+#endif
                .dump = batadv_v_neigh_dump,
        },
        .orig = {
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
                .print = batadv_v_orig_print,
+#endif
                .dump = batadv_v_orig_dump,
        },
        .gw = {
@@ -1046,7 +1056,9 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
                .show_sel_class = batadv_v_show_sel_class,
                .get_best_gw_node = batadv_v_gw_get_best_gw_node,
                .is_eligible = batadv_v_gw_is_eligible,
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
                .print = batadv_v_gw_print,
+#endif
                .dump = batadv_v_gw_dump,
        },
 };
index 1db3c12c0be0e9ff3d6132857e77f6cf35e3682e..e7f690b571ea9be8ace25843d6e187a907486b99 100644 (file)
@@ -1996,6 +1996,7 @@ bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
        return ret;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_bla_claim_table_seq_print_text - print the claim table in a seq file
  * @seq: seq file to print on
@@ -2056,6 +2057,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
                batadv_hardif_put(primary_if);
        return 0;
 }
+#endif
 
 /**
  * batadv_bla_claim_dump_entry - dump one entry of the claim table
@@ -2219,6 +2221,7 @@ int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb)
        return ret;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_bla_backbone_table_seq_print_text - print the backbone table in a seq
  *  file
@@ -2282,6 +2285,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
                batadv_hardif_put(primary_if);
        return 0;
 }
+#endif
 
 /**
  * batadv_bla_backbone_dump_entry - dump one entry of the backbone table
index 1ab4e2e63afc885d124a16d50c10707e9ab9615a..c68ff3dcb9266e6a17b9af14cda176df464fe55e 100644 (file)
@@ -26,7 +26,7 @@ struct net_device;
 
 #define BATADV_DEBUGFS_SUBDIR "batman_adv"
 
-#if IS_ENABLED(CONFIG_DEBUG_FS)
+#if IS_ENABLED(CONFIG_BATMAN_ADV_DEBUGFS)
 
 void batadv_debugfs_init(void);
 void batadv_debugfs_destroy(void);
index 059bc23da534370e7264e063020668c31e8d9329..e257efdc5d0374cdb13ad8c3282269049eeb4d16 100644 (file)
@@ -795,6 +795,7 @@ void batadv_dat_free(struct batadv_priv *bat_priv)
        batadv_dat_hash_free(bat_priv);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_dat_cache_seq_print_text - print the local DAT hash table
  * @seq: seq file to print on
@@ -846,6 +847,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
                batadv_hardif_put(primary_if);
        return 0;
 }
+#endif
 
 /**
  * batadv_arp_get_type - parse an ARP packet and gets the type
index 4b51b1cf4f767b209db3abcd2e2309fec9ebdcfe..de055d64debe4b335627ad74aeba60d6b0e4f6f2 100644 (file)
@@ -482,6 +482,7 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
        spin_unlock_bh(&bat_priv->gw.list_lock);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
 {
        struct net_device *net_dev = (struct net_device *)seq->private;
@@ -509,6 +510,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
 
        return 0;
 }
+#endif
 
 /**
  * batadv_gw_dump - Dump gateways into a message
index 618d5de06f202b8ea630c90513d88541f1503014..e44a7da51431bbae76e656f5d9055c2003896365 100644 (file)
@@ -26,9 +26,25 @@ struct batadv_icmp_header;
 
 #define BATADV_ICMP_SOCKET "socket"
 
-void batadv_socket_init(void);
 int batadv_socket_setup(struct batadv_priv *bat_priv);
+
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
+
+void batadv_socket_init(void);
 void batadv_socket_receive_packet(struct batadv_icmp_header *icmph,
                                  size_t icmp_len);
 
+#else
+
+static inline void batadv_socket_init(void)
+{
+}
+
+static inline void
+batadv_socket_receive_packet(struct batadv_icmp_header *icmph, size_t icmp_len)
+{
+}
+
+#endif
+
 #endif /* _NET_BATMAN_ADV_ICMP_SOCKET_H_ */
index ef07e5b344151aac9bb2ab858f2f1cee1e7550c5..2c017ab47557bbb57dfd996fe8cb605a833f977e 100644 (file)
@@ -282,6 +282,7 @@ bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr)
        return is_my_mac;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_seq_print_text_primary_if_get - called from debugfs table printing
  *  function that requires the primary interface
@@ -317,6 +318,7 @@ batadv_seq_print_text_primary_if_get(struct seq_file *seq)
 out:
        return primary_if;
 }
+#endif
 
 /**
  * batadv_max_header_len - calculate maximum encapsulation overhead for a
index 894df6020f6abd7bbce2e18556eb82469c2841cd..13661f43386f09f5661ae1b7444f4c56e63a3b8a 100644 (file)
@@ -1134,6 +1134,7 @@ void batadv_mcast_init(struct batadv_priv *bat_priv)
                                     BATADV_TVLV_HANDLER_OGM_CIFNOTFND);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_mcast_flags_print_header - print own mcast flags to debugfs table
  * @bat_priv: the bat priv with all the soft interface information
@@ -1234,6 +1235,7 @@ int batadv_mcast_flags_seq_print_text(struct seq_file *seq, void *offset)
 
        return 0;
 }
+#endif
 
 /**
  * batadv_mcast_free - free the multicast optimizations structures
index 165cd27777cbcb0cef2eecdda31c978264bb7285..e3baf697a35c0e1584b08361ef905a6652c6e04f 100644 (file)
@@ -1881,6 +1881,7 @@ void batadv_nc_mesh_free(struct batadv_priv *bat_priv)
        batadv_hash_destroy(bat_priv->nc.decoding_hash);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_nc_nodes_seq_print_text - print the nc node information
  * @seq: seq file to print on
@@ -1980,3 +1981,4 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
 out:
        return -ENOMEM;
 }
+#endif
index 0b7d57aad417b4f9e85b7b15ee30cce0b1bf85b4..5f3bfc41aeb1ca5e505a232a480ad5671d85265a 100644 (file)
@@ -693,6 +693,7 @@ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
        return batadv_neigh_node_create(orig_node, hard_iface, neigh_addr);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_hardif_neigh_seq_print_text - print the single hop neighbour list
  * @seq: neighbour table seq_file struct
@@ -726,6 +727,7 @@ int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset)
        bat_priv->algo_ops->neigh.print(bat_priv, seq);
        return 0;
 }
+#endif
 
 /**
  * batadv_hardif_neigh_dump - Dump to netlink the neighbor infos for a specific
@@ -1339,6 +1341,7 @@ void batadv_purge_orig_ref(struct batadv_priv *bat_priv)
        _batadv_purge_orig(bat_priv);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
 {
        struct net_device *net_dev = (struct net_device *)seq->private;
@@ -1412,6 +1415,7 @@ int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset)
                batadv_hardif_put(hard_iface);
        return 0;
 }
+#endif
 
 /**
  * batadv_orig_dump - Dump to netlink the originator infos for a specific
index d94e298fc7e2f774d61719346e18331e24630a34..7f663092f6de49831680600b2a83aedc15904bac 100644 (file)
@@ -1047,6 +1047,7 @@ static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)
        kfree(tt_data);
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 {
        struct net_device *net_dev = (struct net_device *)seq->private;
@@ -1114,6 +1115,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
                batadv_hardif_put(primary_if);
        return 0;
 }
+#endif
 
 /**
  * batadv_tt_local_dump_entry - Dump one TT local entry into a message
@@ -1796,6 +1798,7 @@ batadv_transtable_best_orig(struct batadv_priv *bat_priv,
        return best_entry;
 }
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
 /**
  * batadv_tt_global_print_entry - print all orig nodes who announce the address
  *  for this global entry
@@ -1919,6 +1922,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
                batadv_hardif_put(primary_if);
        return 0;
 }
+#endif
 
 /**
  * batadv_tt_global_dump_subentry - Dump all TT local entries into a message
index b5f01a36ec343f6872ddbb7d0681b980296f3147..b3dd1a381aad9b2bc970515a84648721be624403 100644 (file)
@@ -1431,7 +1431,9 @@ struct batadv_algo_neigh_ops {
                                     struct batadv_hard_iface *if_outgoing1,
                                     struct batadv_neigh_node *neigh2,
                                     struct batadv_hard_iface *if_outgoing2);
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
        void (*print)(struct batadv_priv *priv, struct seq_file *seq);
+#endif
        void (*dump)(struct sk_buff *msg, struct netlink_callback *cb,
                     struct batadv_priv *priv,
                     struct batadv_hard_iface *hard_iface);
@@ -1453,8 +1455,10 @@ struct batadv_algo_orig_ops {
        int (*add_if)(struct batadv_orig_node *orig_node, int max_if_num);
        int (*del_if)(struct batadv_orig_node *orig_node, int max_if_num,
                      int del_if_num);
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
        void (*print)(struct batadv_priv *priv, struct seq_file *seq,
                      struct batadv_hard_iface *hard_iface);
+#endif
        void (*dump)(struct sk_buff *msg, struct netlink_callback *cb,
                     struct batadv_priv *priv,
                     struct batadv_hard_iface *hard_iface);
@@ -1480,7 +1484,9 @@ struct batadv_algo_gw_ops {
        bool (*is_eligible)(struct batadv_priv *bat_priv,
                            struct batadv_orig_node *curr_gw_orig,
                            struct batadv_orig_node *orig_node);
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
        void (*print)(struct batadv_priv *bat_priv, struct seq_file *seq);
+#endif
        void (*dump)(struct sk_buff *msg, struct netlink_callback *cb,
                     struct batadv_priv *priv);
 };