Fwd: Re: [iproute2] tc_util.c / bit rate fixes...

Paweł Sikora pluto w ds14.agh.edu.pl
Pią, 16 Lip 2004, 15:34:58 CEST


On Friday 28 of May 2004 23:58, Paweł Sikora wrote:
> hmm, jakby to powiedziec. dalej tkwimy w gownie,
> bo ludzie juz sie przyzwyczaili do jego smrodu.
>
> ----------  Forwarded Message  ----------
>
> Subject: Re: [iproute2] tc_util.c / bit rate fixes...
> Date: Friday 28 of May 2004 23:01
> From: Stephen Hemminger <shemminger w osdl.org>
> To: Pawe__ Sikora <pluto w pld-linux.org>
>
> About the patch to change tc command handling of bit rate definitions
> from 1024 to 1000.  It appears that debate continues on this;
> my suspicion it is a left over from that computer science (bits/bytes) view
> of the world versus the telephony communications side.
>
> I thought about this and rejected it because it would change
> expected behaviour of people that already have scripts using the
> tc command.  It would not be right to break the compatibility at this
> late stage in a mature interface.
>
> It would make sense to document the current behaviour better.
>
> -------------------------------------------------------
>
> a tym, ktorym jednak smrod przeszkadza polecam
> przebudowe paczki z bcondem iec_complaint.

hehe, a jednak twardziele wymiekli :D

2004-06-09  Stephen Hemminger  <shemminger w osdl.org>

        * Report rates in K=1000 (requested by several people)


nowa postac metdoy przeliczajacej, to:

/*
 * NB: rates are scaled differently depending on bits or bytes.
 *     if bits are requested then k == 1000
 *     for bytes k = 1024
 */
int get_rate(unsigned *rate, const char *str)
{
        char *p;
        double bps = strtod(str, &p);

        if (p == str)
                return -1;

        if (*p == 0 || strcasecmp(p, "bit") == 0)
                bps /= 8;
        else if (strcasecmp(p, "kbit") == 0)
                bps = (bps * 1000.) / 8;
        else if (strcasecmp(p, "mbit") == 0)
                bps = (bps * 1000000.)/8;
        else if (strcasecmp(p, "gbit") == 0)
                bps = (bps * 1000000000.)/8;
        else if (strcasecmp(p, "kibit") == 0)
                bps *= 1024 / 8;
        else if (strcasecmp(p, "mibit") == 0)
                bps *= 1024*1024/8;
        else if (strcasecmp(p, "gibit") == 0)
                bps *= 1024*1024*1024/8;
        else if (strcasecmp(p, "kbps") == 0)
                bps *= 1024;
        else if (strcasecmp(p, "mbps") == 0)
                bps *= 1024*1024;
        else if (strcasecmp(p, "gbps") == 0)
                bps *= 1024*1024*1024;
        else if (strcasecmp(p, "bps") != 0)
                return -1;

        *rate = bps;
        return 0;
}



-- 
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

                           #define say(x) lie(x)




Więcej informacji o liście dyskusyjnej pld-devel-pl