aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2008-08-11 03:19:14 -0400
committerSven Wegener <sven.wegener@stealer.net>2008-08-11 08:00:55 -0400
commite93615d0866a974afc7148172f8382e2af48c985 (patch)
treef07e57c99390cc3b535c4bf4ae3c3f5a94da1579
parent519e49e888458649dde453d36c08b7f3432525dc (diff)
ipvs: Explictly clear ip_vs_stats members
In order to align the coding styles of ip_vs_zero_stats() and its child-function ip_vs_zero_estimator(), clear ip_vs_stats members explicitlty rather than doing a limited memset(). This was chosen over modifying ip_vs_zero_estimator() to use memset() as it is more robust against changes in members in the relevant structures. memset() would be prefered if all members of the structure were to be cleared. Cc: Sven Wegener <sven.wegener@stealer.net> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index cfb1d20993d1..6379705a8dcb 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -683,8 +683,21 @@ static void
683ip_vs_zero_stats(struct ip_vs_stats *stats) 683ip_vs_zero_stats(struct ip_vs_stats *stats)
684{ 684{
685 spin_lock_bh(&stats->lock); 685 spin_lock_bh(&stats->lock);
686 memset(stats, 0, (char *)&stats->lock - (char *)stats); 686
687 stats->conns = 0;
688 stats->inpkts = 0;
689 stats->outpkts = 0;
690 stats->inbytes = 0;
691 stats->outbytes = 0;
692
693 stats->cps = 0;
694 stats->inpps = 0;
695 stats->outpps = 0;
696 stats->inbps = 0;
697 stats->outbps = 0;
698
687 ip_vs_zero_estimator(stats); 699 ip_vs_zero_estimator(stats);
700
688 spin_unlock_bh(&stats->lock); 701 spin_unlock_bh(&stats->lock);
689} 702}
690 703