@@ -8,6 +8,19 @@
#include "netdev-genl-gen.h"
+struct netdev_nl_dump_ctx {
+ int dev_entry_hash;
+ int dev_entry_idx;
+};
+
+static inline struct netdev_nl_dump_ctx *
+netdev_dump_ctx(struct netlink_callback *cb)
+{
+ NL_ASSERT_DUMP_CTX_FITS(struct netdev_nl_dump_ctx);
+
+ return (struct netdev_nl_dump_ctx *)cb->ctx;
+}
+
static int
netdev_nl_dev_fill(struct net_device *netdev, struct sk_buff *rsp,
u32 portid, u32 seq, int flags, u32 cmd)
@@ -91,14 +104,15 @@ int netdev_nl_dev_get_doit(struct sk_buff *skb, struct genl_info *info)
int netdev_nl_dev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
{
+ struct netdev_nl_dump_ctx *ctx = netdev_dump_ctx(cb);
struct net *net = sock_net(skb->sk);
struct net_device *netdev;
int idx = 0, s_idx;
int h, s_h;
int err;
- s_h = cb->args[0];
- s_idx = cb->args[1];
+ s_h = ctx->dev_entry_hash;
+ s_idx = ctx->dev_entry_idx;
rtnl_lock();
@@ -126,8 +140,8 @@ int netdev_nl_dev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
if (err != -EMSGSIZE)
return err;
- cb->args[1] = idx;
- cb->args[0] = h;
+ ctx->dev_entry_idx = idx;
+ ctx->dev_entry_hash = h;
cb->seq = net->dev_base_seq;
return skb->len;
A comment in the definition of struct netlink_callback states "args is deprecated. Cast a struct over ctx instead for proper type safety." Introduce netdev_nl_dump_ctx structure and replace 'args' with netdev_nl_dump_ctx fields. Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com> --- net/core/netdev-genl.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)