Skip to content

Commit

Permalink
batman-adv: Add kernel-doc to externally visible functions
Browse files Browse the repository at this point in the history
According to the kernel-doc documentation, externally visible functions
should be documented. This refers to all all non-static function which can
(and will) be used by functions in other sources files.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
  • Loading branch information
ecsv authored and simonwunderlich committed Dec 15, 2017
1 parent e57acf8 commit ff15c27
Show file tree
Hide file tree
Showing 16 changed files with 381 additions and 3 deletions.
27 changes: 27 additions & 0 deletions net/batman-adv/bat_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ static struct batadv_algo_ops *batadv_algo_get(char *name)
return bat_algo_ops;
}

/**
* batadv_algo_register() - Register callbacks for a mesh algorithm
* @bat_algo_ops: mesh algorithm callbacks to add
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
{
struct batadv_algo_ops *bat_algo_ops_tmp;
Expand Down Expand Up @@ -90,6 +96,19 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops)
return 0;
}

/**
* batadv_algo_select() - Select algorithm of soft interface
* @bat_priv: the bat priv with all the soft interface information
* @name: name of the algorithm to select
*
* The algorithm callbacks for the soft interface will be set when the algorithm
* with the correct name was found. Any previous selected algorithm will not be
* deinitialized and the new selected algorithm will also not be initialized.
* It is therefore not allowed to call batadv_algo_select outside the creation
* function of the soft interface.
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
{
struct batadv_algo_ops *bat_algo_ops;
Expand All @@ -104,6 +123,14 @@ int batadv_algo_select(struct batadv_priv *bat_priv, char *name)
}

#ifdef CONFIG_BATMAN_ADV_DEBUGFS

/**
* batadv_algo_seq_print_text() - Print the supported algorithms in a seq file
* @seq: seq file to print on
* @offset: not used
*
* Return: always 0
*/
int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
{
struct batadv_algo_ops *bat_algo_ops;
Expand Down
5 changes: 5 additions & 0 deletions net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2853,6 +2853,11 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = {
},
};

/**
* batadv_iv_init() - B.A.T.M.A.N. IV initialization function
*
* Return: 0 on success or negative error number in case of failure
*/
int __init batadv_iv_init(void)
{
int ret;
Expand Down
16 changes: 16 additions & 0 deletions net/batman-adv/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {
NULL,
};

/**
* batadv_debugfs_init() - Initialize soft interface independent debugfs entries
*/
void batadv_debugfs_init(void)
{
struct batadv_debuginfo **bat_debug;
Expand Down Expand Up @@ -289,6 +292,9 @@ void batadv_debugfs_init(void)
batadv_debugfs = NULL;
}

/**
* batadv_debugfs_destroy() - Remove all debugfs entries
*/
void batadv_debugfs_destroy(void)
{
debugfs_remove_recursive(batadv_debugfs);
Expand Down Expand Up @@ -355,6 +361,12 @@ void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
}
}

/**
* batadv_debugfs_add_meshif() - Initialize interface dependent debugfs entries
* @dev: netdev struct of the soft interface
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debugfs_add_meshif(struct net_device *dev)
{
struct batadv_priv *bat_priv = netdev_priv(dev);
Expand Down Expand Up @@ -401,6 +413,10 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
return -ENOMEM;
}

/**
* batadv_debugfs_del_meshif() - Remove interface dependent debugfs entries
* @dev: netdev struct of the soft interface
*/
void batadv_debugfs_del_meshif(struct net_device *dev)
{
struct batadv_priv *bat_priv = netdev_priv(dev);
Expand Down
38 changes: 38 additions & 0 deletions net/batman-adv/gateway_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ void batadv_gw_node_put(struct batadv_gw_node *gw_node)
kref_put(&gw_node->refcount, batadv_gw_node_release);
}

/**
* batadv_gw_get_selected_gw_node() - Get currently selected gateway
* @bat_priv: the bat priv with all the soft interface information
*
* Return: selected gateway (with increased refcnt), NULL on errors
*/
struct batadv_gw_node *
batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv)
{
Expand All @@ -111,6 +117,12 @@ batadv_gw_get_selected_gw_node(struct batadv_priv *bat_priv)
return gw_node;
}

