From: Stephen Hemminger <stephen@networkplumber.org>
To: Nogah Frankel <nogahf@mellanox.com>
Cc: netdev@vger.kernel.org, roopa@cumulusnetworks.com,
roszenrami@gmail.com, ogerlitz@mellanox.com, jiri@mellanox.com,
eladr@mellanox.com, yotamg@mellanox.com, idosch@mellanox.com
Subject: Re: [PATCH iproute2 v3 2/4] ifstat: Add extended statistics to ifstat
Date: Thu, 22 Dec 2016 10:59:19 -0800 [thread overview]
Message-ID: <20161222105919.08b8738b@xeon-e3> (raw)
In-Reply-To: <1482423795-6531-3-git-send-email-nogahf@mellanox.com>
On Thu, 22 Dec 2016 18:23:13 +0200
Nogah Frankel <nogahf@mellanox.com> wrote:
On Thu, 22 Dec 2016 18:23:13 +0200
Nogah Frankel <nogahf@mellanox.com> wrote:
> }
> @@ -691,18 +804,22 @@ static const struct option longopts[] = {
> { "interval", 1, 0, 't' },
> { "version", 0, 0, 'V' },
> { "zeros", 0, 0, 'z' },
> + { "extended", 1, 0, 'x'},
> { 0 }
> };
>
> +
> int main(int argc, char *argv[])
You let extra whitespace changes creep in.
> + case 'x':
> + is_extended = true;
> + memset(stats_type, 0, 64);
> + strncpy(stats_type, optarg, 63);
> + break;
This seems like doing this either the paranoid or hard way.
Why not:
const char *stats_type = NULL;
...
case 'x':
stats_type = optarg;
break;
...
if (stats_type)
snprintf(hist_name, sizeof(hist_name),
"%s/.%s_ifstat.u%d", P_tmpdir, stats_type,
getuid());
else
snprintf(hist_name, sizeof(hist_name),
"%s/.ifstat.u%d", P_tmpdir, getuid());
Since:
1) optarg points to area in argv that is persistent (avoid copy)
2) don't need is_extended flag value then
Please cleanup and resubmit.
next prev parent reply other threads:[~2016-12-22 18:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 16:23 [PATCH iproute2 v3 0/4] update ifstat for new stats Nogah Frankel
2016-12-22 16:23 ` [PATCH iproute2 v3 1/4] ifstat: Includes reorder Nogah Frankel
2016-12-22 16:23 ` [PATCH iproute2 v3 2/4] ifstat: Add extended statistics to ifstat Nogah Frankel
2016-12-22 18:59 ` Stephen Hemminger [this message]
2016-12-25 10:25 ` Nogah Frankel
2016-12-22 16:23 ` [PATCH iproute2 v3 3/4] ifstat: Add 64 bits based stats to extended statistics Nogah Frankel
2016-12-22 16:23 ` [PATCH iproute2 v3 4/4] ifstat: Add "sw only" extended statistics to ifstat Nogah Frankel
2016-12-22 21:10 ` Roopa Prabhu
2016-12-25 11:23 ` Nogah Frankel
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=20161222105919.08b8738b@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nogahf@mellanox.com \
--cc=ogerlitz@mellanox.com \
--cc=roopa@cumulusnetworks.com \
--cc=roszenrami@gmail.com \
--cc=yotamg@mellanox.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).