OSDN Git Service

genetlink: add a structure for dump state
authorJakub Kicinski <kuba@kernel.org>
Fri, 2 Oct 2020 21:49:55 +0000 (14:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Oct 2020 02:11:12 +0000 (19:11 -0700)
commitadc848450ff84e961cf7966b8a475889a92a9fd3
treea0268811e0d3f5acab79a98068b71e659d09d2d8
parent66a9b9287d2447a91cef2fafc648dee32186f708
genetlink: add a structure for dump state

Whenever netlink dump uses more than 2 cb->args[] entries
code gets hard to read. We're about to add more state to
ctrl_dumppolicy() so create a structure.

Since the structure is typed and clearly named we can remove
the local fam_id variable and use ctx->fam_id directly.

v3:
 - rebase onto explicit free fix
v1:
 - s/nl_policy_dump/netlink_policy_dump_state/
 - forward declare struct netlink_policy_dump_state,
   and move from passing unsigned long to actual pointer type
 - add build bug on
 - u16 fam_id
 - s/args/ctx/

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netlink.h
net/netlink/genetlink.c
net/netlink/policy.c