/**
* batadv_gw_get_selected_orig() - Get originator of currently selected gateway
* @bat_priv: the bat priv with all the soft interface information
*
* Return: orig_node of selected gateway (with increased refcnt), NULL on errors
*/
struct batadv_orig_node *
batadv_gw_get_selected_orig(struct batadv_priv *bat_priv)
{
Expand Down Expand Up @@ -204,6 +216,10 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv)
batadv_gw_node_put(curr_gw);
}

/**
* batadv_gw_election() - Elect the best gateway
* @bat_priv: the bat priv with all the soft interface information
*/
void batadv_gw_election(struct batadv_priv *bat_priv)
{
struct batadv_gw_node *curr_gw = NULL;
Expand Down Expand Up @@ -292,6 +308,11 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
batadv_neigh_ifinfo_put(router_ifinfo);
}

/**
* batadv_gw_check_election() - Elect orig node as best gateway when eligible
* @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is to be checked
*/
void batadv_gw_check_election(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node)
{
Expand Down Expand Up @@ -460,6 +481,11 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
batadv_gw_node_put(gw_node);
}

/**
* batadv_gw_node_delete() - Remove orig_node from gateway list
* @bat_priv: the bat priv with all the soft interface information
* @orig_node: orig node which is currently in process of being removed
*/
void batadv_gw_node_delete(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node)
{
Expand All @@ -471,6 +497,10 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv,
batadv_gw_node_update(bat_priv, orig_node, &gateway);
}

/**
* batadv_gw_node_free() - Free gateway information from soft interface
* @bat_priv: the bat priv with all the soft interface information
*/
void batadv_gw_node_free(struct batadv_priv *bat_priv)
{
struct batadv_gw_node *gw_node;
Expand All @@ -486,6 +516,14 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
}

#ifdef CONFIG_BATMAN_ADV_DEBUGFS

/**
* batadv_gw_client_seq_print_text() - Print the gateway table in a seq file
* @seq: seq file to print on
* @offset: not used
*
* Return: always 0
*/
int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
{
struct net_device *net_dev = (struct net_device *)seq->private;
Expand Down
9 changes: 9 additions & 0 deletions net/batman-adv/gateway_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv)
}
}

/**
* batadv_gw_bandwidth_set() - Parse and set download/upload gateway bandwidth
* from supplied string buffer
* @net_dev: netdev struct of the soft interface
* @buff: the buffer containing the user data
* @count: number of bytes in the buffer
*
* Return: 'count' on success or a negative error code in case of failure
*/
ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
size_t count)
{
Expand Down
36 changes: 35 additions & 1 deletion net/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ void batadv_hardif_release(struct kref *ref)
kfree_rcu(hard_iface, rcu);
}

/**
* batadv_hardif_get_by_netdev() - Get hard interface object of a net_device
* @net_dev: net_device to search for
*
* Return: batadv_hard_iface of net_dev (with increased refcnt), NULL on errors
*/
struct batadv_hard_iface *
batadv_hardif_get_by_netdev(const struct net_device *net_dev)
{
Expand Down Expand Up @@ -561,6 +567,13 @@ static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
soft_iface->needed_tailroom = lower_tailroom;
}

/**
* batadv_hardif_min_mtu() - Calculate maximum MTU for soft interface
* @soft_iface: netdev struct of the soft interface
*
* Return: MTU for the soft-interface (limited by the minimal MTU of all active
* slave interfaces)
*/
int batadv_hardif_min_mtu(struct net_device *soft_iface)
{
struct batadv_priv *bat_priv = netdev_priv(soft_iface);
Expand Down Expand Up @@ -607,7 +620,11 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);
}

