summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_table.c
diff options
context:
space:
mode:
authorpaul <paul>2006-03-30 13:20:48 +0000
committerpaul <paul>2006-03-30 13:20:48 +0000
commit236607f01ea375d0cce9d94ce67a0f320e787676 (patch)
treedc975956aa23b263f29befc40fa5c23df7414068 /bgpd/bgp_table.c
parent1b1bfa34be7a602f9481ab44727f8d96e94fd7a6 (diff)
downloadquagga-236607f01ea375d0cce9d94ce67a0f320e787676.tar.bz2
quagga-236607f01ea375d0cce9d94ce67a0f320e787676.tar.xz
[bgpd] rearrange some structs for less padding, stats for table/attrs.
2006-03-12 Paul Jakma <paul.jakma@sun.com> * bgp_attr.h: (struct attr) rearrange fields to avoid wasted padding between them as much as possible. (attr_count,attr_unknown_count) export new functions to return number of counts of cached attributes. * bgp_attr.c: (attr_count,attr_unknown_count) new functions to return number of counts of cached attributes. * bgp_route.h: (struct bgp_info) rearrange fields to avoid wasted padding. * bgp_table.h: (struct bgp_table) Add a count field, of number of nodes in the table. (struct bgp_node) rearrange fields to avoid wasted padding between them, though I don't think there was any in this case. * bgp_table.c: (bgp_node_{delete,get}) Maintain the table node count. (bgp_table_count) new function to access the table count.
Diffstat (limited to 'bgpd/bgp_table.c')
-rw-r--r--bgpd/bgp_table.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index a3b489d5..810dab54 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -350,8 +350,10 @@ bgp_node_get (struct bgp_table *table, struct prefix *p)
match = new;
new = bgp_node_set (table, p);
set_link (match, new);
+ table->count++;
}
}
+ table->count++;
bgp_lock_node (new);
return new;
@@ -389,7 +391,9 @@ bgp_node_delete (struct bgp_node *node)
}
else
node->table->top = child;
-
+
+ node->table->count--;
+
bgp_node_free (node);
/* If parent node is stub then delete it also. */
@@ -492,3 +496,9 @@ bgp_route_next_until (struct bgp_node *node, struct bgp_node *limit)
bgp_unlock_node (start);
return NULL;
}
+
+unsigned long
+bgp_table_count (struct bgp_table *table)
+{
+ return table->count;
+}