On Tue, Oct 04, 2011 at 06:47:23PM -0700, Jesse Gross wrote: > On Tue, Oct 4, 2011 at 2:17 PM, Ben Pfaff <[email protected]> wrote: > > diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c > > index c104dfd..9414dec 100644 > > --- a/lib/dpif-linux.c > > +++ b/lib/dpif-linux.c > > @@ -338,7 +338,12 @@ dpif_linux_get_stats(const struct dpif *dpif_, struct > > ovs_dp_stats *stats) > > > > ?? ?? error = dpif_linux_dp_get(dpif_, &dp, &buf); > > ?? ?? if (!error) { > > - ?? ?? ?? ??*stats = dp.stats; > > + ?? ?? ?? ??memset(stats, 0, sizeof *stats); > > + ?? ?? ?? ??stats->n_frags ??= dp.stats.n_frags; > > + ?? ?? ?? ??stats->n_hit ?? ??= dp.stats.n_hit; > > + ?? ?? ?? ??stats->n_missed = dp.stats.n_missed; > > + ?? ?? ?? ??stats->n_lost ?? = dp.stats.n_lost; > > + ?? ?? ?? ??stats->n_flows ??= dp.stats.n_flows; > > I'm not quite sure why we memset the stats struct to 0 before setting > all of the fields although I see that we do the same thing in > dpif-netdev.c.
It's just conservative future-proofing against adding fields later. But that's kind of silly (any "grep" will find these users), so I'm just happy to remove them if you like. > Otherwise this looks good to me, thanks. Thanks. _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
