diff mbox series

[ovs-dev,v2] sflow functions: fix unused parameter warnings for sflow functions

Message ID 20210915213219.154-1-sergey.madaminov@gmail.com
State Accepted
Headers show
Series [ovs-dev,v2] sflow functions: fix unused parameter warnings for sflow functions | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Sergey Madaminov Sept. 15, 2021, 9:32 p.m. UTC
From: Sergey Madaminov <sergey.madaminov@gmail.com>

Several 'sflow' functions (sfl_poller_tick, sfl_sampler_tick, and
sfl_receiver_tick) have unused parameter 'now' in their signatures. This patch
removes that parameter from their signatures to fix compilation warnings.

Also, according to the 'utilities/checkpatch.py', there should be an indent
between 'for' keyword an opening left paren. Additionally, the line containing
'for' keyword had to end with an opening curly brace. Therefore, I did a bit of
formatting besides removing the unused parameter in the modified code.

Signed-off-by: Sergey Madaminov <sergey.madaminov@gmail.com>

---
v1->v2: fix errors reported by checkpatch.py
  * in lib/sflow_agent.c whitespace between 'for' and left paren
  * in lib/sflow_agent.c line with 'for' ends with a curly brace

---
 lib/sflow_agent.c    | 12 +++++++++---
 lib/sflow_api.h      |  6 +++---
 lib/sflow_poller.c   |  2 +-
 lib/sflow_receiver.c |  2 +-
 lib/sflow_sampler.c  |  2 +-
 5 files changed, 15 insertions(+), 9 deletions(-)

Comments

Michael Santana Sept. 22, 2021, 5:18 p.m. UTC | #1
On 9/15/21 5:32 PM, sergey.madaminov@gmail.com wrote:
> From: Sergey Madaminov <sergey.madaminov@gmail.com>
> 
> Several 'sflow' functions (sfl_poller_tick, sfl_sampler_tick, and
> sfl_receiver_tick) have unused parameter 'now' in their signatures. This patch
> removes that parameter from their signatures to fix compilation warnings.
You are right. The parameter 'now' is not used the poller, sampler, and 
receiver functions and should be removed. It looks like copy-paste error 
from sfl_agent_tick() since it has the same parameter signature

