diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-02-24 09:30:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-26 14:10:06 -0500 |
commit | 80d326fab534a5380e8f6e509a0b9076655a9670 (patch) | |
tree | 57c636de934b3f8abb7db9bcde64360ecc4eaf66 /net/netlink/af_netlink.c | |
parent | 48e316bc2e045206248c6c75c0d5bbc0c9ddc32c (diff) |
netlink: add netlink_dump_control structure for netlink_dump_start()
Davem considers that the argument list of this interface is getting
out of control. This patch tries to address this issue following
his proposal:
struct netlink_dump_control c = { .dump = dump, .done = done, ... };
netlink_dump_start(..., &c);
Suggested by David S. Miller.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/af_netlink.c')
-rw-r--r-- | net/netlink/af_netlink.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 4d751e3d4b4b..ab74845876d2 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1736,10 +1736,7 @@ errout_skb: | |||
1736 | 1736 | ||
1737 | int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | 1737 | int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
1738 | const struct nlmsghdr *nlh, | 1738 | const struct nlmsghdr *nlh, |
1739 | int (*dump)(struct sk_buff *skb, | 1739 | struct netlink_dump_control *control) |
1740 | struct netlink_callback *), | ||
1741 | int (*done)(struct netlink_callback *), | ||
1742 | u16 min_dump_alloc) | ||
1743 | { | 1740 | { |
1744 | struct netlink_callback *cb; | 1741 | struct netlink_callback *cb; |
1745 | struct sock *sk; | 1742 | struct sock *sk; |
@@ -1750,10 +1747,10 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | |||
1750 | if (cb == NULL) | 1747 | if (cb == NULL) |
1751 | return -ENOBUFS; | 1748 | return -ENOBUFS; |
1752 | 1749 | ||
1753 | cb->dump = dump; | 1750 | cb->dump = control->dump; |
1754 | cb->done = done; | 1751 | cb->done = control->done; |
1755 | cb->nlh = nlh; | 1752 | cb->nlh = nlh; |
1756 | cb->min_dump_alloc = min_dump_alloc; | 1753 | cb->min_dump_alloc = control->min_dump_alloc; |
1757 | atomic_inc(&skb->users); | 1754 | atomic_inc(&skb->users); |
1758 | cb->skb = skb; | 1755 | cb->skb = skb; |
1759 | 1756 | ||