[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160420115347.6a43d7f7@xeon-e3>
Date: Wed, 20 Apr 2016 11:53:47 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Roopa Prabhu <roopa@...ulusnetworks.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 WIP] ifstat: use new RTM_GETSTATS api
On Wed, 20 Apr 2016 09:16:15 -0700
Roopa Prabhu <roopa@...ulusnetworks.com> wrote:
> +int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int family, int type,
> + __u32 filt_mask)
> +{
> + struct {
> + struct nlmsghdr nlh;
> + struct if_stats_msg ifsm;
> + } req;
Please use C99 initialization instead of memset in new code.
> + int err;
> +
> + memset(&req, 0, sizeof(req));
> + req.nlh.nlmsg_len = sizeof(req);
> + req.nlh.nlmsg_type = type;
> + req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
> + req.nlh.nlmsg_pid = 0;
> + req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
> + req.ifsm.family = family;
> + req.ifsm.filter_mask = filt_mask;
> +
> + err = send(rth->fd, (void*)&req, sizeof(req), 0);
> +
> + return err;
Why not just:
return send(rth->fd, &req, sizoef(req), 0);
> +}
Powered by blists - more mailing lists