Reviewed-by: Michael Santana <msantana@redhat.com>
> 
> Also, according to the 'utilities/checkpatch.py', there should be an indent
> between 'for' keyword an opening left paren. Additionally, the line containing
> 'for' keyword had to end with an opening curly brace. Therefore, I did a bit of
> formatting besides removing the unused parameter in the modified code.
> 
> Signed-off-by: Sergey Madaminov <sergey.madaminov@gmail.com>
> 
> ---
> v1->v2: fix errors reported by checkpatch.py
>    * in lib/sflow_agent.c whitespace between 'for' and left paren
>    * in lib/sflow_agent.c line with 'for' ends with a curly brace
> 
> ---
>   lib/sflow_agent.c    | 12 +++++++++---
>   lib/sflow_api.h      |  6 +++---
>   lib/sflow_poller.c   |  2 +-
>   lib/sflow_receiver.c |  2 +-
>   lib/sflow_sampler.c  |  2 +-
>   5 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/sflow_agent.c b/lib/sflow_agent.c
> index 878c3da01..c95f654a5 100644
> --- a/lib/sflow_agent.c
> +++ b/lib/sflow_agent.c
> @@ -129,14 +129,20 @@ void sfl_agent_tick(SFLAgent *agent, time_t now)
>       SFLPoller *pl = agent->pollers;
>       agent->now = now;
>       /* samplers use ticks to decide when they are sampling too fast */
> -    for(; sm != NULL; sm = sm->nxt) sfl_sampler_tick(sm, now);
> +    for (; sm != NULL; sm = sm->nxt) {
> +        sfl_sampler_tick(sm);
> +    }
>       /* pollers use ticks to decide when to ask for counters */
> -    for(; pl != NULL; pl = pl->nxt) sfl_poller_tick(pl, now);
> +    for (; pl != NULL; pl = pl->nxt) {
> +        sfl_poller_tick(pl);
> +    }
>       /* receivers use ticks to flush send data.  By doing this
>        * step last we ensure that fresh counters polled during
>        * sfl_poller_tick() above will be flushed promptly.
>        */
> -    for(; rcv != NULL; rcv = rcv->nxt) sfl_receiver_tick(rcv, now);
> +    for (; rcv != NULL; rcv = rcv->nxt) {
> +        sfl_receiver_tick(rcv);
> +    }
>   }
>   
>   /*_________________---------------------------__________________
> diff --git a/lib/sflow_api.h b/lib/sflow_api.h
> index 7264fc1c5..a0530b37a 100644
> --- a/lib/sflow_api.h
> +++ b/lib/sflow_api.h
> @@ -323,9 +323,9 @@ void sfl_sampler_init(SFLSampler *sampler, SFLAgent *agent, SFLDataSource_instan
>   void sfl_poller_init(SFLPoller *poller, SFLAgent *agent, SFLDataSource_instance *pdsi, void *magic, getCountersFn_t getCountersFn);
>   
>   
> -void sfl_receiver_tick(SFLReceiver *receiver, time_t now);
> -void sfl_poller_tick(SFLPoller *poller, time_t now);
> -void sfl_sampler_tick(SFLSampler *sampler, time_t now);
> +void sfl_receiver_tick(SFLReceiver *receiver);
> +void sfl_poller_tick(SFLPoller *poller);
> +void sfl_sampler_tick(SFLSampler *sampler);
>   
>   int sfl_receiver_writeFlowSample(SFLReceiver *receiver, SFL_FLOW_SAMPLE_TYPE *fs);
>   int sfl_receiver_writeCountersSample(SFLReceiver *receiver, SFL_COUNTERS_SAMPLE_TYPE *cs);
> diff --git a/lib/sflow_poller.c b/lib/sflow_poller.c
> index d2e415521..9e6a487bc 100644
> --- a/lib/sflow_poller.c
> +++ b/lib/sflow_poller.c
> @@ -125,7 +125,7 @@ void sfl_poller_resetCountersSeqNo(SFLPoller *poller) {  poller->countersSampleS
>     -----------------___________________________------------------
>   */
>   
> -void sfl_poller_tick(SFLPoller *poller, time_t now)
> +void sfl_poller_tick(SFLPoller *poller)
>   {
>       if(poller->countersCountdown == 0) return; /* counters retrieval was not enabled */
>       if(poller->sFlowCpReceiver == 0) return;
> diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c
> index cde1359c4..4162518e3 100644
> --- a/lib/sflow_receiver.c
> +++ b/lib/sflow_receiver.c
> @@ -141,7 +141,7 @@ void sfl_receiver_set_sFlowRcvrPort(SFLReceiver *receiver, u_int32_t sFlowRcvrPo
>     -----------------___________________________------------------
>   */
>   
> -void sfl_receiver_tick(SFLReceiver *receiver, time_t now)
> +void sfl_receiver_tick(SFLReceiver *receiver)
>   {
>       // if there are any samples to send, flush them now
>       if(receiver->sampleCollector.numSamples > 0) sendSample(receiver);
> diff --git a/lib/sflow_sampler.c b/lib/sflow_sampler.c
> index 7406cc94a..b8cb5ac4a 100644
> --- a/lib/sflow_sampler.c
> +++ b/lib/sflow_sampler.c
> @@ -107,7 +107,7 @@ void sfl_sampler_resetFlowSeqNo(SFLSampler *sampler) { sampler->flowSampleSeqNo
>     -----------------___________________________------------------
>   */
>   
> -void sfl_sampler_tick(SFLSampler *sampler, time_t now)
> +void sfl_sampler_tick(SFLSampler *sampler)
>   {
>       if(sampler->backoffThreshold && sampler->samplesThisTick > sampler->backoffThreshold) {
>   	/* automatic backoff.  If using hardware sampling then this is where you have to
>
diff mbox series

Patch

diff --git a/lib/sflow_agent.c b/lib/sflow_agent.c
index 878c3da01..c95f654a5 100644
--- a/lib/sflow_agent.c
+++ b/lib/sflow_agent.c
@@ -129,14 +129,20 @@  void sfl_agent_tick(SFLAgent *agent, time_t now)
     SFLPoller *pl = agent->pollers;
     agent->now = now;
     /* samplers use ticks to decide when they are sampling too fast */
-    for(; sm != NULL; sm = sm->nxt) sfl_sampler_tick(sm, now);
+    for (; sm != NULL; sm = sm->nxt) {
+        sfl_sampler_tick(sm);
+    }
     /* pollers use ticks to decide when to ask for counters */
-    for(; pl != NULL; pl = pl->nxt) sfl_poller_tick(pl, now);
+    for (; pl != NULL; pl = pl->nxt) {
+        sfl_poller_tick(pl);
+    }
     /* receivers use ticks to flush send data.  By doing this
      * step last we ensure that fresh counters polled during
      * sfl_poller_tick() above will be flushed promptly.
      */
-    for(; rcv != NULL; rcv = rcv->nxt) sfl_receiver_tick(rcv, now);
+    for (; rcv != NULL; rcv = rcv->nxt) {
+        sfl_receiver_tick(rcv);
+    }
 }
 
 /*_________________---------------------------__________________
diff --git a/lib/sflow_api.h b/lib/sflow_api.h
index 7264fc1c5..a0530b37a 100644
--- a/lib/sflow_api.h
+++ b/lib/sflow_api.h
@@ -323,9 +323,9 @@  void sfl_sampler_init(SFLSampler *sampler, SFLAgent *agent, SFLDataSource_instan
 void sfl_poller_init(SFLPoller *poller, SFLAgent *agent, SFLDataSource_instance *pdsi, void *magic, getCountersFn_t getCountersFn);
 
 
-void sfl_receiver_tick(SFLReceiver *receiver, time_t now);
-void sfl_poller_tick(SFLPoller *poller, time_t now);
-void sfl_sampler_tick(SFLSampler *sampler, time_t now);
+void sfl_receiver_tick(SFLReceiver *receiver);
+void sfl_poller_tick(SFLPoller *poller);
+void sfl_sampler_tick(SFLSampler *sampler);
 
 int sfl_receiver_writeFlowSample(SFLReceiver *receiver, SFL_FLOW_SAMPLE_TYPE *fs);
 int sfl_receiver_writeCountersSample(SFLReceiver *receiver, SFL_COUNTERS_SAMPLE_TYPE *cs);
diff --git a/lib/sflow_poller.c b/lib/sflow_poller.c
index d2e415521..9e6a487bc 100644
--- a/lib/sflow_poller.c
+++ b/lib/sflow_poller.c
@@ -125,7 +125,7 @@  void sfl_poller_resetCountersSeqNo(SFLPoller *poller) {  poller->countersSampleS
   -----------------___________________________------------------
 */
 
-void sfl_poller_tick(SFLPoller *poller, time_t now)
+void sfl_poller_tick(SFLPoller *poller)
 {
     if(poller->countersCountdown == 0) return; /* counters retrieval was not enabled */
     if(poller->sFlowCpReceiver == 0) return;
diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c
index cde1359c4..4162518e3 100644
--- a/lib/sflow_receiver.c
+++ b/lib/sflow_receiver.c
@@ -141,7 +141,7 @@  void sfl_receiver_set_sFlowRcvrPort(SFLReceiver *receiver, u_int32_t sFlowRcvrPo
   -----------------___________________________------------------
 */
 
-void sfl_receiver_tick(SFLReceiver *receiver, time_t now)
+void sfl_receiver_tick(SFLReceiver *receiver)
 {
     // if there are any samples to send, flush them now
     if(receiver->sampleCollector.numSamples > 0) sendSample(receiver);
diff --git a/lib/sflow_sampler.c b/lib/sflow_sampler.c
index 7406cc94a..b8cb5ac4a 100644
--- a/lib/sflow_sampler.c
+++ b/lib/sflow_sampler.c
@@ -107,7 +107,7 @@  void sfl_sampler_resetFlowSeqNo(SFLSampler *sampler) { sampler->flowSampleSeqNo
   -----------------___________________________------------------
 */
 
-void sfl_sampler_tick(SFLSampler *sampler, time_t now)
+void sfl_sampler_tick(SFLSampler *sampler)
 {
     if(sampler->backoffThreshold && sampler->samplesThisTick > sampler->backoffThreshold) {
 	/* automatic backoff.  If using hardware sampling then this is where you have to