mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
48e316bc2e
commit
80d326fab5
12 changed files with 87 additions and 43 deletions
|
|
@ -1736,10 +1736,7 @@ errout_skb:
|
|||
|
||||
int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
||||
const struct nlmsghdr *nlh,
|
||||
int (*dump)(struct sk_buff *skb,
|
||||
struct netlink_callback *),
|
||||
int (*done)(struct netlink_callback *),
|
||||
u16 min_dump_alloc)
|
||||
struct netlink_dump_control *control)
|
||||
{
|
||||
struct netlink_callback *cb;
|
||||
struct sock *sk;
|
||||
|
|
@ -1750,10 +1747,10 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
|||
if (cb == NULL)
|
||||
return -ENOBUFS;
|
||||
|
||||
cb->dump = dump;
|
||||
cb->done = done;
|
||||
cb->dump = control->dump;
|
||||
cb->done = control->done;
|
||||
cb->nlh = nlh;
|
||||
cb->min_dump_alloc = min_dump_alloc;
|
||||
cb->min_dump_alloc = control->min_dump_alloc;
|
||||
atomic_inc(&skb->users);
|
||||
cb->skb = skb;
|
||||
|
||||
|
|
|
|||
|
|
@ -563,8 +563,13 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|||
return -EOPNOTSUPP;
|
||||
|
||||
genl_unlock();
|
||||
err = netlink_dump_start(net->genl_sock, skb, nlh,
|
||||
ops->dumpit, ops->done, 0);
|
||||
{
|
||||
struct netlink_dump_control c = {
|
||||
.dump = ops->dumpit,
|
||||
.done = ops->done,
|
||||
};
|
||||
err = netlink_dump_start(net->genl_sock, skb, nlh, &c);
|
||||
}
|
||||
genl_lock();
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue