Re: [IPROUTE 04/05]: Replace "usec" by "time" in function names

2007-01-16 Thread Patrick McHardy
Jarek Poplawski wrote:
> On 10-01-2007 11:01, Patrick McHardy wrote:
> 
>>[IPROUTE]: Replace "usec" by "time" in function names
>>
>>Rename functions containing "usec" since they don't necessarily return
>>usec units anymore.
>>
>>diff --git a/tc/q_cbq.c b/tc/q_cbq.c
>>index a56..913b26a 100644
>>--- a/tc/q_cbq.c
>>+++ b/tc/q_cbq.c
>>@@ -500,17 +500,17 @@ static int cbq_print_opt(struct qdisc_ut
>>  if (lss && show_details) {
>>  fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, 
>> lss->ewma_log, lss->avpkt);
>>  if (lss->maxidle) {
>>- fprintf(f, "maxidle %luus ", 
>>tc_core_tick2usec(lss->maxidle>>lss->ewma_log));
>>+ fprintf(f, "maxidle %luus ", 
>>tc_core_tick2time(lss->maxidle>>lss->ewma_log));
> 
> 
> If not necessarily usec, "%luus" could be misleading
> here and later. 

The next patch replaces it by sprint_time.

>>diff --git a/tc/q_netem.c b/tc/q_netem.c
>>index cfd1799..24fb95e 100644
>>--- a/tc/q_netem.c
>>+++ b/tc/q_netem.c
>>@@ -108,15 +108,15 @@ static int get_ticks(__u32 *ticks, const
>> {
>>  unsigned t;
>> 
>>- if(get_usecs(&t, str))
>>+ if(get_time(&t, str))
>>  return -1;
>> 
>>- if (tc_core_usec2big(t)) {
>>+ if (tc_core_time2big(t)) {
>>  fprintf(stderr, "Illegal %d usecs (too large)\n", t);
> 
> 
> Like above but usecs.

Fixed, thanks.

>>diff --git a/tc/tc_core.c b/tc/tc_core.c
>>index 07dc4ba..e27254e 100644
>>--- a/tc/tc_core.c
>>+++ b/tc/tc_core.c
>>@@ -27,21 +27,21 @@ static __u32 t2us=1;
>> static __u32 us2t=1;
>> static double tick_in_usec = 1;
>> 
>>-int tc_core_usec2big(long usec)
>>+int tc_core_time2big(long time)
>> {
>>- __u64 t = usec;
>>+ __u64 t = time;
>> 
>>  t *= tick_in_usec;
>>  return (t >> 32) != 0;
>> }
>> 
>> 
>>-long tc_core_usec2tick(long usec)
>>+long tc_core_time2tick(long time)
>> {
>>- return usec*tick_in_usec;
>>+ return time*tick_in_usec;
>> }
>> 
>>-long tc_core_tick2usec(long tick)
>>+long tc_core_tick2time(long tick)
>> {
>>  return tick/tick_in_usec;
>> }
> 
> 
> Similarly (tick_in_time)?

Something like that will be done in a followup patch.
[IPROUTE]: Replace "usec" by "time" in function names

Rename functions containing "usec" since they don't necessarily return
usec units anymore.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit 64f96b38ae91faad5baff052715114a0704a844e
tree b5c87b9834652fa695c9b6463b05ec17754b7003
parent df1c304ddaedfd5bfa6ca39cc66560c1618e2928
author Patrick McHardy <[EMAIL PROTECTED]> Tue, 16 Jan 2007 14:40:30 +0100
committer Patrick McHardy <[EMAIL PROTECTED]> Tue, 16 Jan 2007 14:40:30 +0100

 tc/m_estimator.c |4 ++--
 tc/q_cbq.c   |6 +++---
 tc/q_hfsc.c  |6 +++---
 tc/q_netem.c |8 
 tc/q_tbf.c   |8 
 tc/tc_cbq.c  |4 ++--
 tc/tc_core.c |   14 +++---
 tc/tc_core.h |6 +++---
 tc/tc_util.c |   14 +++---
 tc/tc_util.h |6 +++---
 10 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/tc/m_estimator.c b/tc/m_estimator.c
index d931551..a9e5dbc 100644
--- a/tc/m_estimator.c
+++ b/tc/m_estimator.c
@@ -45,12 +45,12 @@ int parse_estimator(int *p_argc, char **
 		duparg("estimator", *argv);
 	if (matches(*argv, "help") == 0)
 		est_help();
-	if (get_usecs(&A, *argv))
+	if (get_time(&A, *argv))
 		invarg("estimator", "invalid estimator interval");
 	NEXT_ARG();
 	if (matches(*argv, "help") == 0)
 		est_help();
-	if (get_usecs(&time_const, *argv))
+	if (get_time(&time_const, *argv))
 		invarg("estimator", "invalid estimator time constant");
 	if (tc_setup_estimator(A, time_const, est) < 0) {
 		fprintf(stderr, "Error: estimator parameters are out of range.\n");
diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index a56..913b26a 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -500,17 +500,17 @@ static int cbq_print_opt(struct qdisc_ut
 	if (lss && show_details) {
 		fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, lss->ewma_log, lss->avpkt);
 		if (lss->maxidle) {
-			fprintf(f, "maxidle %luus ", tc_core_tick2usec(lss->maxidle>>lss->ewma_log));
+			fprintf(f, "maxidle %luus ", tc_core_tick2time(lss->maxidle>>lss->ewma_log));
 			if (show_raw)
 fprintf(f, "[%08x] ", lss->maxidle);
 		}
 		if (lss->minidle!=0x7fff) {
-			fprintf(f, "minidle %luus ", tc_core_tick2usec(lss->minidle>>lss->ewma_log));
+			fprintf(f, "minidle %luus ", tc_core_tick2time(lss->minidle>>lss->ewma_log));
 			if (show_raw)
 fprintf(f, "[%08x] ", lss->minidle);
 		}
 		if (lss->offtime) {
-			fprintf(f, "offtime %luus ", tc_core_tick2usec(lss->offtime));
+			fprintf(f, "offtime %luus ", tc_core_tick2time(lss->offtime));
 			if (show_raw)
 fprintf(f, "[%08x] ", lss->offtime);
 		}
diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c
index f7a30f2..b190c71 100644
--- a/tc/q_hfsc.c
+++ b/tc/q_hfsc.c
@@ -226,7 +226,7 @@ hfsc_print_sc(FILE *f, char *name, struc
 
 	fprintf(f, "%s ", name);
 	fprintf(f, "m

Re: [IPROUTE 04/05]: Replace "usec" by "time" in function names

2007-01-15 Thread Jarek Poplawski
On 10-01-2007 11:01, Patrick McHardy wrote:
> [IPROUTE]: Replace "usec" by "time" in function names
> 
> Rename functions containing "usec" since they don't necessarily return
> usec units anymore.
> 
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
> 
> ---
...
> diff --git a/tc/q_cbq.c b/tc/q_cbq.c
> index a56..913b26a 100644
> --- a/tc/q_cbq.c
> +++ b/tc/q_cbq.c
> @@ -500,17 +500,17 @@ static int cbq_print_opt(struct qdisc_ut
>   if (lss && show_details) {
>   fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, 
> lss->ewma_log, lss->avpkt);
>   if (lss->maxidle) {
> - fprintf(f, "maxidle %luus ", 
> tc_core_tick2usec(lss->maxidle>>lss->ewma_log));
> + fprintf(f, "maxidle %luus ", 
> tc_core_tick2time(lss->maxidle>>lss->ewma_log));

If not necessarily usec, "%luus" could be misleading
here and later. 

...
> diff --git a/tc/q_netem.c b/tc/q_netem.c
> index cfd1799..24fb95e 100644
> --- a/tc/q_netem.c
> +++ b/tc/q_netem.c
> @@ -108,15 +108,15 @@ static int get_ticks(__u32 *ticks, const
>  {
>   unsigned t;
>  
> - if(get_usecs(&t, str))
> + if(get_time(&t, str))
>   return -1;
>  
> - if (tc_core_usec2big(t)) {
> + if (tc_core_time2big(t)) {
>   fprintf(stderr, "Illegal %d usecs (too large)\n", t);

Like above but usecs.

...
> diff --git a/tc/tc_core.c b/tc/tc_core.c
> index 07dc4ba..e27254e 100644
> --- a/tc/tc_core.c
> +++ b/tc/tc_core.c
> @@ -27,21 +27,21 @@ static __u32 t2us=1;
>  static __u32 us2t=1;
>  static double tick_in_usec = 1;
>  
> -int tc_core_usec2big(long usec)
> +int tc_core_time2big(long time)
>  {
> - __u64 t = usec;
> + __u64 t = time;
>  
>   t *= tick_in_usec;
>   return (t >> 32) != 0;
>  }
>  
>  
> -long tc_core_usec2tick(long usec)
> +long tc_core_time2tick(long time)
>  {
> - return usec*tick_in_usec;
> + return time*tick_in_usec;
>  }
>  
> -long tc_core_tick2usec(long tick)
> +long tc_core_tick2time(long tick)
>  {
>   return tick/tick_in_usec;
>  }

Similarly (tick_in_time)?

Regards,
Jarek P.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPROUTE 04/05]: Replace "usec" by "time" in function names

2007-01-10 Thread Patrick McHardy
[IPROUTE]: Replace "usec" by "time" in function names

Rename functions containing "usec" since they don't necessarily return
usec units anymore.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit d1980613b2921fcc288858f4c63727f28ca49607
tree b67f63e36a80cad46173635c5c7ba65305fa8aed
parent df1c304ddaedfd5bfa6ca39cc66560c1618e2928
author Patrick McHardy <[EMAIL PROTECTED]> Wed, 10 Jan 2007 10:43:00 +0100
committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 10 Jan 2007 10:43:00 +0100

 tc/m_estimator.c |4 ++--
 tc/q_cbq.c   |6 +++---
 tc/q_hfsc.c  |6 +++---
 tc/q_netem.c |6 +++---
 tc/q_tbf.c   |8 
 tc/tc_cbq.c  |4 ++--
 tc/tc_core.c |   14 +++---
 tc/tc_core.h |6 +++---
 tc/tc_util.c |   14 +++---
 tc/tc_util.h |6 +++---
 10 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/tc/m_estimator.c b/tc/m_estimator.c
index d931551..a9e5dbc 100644
--- a/tc/m_estimator.c
+++ b/tc/m_estimator.c
@@ -45,12 +45,12 @@ int parse_estimator(int *p_argc, char **
duparg("estimator", *argv);
if (matches(*argv, "help") == 0)
est_help();
-   if (get_usecs(&A, *argv))
+   if (get_time(&A, *argv))
invarg("estimator", "invalid estimator interval");
NEXT_ARG();
if (matches(*argv, "help") == 0)
est_help();
-   if (get_usecs(&time_const, *argv))
+   if (get_time(&time_const, *argv))
invarg("estimator", "invalid estimator time constant");
if (tc_setup_estimator(A, time_const, est) < 0) {
fprintf(stderr, "Error: estimator parameters are out of 
range.\n");
diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index a56..913b26a 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -500,17 +500,17 @@ static int cbq_print_opt(struct qdisc_ut
if (lss && show_details) {
fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, 
lss->ewma_log, lss->avpkt);
if (lss->maxidle) {
-   fprintf(f, "maxidle %luus ", 
tc_core_tick2usec(lss->maxidle>>lss->ewma_log));
+   fprintf(f, "maxidle %luus ", 
tc_core_tick2time(lss->maxidle>>lss->ewma_log));
if (show_raw)
fprintf(f, "[%08x] ", lss->maxidle);
}
if (lss->minidle!=0x7fff) {
-   fprintf(f, "minidle %luus ", 
tc_core_tick2usec(lss->minidle>>lss->ewma_log));
+   fprintf(f, "minidle %luus ", 
tc_core_tick2time(lss->minidle>>lss->ewma_log));
if (show_raw)
fprintf(f, "[%08x] ", lss->minidle);
}
if (lss->offtime) {
-   fprintf(f, "offtime %luus ", 
tc_core_tick2usec(lss->offtime));
+   fprintf(f, "offtime %luus ", 
tc_core_tick2time(lss->offtime));
if (show_raw)
fprintf(f, "[%08x] ", lss->offtime);
}
diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c
index f7a30f2..b190c71 100644
--- a/tc/q_hfsc.c
+++ b/tc/q_hfsc.c
@@ -226,7 +226,7 @@ hfsc_print_sc(FILE *f, char *name, struc
 
fprintf(f, "%s ", name);
fprintf(f, "m1 %s ", sprint_rate(sc->m1, b1));
-   fprintf(f, "d %s ", sprint_usecs(tc_core_ktime2time(sc->d), b1));
+   fprintf(f, "d %s ", sprint_time(tc_core_ktime2time(sc->d), b1));
fprintf(f, "m2 %s ", sprint_rate(sc->m2, b1));
 }
 
@@ -303,7 +303,7 @@ hfsc_get_sc1(int *argcp, char ***argvp, 
 
if (matches(*argv, "d") == 0) {
NEXT_ARG();
-   if (get_usecs(&d, *argv) < 0) {
+   if (get_time(&d, *argv) < 0) {
explain1("d");
return -1;
}
@@ -346,7 +346,7 @@ hfsc_get_sc2(int *argcp, char ***argvp, 
 
if (matches(*argv, "dmax") == 0) {
NEXT_ARG();
-   if (get_usecs(&dmax, *argv) < 0) {
+   if (get_time(&dmax, *argv) < 0) {
explain1("dmax");
return -1;
}
diff --git a/tc/q_netem.c b/tc/q_netem.c
index cfd1799..24fb95e 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -108,15 +108,15 @@ static int get_ticks(__u32 *ticks, const
 {
unsigned t;
 
-   if(get_usecs(&t, str))
+   if(get_time(&t, str))
return -1;
 
-   if (tc_core_usec2big(t)) {
+   if (tc_core_time2big(t)) {
fprintf(stderr, "Illegal %d usecs (too large)\n", t);
return -1;
}
 
-   *ticks = tc_core_usec2tick(t);
+   *ticks = tc_core_time2tick(t);
return 0;
 }
 
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index 5ba3631..566afa0 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -67,7 +67,7 @@ static int tbf_parse_opt(struct qdisc_ut
fprintf(stderr, "Double \"limit/laten

[IPROUTE 04/05]: Replace "usec" by "time" in function names

2006-06-23 Thread Patrick McHardy
[IPROUTE]: Replace "usec" by "time" in function names

Rename functions containing "usec" since they don't necessarily return
usec units anymore.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit 67edfb2c86323a1c52a60538f677310f6c75efdf
tree 37302dfd036340aac8c7f2070ebcbc570fd634ed
parent 8e2cc14ba6fb8f940de72f307e67eb9040a5d4f7
author Patrick McHardy <[EMAIL PROTECTED]> Fri, 23 Jun 2006 19:47:14 +0200
committer Patrick McHardy <[EMAIL PROTECTED]> Fri, 23 Jun 2006 19:47:14 +0200

 tc/m_estimator.c |4 ++--
 tc/q_cbq.c   |6 +++---
 tc/q_hfsc.c  |6 +++---
 tc/q_netem.c |6 +++---
 tc/q_tbf.c   |8 
 tc/tc_cbq.c  |4 ++--
 tc/tc_core.c |   10 +-
 tc/tc_core.h |4 ++--
 tc/tc_util.c |   14 +++---
 tc/tc_util.h |6 +++---
 10 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/tc/m_estimator.c b/tc/m_estimator.c
index 78eda7a..898ff80 100644
--- a/tc/m_estimator.c
+++ b/tc/m_estimator.c
@@ -45,12 +45,12 @@ int parse_estimator(int *p_argc, char **
duparg("estimator", *argv);
if (matches(*argv, "help") == 0)
est_help();
-   if (get_usecs(&A, *argv))
+   if (get_time(&A, *argv))
invarg("estimator", "invalid estimator interval");
NEXT_ARG();
if (matches(*argv, "help") == 0)
est_help();
-   if (get_usecs(&time_const, *argv))
+   if (get_time(&time_const, *argv))
invarg("estimator", "invalid estimator time constant");
if (tc_setup_estimator(A, time_const, est) < 0) {
fprintf(stderr, "Error: estimator parameters are out of 
range.\n");
diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index 045c377..648acd0 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -500,17 +500,17 @@ static int cbq_print_opt(struct qdisc_ut
if (lss && show_details) {
fprintf(f, "\nlevel %u ewma %u avpkt %ub ", lss->level, 
lss->ewma_log, lss->avpkt);
if (lss->maxidle) {
-   fprintf(f, "maxidle %luus ", 
tc_core_tick2usec(lss->maxidle>>lss->ewma_log));
+   fprintf(f, "maxidle %luus ", 
tc_core_tick2time(lss->maxidle>>lss->ewma_log));
if (show_raw)
fprintf(f, "[%08x] ", lss->maxidle);
}
if (lss->minidle!=0x7fff) {
-   fprintf(f, "minidle %luus ", 
tc_core_tick2usec(lss->minidle>>lss->ewma_log));
+   fprintf(f, "minidle %luus ", 
tc_core_tick2time(lss->minidle>>lss->ewma_log));
if (show_raw)
fprintf(f, "[%08x] ", lss->minidle);
}
if (lss->offtime) {
-   fprintf(f, "offtime %luus ", 
tc_core_tick2usec(lss->offtime));
+   fprintf(f, "offtime %luus ", 
tc_core_tick2time(lss->offtime));
if (show_raw)
fprintf(f, "[%08x] ", lss->offtime);
}
diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c
index be0587f..6c160c9 100644
--- a/tc/q_hfsc.c
+++ b/tc/q_hfsc.c
@@ -226,7 +226,7 @@ hfsc_print_sc(FILE *f, char *name, struc
 
fprintf(f, "%s ", name);
fprintf(f, "m1 %s ", sprint_rate(sc->m1, b1));
-   fprintf(f, "d %s ", sprint_usecs(tc_core_ktime2time(sc->d), b1));
+   fprintf(f, "d %s ", sprint_time(tc_core_ktime2time(sc->d), b1));
fprintf(f, "m2 %s ", sprint_rate(sc->m2, b1));
 }
 
@@ -303,7 +303,7 @@ hfsc_get_sc1(int *argcp, char ***argvp, 
 
if (matches(*argv, "d") == 0) {
NEXT_ARG();
-   if (get_usecs(&d, *argv) < 0) {
+   if (get_time(&d, *argv) < 0) {
explain1("d");
return -1;
}
@@ -346,7 +346,7 @@ hfsc_get_sc2(int *argcp, char ***argvp, 
 
if (matches(*argv, "dmax") == 0) {
NEXT_ARG();
-   if (get_usecs(&dmax, *argv) < 0) {
+   if (get_time(&dmax, *argv) < 0) {
explain1("dmax");
return -1;
}
diff --git a/tc/q_netem.c b/tc/q_netem.c
index 757edca..cc16a28 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -108,16 +108,16 @@ static int get_ticks(__u32 *ticks, const
 {
unsigned t;
 
-   if(get_usecs(&t, str))
+   if(get_time(&t, str))
return -1;

-   *ticks = tc_core_usec2tick(t);
+   *ticks = tc_core_time2tick(t);
return 0;
 }
 
 static char *sprint_ticks(__u32 ticks, char *buf)
 {
-   return sprint_usecs(tc_core_tick2usec(ticks), buf);
+   return sprint_time(tc_core_tick2time(ticks), buf);
 }
 
 
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index f2ffb7e..4db4b44 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -67,7 +67,7 @@ static int tbf_parse_opt(struct qdisc_ut
fprintf(stderr, "Double \"limit/lat