# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/03/29 02:55:11+02:00 tgraf@xxxxxxx # [NET]: Make primary TLV type optional # # Allows the use of the gnet_stats API for backward compatiblity # cases where no "modern" TLV structure is needed. # # Signed-off-by: Thomas Graf # Signed-off-by: David S. Miller # # net/core/gen_stats.c # 2005/03/29 02:54:56+02:00 tgraf@xxxxxxx +7 -3 # [NET]: Make primary TLV type optional # diff -Nru a/net/core/gen_stats.c b/net/core/gen_stats.c --- a/net/core/gen_stats.c 2005-03-30 02:59:19 +02:00 +++ b/net/core/gen_stats.c 2005-03-30 02:59:19 +02:00 @@ -26,7 +26,9 @@ static inline int gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) { - RTA_PUT(d->skb, type, size, buf); + if (type) + RTA_PUT(d->skb, type, size, buf); + return 0; rtattr_failure: @@ -58,7 +60,8 @@ { spin_lock_bh(lock); d->lock = lock; - d->tail = (struct rtattr *) skb->tail; + if (type) + d->tail = (struct rtattr *) skb->tail; d->skb = skb; d->compat_tc_stats = tc_stats_type; d->compat_xstats = xstats_type; @@ -194,7 +197,8 @@ int gnet_stats_finish_copy(struct gnet_dump *d) { - d->tail->rta_len = d->skb->tail - (u8 *) d->tail; + if (d->tail) + d->tail->rta_len = d->skb->tail - (u8 *) d->tail; if (d->compat_tc_stats) if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats,