const: constify remaining dev_pm_ops
[safe/jmp/linux-2.6] / net / core / gen_stats.c
index c3d0ffe..393b1d8 100644 (file)
@@ -106,22 +106,28 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
  * if the room in the socket buffer was not sufficient.
  */
 int
-gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b)
+gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
 {
        if (d->compat_tc_stats) {
                d->tc_stats.bytes = b->bytes;
                d->tc_stats.packets = b->packets;
        }
 
-       if (d->tail)
-               return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b));
+       if (d->tail) {
+               struct gnet_stats_basic sb;
 
+               memset(&sb, 0, sizeof(sb));
+               sb.bytes = b->bytes;
+               sb.packets = b->packets;
+               return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb));
+       }
        return 0;
 }
 
 /**
  * gnet_stats_copy_rate_est - copy rate estimator statistics into statistics TLV
  * @d: dumping handle
+ * @b: basic statistics
  * @r: rate estimator statistics
  *
  * Appends the rate estimator statistics to the top level TLV created by
@@ -131,8 +137,13 @@ gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b)
  * if the room in the socket buffer was not sufficient.
  */
 int
-gnet_stats_copy_rate_est(struct gnet_dump *d, struct gnet_stats_rate_est *r)
+gnet_stats_copy_rate_est(struct gnet_dump *d,
+                        const struct gnet_stats_basic_packed *b,
+                        struct gnet_stats_rate_est *r)
 {
+       if (b && !gen_estimator_active(b, r))
+               return 0;
+
        if (d->compat_tc_stats) {
                d->tc_stats.bps = r->bps;
                d->tc_stats.pps = r->pps;