public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Li Wei <lw@cn•fujitsu.com>
To: Stephen Hemminger <shemminger@vyatta•com>
Cc: netdev <netdev@vger•kernel.org>
Subject: Re: [PATCH] tc_util: fix incorrect bare number process in get_rate.
Date: Thu, 12 Jul 2012 09:16:48 +0800	[thread overview]
Message-ID: <4FFE2580.7020404@cn.fujitsu.com> (raw)
In-Reply-To: <20120711075129.4f81eea8@nehalam.linuxnetplumber.net>

于 2012-7-11 22:51, Stephen Hemminger 写道:
> On Wed, 11 Jul 2012 15:24:50 +0800
> Li Wei <lw@cn•fujitsu.com> wrote:
> 
>>
>> As the comment and manpage indicated that the bare number means
>> bytes per second, so the division is not needed.
>> ---
>>  tc/tc_util.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/tc/tc_util.c b/tc/tc_util.c
>> index 926ed08..e8d89c1 100644
>> --- a/tc/tc_util.c
>> +++ b/tc/tc_util.c
>> @@ -153,7 +153,7 @@ int get_rate(unsigned *rate, const char *str)
>>  		return -1;
>>  
>>  	if (*p == '\0') {
>> -		*rate = bps / 8.;	/* assume bytes/sec */
>> +		*rate = bps;	/* assume bytes/sec */
>>  		return 0;
>>  	}
>>  
> Thanks for finding this. The documentation, code and comment do
> all need to be the same!
> 
> But changing the code as you propose would break existing usage
> by scripts. Instead, the man page and comment need to change
> to match the reality of the existing application.
> 
> 
Well, I see, I'll send another patch to take care of this.

Thanks,

Wei

  reply	other threads:[~2012-07-12  1:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11  7:24 [PATCH] tc_util: fix incorrect bare number process in get_rate Li Wei
2012-07-11 14:51 ` Stephen Hemminger
2012-07-12  1:16   ` Li Wei [this message]
2012-07-12  1:56   ` [PATCH] tc: man: change man page and comment to confirm to code's behavior Li Wei
2012-07-12 16:06     ` Stephen Hemminger

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=4FFE2580.7020404@cn.fujitsu.com \
    --to=lw@cn$(echo .)fujitsu.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=shemminger@vyatta$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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