[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.
diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h
index e13022b..62421e7 100644
--- a/bgpd/bgp_table.h
+++ b/bgpd/bgp_table.h
@@ -39,6 +39,8 @@
void *owner;
struct bgp_node *top;
+
+ unsigned long count;
};
struct bgp_node
@@ -51,18 +53,16 @@
#define l_left link[0]
#define l_right link[1]
- unsigned int lock;
-
void *info;
struct bgp_adj_out *adj_out;
struct bgp_adj_in *adj_in;
- void *aggregate;
-
struct bgp_node *prn;
+ unsigned int lock;
+
u_char flags;
#define BGP_NODE_PROCESS_SCHEDULED (1 << 0)
};
@@ -84,5 +84,5 @@
extern struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *,
struct in6_addr *);
#endif /* HAVE_IPV6 */
-
+extern unsigned long bgp_table_count (struct bgp_table *);
#endif /* _QUAGGA_BGP_TABLE_H */