Re: [B.A.T.M.A.N.] [PATCH v8 05/14] batman-adv: netlink: add translation table query

Linus Lüssing
2016-05-26T04:39:14Z

On Mon, May 23, 2016 at 05:59:36PM +0200, Simon Wunderlich wrote:
> +static int
> +batadv_tt_local_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
> + struct batadv_priv *bat_priv,
> + struct batadv_tt_common_entry *common)
> +{
[...]
> + if (!(common->flags & BATADV_TT_CLIENT_NOPURGE)) {
> + if (nla_put_u32(msg, BATADV_ATTR_LAST_SEEN_MSECS,
> + last_seen_msecs))
> + goto nla_put_failure;
> + }

Unnecessary brackets here, maybe use '&&' to skip a layer of
indention?

> +int batadv_tt_local_dump(struct sk_buff *msg, struct netlink_callback *cb)
> +{
> + struct net *net = sock_net(cb->skb->sk);
> + struct net_device *soft_iface = NULL;

No need to set soft_iface to NULL.

> +static int
> +batadv_tt_global_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
> + struct batadv_priv *bat_priv,
> + struct batadv_tt_common_entry *common, int *sub_s)
> +{
> + struct batadv_tt_orig_list_entry *orig_entry, *best_entry;
> + struct batadv_tt_global_entry *global;
> + struct hlist_head *head;
> + int sub = 0;
> + bool best;
> +
> + global = container_of(common, struct batadv_tt_global_entry, common);
> + best_entry = batadv_transtable_best_orig(bat_priv, global);
> + head = &global->orig_list;
> +
> + hlist_for_each_entry_rcu(orig_entry, head, list) {

Either add an explicit rcu-lock or keep to the doc style to add a
line in the kerneldoc about caller needing to hold it?

> +int batadv_tt_global_dump(struct sk_buff *msg, struct netlink_callback *cb)
> +{
> + struct net *net = sock_net(cb->skb->sk);
> + struct net_device *soft_iface = NULL;

No need to set soft_iface to NULL.