mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
genetlink: use attrs from struct genl_info
Since dumps carry struct genl_info now, use the attrs pointer from genl_info and remove the one in struct genl_dumpit_info. Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://lore.kernel.org/r/20230814214723.2924989-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
9272af109f
commit
7288dd2fd4
@ -200,7 +200,7 @@ static int wg_get_device_start(struct netlink_callback *cb)
|
||||
{
|
||||
struct wg_device *wg;
|
||||
|
||||
wg = lookup_interface(genl_dumpit_info(cb)->attrs, cb->skb);
|
||||
wg = lookup_interface(genl_info_dump(cb)->attrs, cb->skb);
|
||||
if (IS_ERR(wg))
|
||||
return PTR_ERR(wg);
|
||||
DUMP_CTX(cb)->wg = wg;
|
||||
|
@ -255,7 +255,6 @@ struct genl_split_ops {
|
||||
struct genl_dumpit_info {
|
||||
const struct genl_family *family;
|
||||
struct genl_split_ops op;
|
||||
struct nlattr **attrs;
|
||||
struct genl_info info;
|
||||
};
|
||||
|
||||
|
@ -390,7 +390,7 @@ static int devlink_nl_health_reporter_get_dump_one(struct sk_buff *msg,
|
||||
int flags)
|
||||
{
|
||||
struct devlink_nl_dump_state *state = devlink_dump_state(cb);
|
||||
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
|
||||
const struct genl_info *info = genl_info_dump(cb);
|
||||
struct devlink_health_reporter *reporter;
|
||||
unsigned long port_index_end = ULONG_MAX;
|
||||
struct nlattr **attrs = info->attrs;
|
||||
@ -1264,7 +1264,7 @@ int devlink_nl_cmd_health_reporter_diagnose_doit(struct sk_buff *skb,
|
||||
static struct devlink_health_reporter *
|
||||
devlink_health_reporter_get_from_cb(struct netlink_callback *cb)
|
||||
{
|
||||
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
|
||||
const struct genl_info *info = genl_info_dump(cb);
|
||||
struct devlink_health_reporter *reporter;
|
||||
struct nlattr **attrs = info->attrs;
|
||||
struct devlink *devlink;
|
||||
|
@ -5201,7 +5201,7 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
|
||||
struct devlink_nl_dump_state *state = devlink_dump_state(cb);
|
||||
struct nlattr *chunks_attr, *region_attr, *snapshot_attr;
|
||||
u64 ret_offset, start_offset, end_offset = U64_MAX;
|
||||
struct nlattr **attrs = info->attrs;
|
||||
struct nlattr **attrs = info->info.attrs;
|
||||
struct devlink_port *port = NULL;
|
||||
devlink_chunk_fill_t *region_cb;
|
||||
struct devlink_region *region;
|
||||
@ -5224,8 +5224,8 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (info->attrs[DEVLINK_ATTR_PORT_INDEX]) {
|
||||
index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]);
|
||||
if (attrs[DEVLINK_ATTR_PORT_INDEX]) {
|
||||
index = nla_get_u32(attrs[DEVLINK_ATTR_PORT_INDEX]);
|
||||
|
||||
port = devlink_port_get_by_index(devlink, index);
|
||||
if (!port) {
|
||||
|
@ -228,7 +228,7 @@ static int devlink_nl_inst_iter_dumpit(struct sk_buff *msg,
|
||||
int devlink_nl_dumpit(struct sk_buff *msg, struct netlink_callback *cb,
|
||||
devlink_nl_dump_one_func_t *dump_one)
|
||||
{
|
||||
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
|
||||
const struct genl_info *info = genl_info_dump(cb);
|
||||
struct nlattr **attrs = info->attrs;
|
||||
int flags = NLM_F_MULTI;
|
||||
|
||||
|
@ -538,7 +538,8 @@ static int ethnl_default_start(struct netlink_callback *cb)
|
||||
goto free_req_info;
|
||||
}
|
||||
|
||||
ret = ethnl_default_parse(req_info, info->attrs, sock_net(cb->skb->sk),
|
||||
ret = ethnl_default_parse(req_info, info->info.attrs,
|
||||
sock_net(cb->skb->sk),
|
||||
ops, cb->extack, false);
|
||||
if (req_info->dev) {
|
||||
/* We ignore device specification in dump requests but as the
|
||||
|
@ -219,7 +219,7 @@ int ethnl_tunnel_info_start(struct netlink_callback *cb)
|
||||
{
|
||||
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
|
||||
struct ethnl_tunnel_info_dump_ctx *ctx = (void *)cb->ctx;
|
||||
struct nlattr **tb = info->attrs;
|
||||
struct nlattr **tb = info->info.attrs;
|
||||
int ret;
|
||||
|
||||
BUILD_BUG_ON(sizeof(*ctx) > sizeof(cb->ctx));
|
||||
|
@ -262,7 +262,7 @@ nl802154_prepare_wpan_dev_dump(struct sk_buff *skb,
|
||||
|
||||
if (!cb->args[0]) {
|
||||
*wpan_dev = __cfg802154_wpan_dev_from_attrs(sock_net(skb->sk),
|
||||
info->attrs);
|
||||
info->info.attrs);
|
||||
if (IS_ERR(*wpan_dev)) {
|
||||
err = PTR_ERR(*wpan_dev);
|
||||
goto out_unlock;
|
||||
@ -570,7 +570,7 @@ static int nl802154_dump_wpan_phy_parse(struct sk_buff *skb,
|
||||
struct nl802154_dump_wpan_phy_state *state)
|
||||
{
|
||||
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
|
||||
struct nlattr **tb = info->attrs;
|
||||
struct nlattr **tb = info->info.attrs;
|
||||
|
||||
if (tb[NL802154_ATTR_WPAN_PHY])
|
||||
state->filter_wpan_phy = nla_get_u32(tb[NL802154_ATTR_WPAN_PHY]);
|
||||
|
@ -846,7 +846,6 @@ static int genl_start(struct netlink_callback *cb)
|
||||
}
|
||||
info->family = ctx->family;
|
||||
info->op = *ops;
|
||||
info->attrs = attrs;
|
||||
info->info.snd_seq = cb->nlh->nlmsg_seq;
|
||||
info->info.snd_portid = NETLINK_CB(cb->skb).portid;
|
||||
info->info.nlhdr = cb->nlh;
|
||||
@ -864,7 +863,7 @@ static int genl_start(struct netlink_callback *cb)
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
genl_family_rcv_msg_attrs_free(info->attrs);
|
||||
genl_family_rcv_msg_attrs_free(info->info.attrs);
|
||||
genl_dumpit_info_free(info);
|
||||
cb->data = NULL;
|
||||
}
|
||||
@ -898,7 +897,7 @@ static int genl_done(struct netlink_callback *cb)
|
||||
rc = ops->done(cb);
|
||||
genl_op_unlock(info->family);
|
||||
}
|
||||
genl_family_rcv_msg_attrs_free(info->attrs);
|
||||
genl_family_rcv_msg_attrs_free(info->info.attrs);
|
||||
genl_dumpit_info_free(info);
|
||||
return rc;
|
||||
}
|
||||
@ -1387,7 +1386,7 @@ static int ctrl_dumppolicy_start(struct netlink_callback *cb)
|
||||
{
|
||||
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
|
||||
struct ctrl_dump_policy_ctx *ctx = (void *)cb->ctx;
|
||||
struct nlattr **tb = info->attrs;
|
||||
struct nlattr **tb = info->info.attrs;
|
||||
const struct genl_family *rt;
|
||||
struct genl_op_iter i;
|
||||
int err;
|
||||
|
@ -110,10 +110,10 @@ static struct nfc_dev *__get_device_from_cb(struct netlink_callback *cb)
|
||||
struct nfc_dev *dev;
|
||||
u32 idx;
|
||||
|
||||
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
|
||||
if (!info->info.attrs[NFC_ATTR_DEVICE_INDEX])
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
|
||||
idx = nla_get_u32(info->info.attrs[NFC_ATTR_DEVICE_INDEX]);
|
||||
|
||||
dev = nfc_get_device(idx);
|
||||
if (!dev)
|
||||
|
@ -208,7 +208,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
info.attrs = attrbuf;
|
||||
info.info.attrs = attrbuf;
|
||||
|
||||
if (nlmsg_len(cb.nlh) > 0) {
|
||||
err = nlmsg_parse_deprecated(cb.nlh, GENL_HDRLEN, attrbuf,
|
||||
|
@ -2662,7 +2662,7 @@ static int __tipc_nl_add_node_links(struct net *net, struct tipc_nl_msg *msg,
|
||||
int tipc_nl_node_dump_link(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->info.attrs;
|
||||
struct nlattr *link[TIPC_NLA_LINK_MAX + 1];
|
||||
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
||||
struct tipc_node *node;
|
||||
@ -2870,7 +2870,7 @@ int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb,
|
||||
int err;
|
||||
|
||||
if (!prev_node) {
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->info.attrs;
|
||||
struct nlattr *mon[TIPC_NLA_MON_MAX + 1];
|
||||
|
||||
if (!attrs[TIPC_NLA_MON])
|
||||
|
@ -3791,7 +3791,7 @@ int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
struct tipc_sock *tsk;
|
||||
|
||||
if (!tsk_portid) {
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->info.attrs;
|
||||
struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1];
|
||||
|
||||
if (!attrs[TIPC_NLA_SOCK])
|
||||
|
@ -465,7 +465,7 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
int i;
|
||||
|
||||
if (!bid && !skip_cnt) {
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
|
||||
struct nlattr **attrs = genl_dumpit_info(cb)->info.attrs;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct nlattr *battrs[TIPC_NLA_BEARER_MAX + 1];
|
||||
char *bname;
|
||||
|
Loading…
Reference in New Issue
Block a user