/* adjusts the MTU if a new interface with a smaller MTU appeared. */
/**
* batadv_update_min_mtu() - Adjusts the MTU if a new interface with a smaller
* MTU appeared
* @soft_iface: netdev struct of the soft interface
*/
void batadv_update_min_mtu(struct net_device *soft_iface)
{
soft_iface->mtu = batadv_hardif_min_mtu(soft_iface);
Expand Down Expand Up @@ -692,6 +709,14 @@ static int batadv_master_del_slave(struct batadv_hard_iface *slave,
return ret;
}

/**
* batadv_hardif_enable_interface() - Enslave hard interface to soft interface
* @hard_iface: hard interface to add to soft interface
* @net: the applicable net namespace
* @iface_name: name of the soft interface
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
struct net *net, const char *iface_name)
{
Expand Down Expand Up @@ -803,6 +828,12 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
return ret;
}

/**
* batadv_hardif_disable_interface() - Remove hard interface from soft interface
* @hard_iface: hard interface to be removed
* @autodel: whether to delete soft interface when it doesn't contain any other
* slave interfaces
*/
void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
enum batadv_hard_if_cleanup autodel)
{
Expand Down Expand Up @@ -937,6 +968,9 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface)
batadv_hardif_put(hard_iface);
}

/**
* batadv_hardif_remove_interfaces() - Remove all hard interfaces
*/
void batadv_hardif_remove_interfaces(void)
{
struct batadv_hard_iface *hard_iface, *hard_iface_tmp;
Expand Down
17 changes: 15 additions & 2 deletions net/batman-adv/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,23 @@ static void batadv_hash_init(struct batadv_hashtable *hash)
}
}

/* free only the hashtable and the hash itself. */
/**
* batadv_hash_destroy() - Free only the hashtable and the hash itself
* @hash: hash object to destroy
*/
void batadv_hash_destroy(struct batadv_hashtable *hash)
{
kfree(hash->list_locks);
kfree(hash->table);
kfree(hash);
}

/* allocates and clears the hash */
/**
* batadv_hash_new() - Allocates and clears the hashtable
* @size: number of hash buckets to allocate
*
* Return: newly allocated hashtable, NULL on errors
*/
struct batadv_hashtable *batadv_hash_new(u32 size)
{
struct batadv_hashtable *hash;
Expand Down Expand Up @@ -71,6 +79,11 @@ struct batadv_hashtable *batadv_hash_new(u32 size)
return NULL;
}

/**
* batadv_hash_set_lock_class() - Set specific lockdep class for hash spinlocks
* @hash: hash object to modify
* @key: lockdep class key address
*/
void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
struct lock_class_key *key)
{
Expand Down
9 changes: 9 additions & 0 deletions net/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ static void batadv_socket_add_packet(struct batadv_socket_client *socket_client,
struct batadv_icmp_header *icmph,
size_t icmp_len);

/**
* batadv_socket_init() - Initialize soft interface independent socket data
*/
void batadv_socket_init(void)
{
memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash));
Expand Down Expand Up @@ -316,6 +319,12 @@ static const struct file_operations batadv_fops = {
.llseek = no_llseek,
};

/**
* batadv_socket_setup() - Create debugfs "socket" file
* @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_socket_setup(struct batadv_priv *bat_priv)
{
struct dentry *d;
Expand Down
17 changes: 17 additions & 0 deletions net/batman-adv/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
return 0;
}

/**
* batadv_debug_log() - Add debug log entry
* @bat_priv: the bat priv with all the soft interface information
* @fmt: format string
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
{
va_list args;
Expand Down Expand Up @@ -199,6 +206,12 @@ static const struct file_operations batadv_log_fops = {
.llseek = no_llseek,
};

/**
* batadv_debug_log_setup() - Initialize debug log
* @bat_priv: the bat priv with all the soft interface information
*
* Return: 0 on success or negative error number in case of failure
*/
int batadv_debug_log_setup(struct batadv_priv *bat_priv)
{
struct dentry *d;
Expand All @@ -224,6 +237,10 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv)
return -ENOMEM;
}

/**
* batadv_debug_log_cleanup() - Destroy debug log
* @bat_priv: the bat priv with all the soft interface information
*/
void batadv_debug_log_cleanup(struct batadv_priv *bat_priv)
{
kfree(bat_priv->debug_log);
Expand Down
Loading

0 comments on commit ff15c27

Please sign in to comment.