summaryrefslogtreecommitdiffstats
path: root/tc
diff options
context:
space:
mode:
authorosdl.org!shemminger <osdl.org!shemminger>2004-06-02 20:22:08 +0000
committerosdl.org!shemminger <osdl.org!shemminger>2004-06-02 20:22:08 +0000
commitdbd90dc267227deffd54c658e7fb5d3d8667c2cd (patch)
tree15a3d58cbfd85f2eb611ab3453f2f1c1c4292bc8 /tc
parentf1dfe7dec11ab4005f9fc5de217197880c137530 (diff)
handl gbit as well.
const char * (Logical change 1.6)
Diffstat (limited to 'tc')
-rw-r--r--tc/tc_util.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tc/tc_util.c b/tc/tc_util.c
index d1355391..bae4885f 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -24,7 +24,7 @@
#include "utils.h"
#include "tc_util.h"
-int get_qdisc_handle(__u32 *h, char *str)
+int get_qdisc_handle(__u32 *h, const char *str)
{
__u32 maj;
char *p;
@@ -43,7 +43,7 @@ ok:
return 0;
}
-int get_tc_classid(__u32 *h, char *str)
+int get_tc_classid(__u32 *h, const char *str)
{
__u32 maj, min;
char *p;
@@ -98,7 +98,7 @@ char * sprint_tc_classid(__u32 h, char *buf)
}
-int get_rate(unsigned *rate, char *str)
+int get_rate(unsigned *rate, const char *str)
{
char *p;
double bps = strtod(str, &p);
@@ -109,6 +109,10 @@ int get_rate(unsigned *rate, char *str)
if (*p) {
if (strcasecmp(p, "kbps") == 0)
bps *= 1024;
+ else if (strcasecmp(p, "gbps") == 0)
+ bps *= 1024*1024*1024;
+ else if (strcasecmp(p, "gbit") == 0)
+ bps *= 1024*1024*1024/8;
else if (strcasecmp(p, "mbps") == 0)
bps *= 1024*1024;
else if (strcasecmp(p, "mbit") == 0)
@@ -174,7 +178,7 @@ char * sprint_rate(__u32 rate, char *buf)
return buf;
}
-int get_usecs(unsigned *usecs, char *str)
+int get_usecs(unsigned *usecs, const char *str)
{
double t;
char *p;
@@ -222,7 +226,7 @@ char * sprint_usecs(__u32 usecs, char *buf)
return buf;
}
-int get_size(unsigned *size, char *str)
+int get_size(unsigned *size, const char *str)
{
double sz;
char *p;
@@ -234,6 +238,10 @@ int get_size(unsigned *size, char *str)
if (*p) {
if (strcasecmp(p, "kb") == 0 || strcasecmp(p, "k")==0)
sz *= 1024;
+ else if (strcasecmp(p, "gb") == 0 || strcasecmp(p, "g")==0)
+ sz *= 1024*1024*1024;
+ else if (strcasecmp(p, "gbit") == 0)
+ sz *= 1024*1024*1024/8;
else if (strcasecmp(p, "mb") == 0 || strcasecmp(p, "m")==0)
sz *= 1024*1024;
else if (strcasecmp(p, "mbit") == 0)