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/ipv4/inet_diag.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/ipv4/inet_diag.c')
-rw-r--r-- | net/ipv4/inet_diag.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index fcf281819cd4..8d25a1c557eb 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -960,9 +960,12 @@ static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
960 | inet_diag_bc_audit(nla_data(attr), nla_len(attr))) | 960 | inet_diag_bc_audit(nla_data(attr), nla_len(attr))) |
961 | return -EINVAL; | 961 | return -EINVAL; |
962 | } | 962 | } |
963 | 963 | { | |
964 | return netlink_dump_start(sock_diag_nlsk, skb, nlh, | 964 | struct netlink_dump_control c = { |
965 | inet_diag_dump_compat, NULL, 0); | 965 | .dump = inet_diag_dump_compat, |
966 | }; | ||
967 | return netlink_dump_start(sock_diag_nlsk, skb, nlh, &c); | ||
968 | } | ||
966 | } | 969 | } |
967 | 970 | ||
968 | return inet_diag_get_exact_compat(skb, nlh); | 971 | return inet_diag_get_exact_compat(skb, nlh); |
@@ -985,9 +988,12 @@ static int inet_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h) | |||
985 | inet_diag_bc_audit(nla_data(attr), nla_len(attr))) | 988 | inet_diag_bc_audit(nla_data(attr), nla_len(attr))) |
986 | return -EINVAL; | 989 | return -EINVAL; |
987 | } | 990 | } |
988 | 991 | { | |
989 | return netlink_dump_start(sock_diag_nlsk, skb, h, | 992 | struct netlink_dump_control c = { |
990 | inet_diag_dump, NULL, 0); | 993 | .dump = inet_diag_dump, |
994 | }; | ||
995 | return netlink_dump_start(sock_diag_nlsk, skb, h, &c); | ||
996 | } | ||
991 | } | 997 | } |
992 | 998 | ||
993 | return inet_diag_get_exact(skb, h, (struct inet_diag_req_v2 *)NLMSG_DATA(h)); | 999 | return inet_diag_get_exact(skb, h, (struct inet_diag_req_v2 *)NLMSG_DATA(h)); |