netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Roopa Prabhu <roopa@cumulusnetworks.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2 WIP] ifstat: use new RTM_GETSTATS api
Date: Wed, 20 Apr 2016 11:53:47 -0700	[thread overview]
Message-ID: <20160420115347.6a43d7f7@xeon-e3> (raw)
In-Reply-To: <1461168975-28081-1-git-send-email-roopa@cumulusnetworks.com>

On Wed, 20 Apr 2016 09:16:15 -0700
Roopa Prabhu <roopa@cumulusnetworks.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);

> +}

  reply	other threads:[~2016-04-20 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 16:16 [PATCH iproute2 WIP] ifstat: use new RTM_GETSTATS api Roopa Prabhu
2016-04-20 18:53 ` Stephen Hemminger [this message]
2016-04-20 20:25   ` Roopa Prabhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160420115347.6a43d7f7@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).