diff options
Diffstat (limited to 'bgpd/bgp_table.c')
| -rw-r--r-- | bgpd/bgp_table.c | 98 |
1 files changed, 44 insertions, 54 deletions
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 06e443b25a..49ea0b5770 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -30,97 +30,87 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" -void -bgp_table_lock (struct bgp_table *rt) +void bgp_table_lock(struct bgp_table *rt) { - rt->lock++; + rt->lock++; } -void -bgp_table_unlock (struct bgp_table *rt) +void bgp_table_unlock(struct bgp_table *rt) { - assert (rt->lock > 0); - rt->lock--; + assert(rt->lock > 0); + rt->lock--; - if (rt->lock != 0) - { - return; - } + if (rt->lock != 0) { + return; + } - route_table_finish (rt->route_table); - rt->route_table = NULL; + route_table_finish(rt->route_table); + rt->route_table = NULL; - if (rt->owner) - { - peer_unlock (rt->owner); - rt->owner = NULL; - } + if (rt->owner) { + peer_unlock(rt->owner); + rt->owner = NULL; + } - XFREE (MTYPE_BGP_TABLE, rt); + XFREE(MTYPE_BGP_TABLE, rt); } -void -bgp_table_finish (struct bgp_table **rt) +void bgp_table_finish(struct bgp_table **rt) { - if (*rt != NULL) - { - bgp_table_unlock(*rt); - *rt = NULL; - } + if (*rt != NULL) { + bgp_table_unlock(*rt); + *rt = NULL; + } } /* * bgp_node_create */ -static struct route_node * -bgp_node_create (route_table_delegate_t *delegate, struct route_table *table) +static struct route_node *bgp_node_create(route_table_delegate_t *delegate, + struct route_table *table) { - struct bgp_node *node; - node = XCALLOC (MTYPE_BGP_NODE, sizeof (struct bgp_node)); - return bgp_node_to_rnode (node); + struct bgp_node *node; + node = XCALLOC(MTYPE_BGP_NODE, sizeof(struct bgp_node)); + return bgp_node_to_rnode(node); } /* * bgp_node_destroy */ -static void -bgp_node_destroy (route_table_delegate_t *delegate, - struct route_table *table, struct route_node *node) +static void bgp_node_destroy(route_table_delegate_t *delegate, + struct route_table *table, struct route_node *node) { - struct bgp_node *bgp_node; - bgp_node = bgp_node_from_rnode (node); - XFREE (MTYPE_BGP_NODE, bgp_node); + struct bgp_node *bgp_node; + bgp_node = bgp_node_from_rnode(node); + XFREE(MTYPE_BGP_NODE, bgp_node); } /* * Function vector to customize the behavior of the route table * library for BGP route tables. */ -route_table_delegate_t bgp_table_delegate = { - .create_node = bgp_node_create, - .destroy_node = bgp_node_destroy -}; +route_table_delegate_t bgp_table_delegate = {.create_node = bgp_node_create, + .destroy_node = bgp_node_destroy}; /* * bgp_table_init */ -struct bgp_table * -bgp_table_init (afi_t afi, safi_t safi) +struct bgp_table *bgp_table_init(afi_t afi, safi_t safi) { - struct bgp_table *rt; + struct bgp_table *rt; - rt = XCALLOC (MTYPE_BGP_TABLE, sizeof (struct bgp_table)); + rt = XCALLOC(MTYPE_BGP_TABLE, sizeof(struct bgp_table)); - rt->route_table = route_table_init_with_delegate (&bgp_table_delegate); + rt->route_table = route_table_init_with_delegate(&bgp_table_delegate); - /* - * Set up back pointer to bgp_table. - */ - rt->route_table->info = rt; + /* + * Set up back pointer to bgp_table. + */ + rt->route_table->info = rt; - bgp_table_lock (rt); - rt->afi = afi; - rt->safi = safi; + bgp_table_lock(rt); + rt->afi = afi; + rt->safi = safi; - return rt; + return rt; } |
