0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 12:48:43 +00:00

Resource pool closing has its dedicated function

This commit is contained in:
Maria Matejka 2023-04-20 21:08:38 +02:00
parent b3f805ce29
commit 1141ce4e2d
14 changed files with 24 additions and 17 deletions

View File

@ -200,7 +200,7 @@ config_free(struct config *c)
ASSERT(!c->obstacle_count);
rfree(c->pool);
rp_free(c->pool);
}
/**

View File

@ -298,7 +298,7 @@ void
tmp_flush(void)
{
lp_flush(tmp_linpool);
rfree(tmp_res.pool);
rp_free(tmp_res.pool);
tmp_res.pool = rp_new(tmp_res.parent, "TMP");
}
@ -449,7 +449,7 @@ mb_free(void *m)
return;
struct mblock *b = SKIP_BACK(struct mblock, data, m);
rfree(b);
rfree(&b->r);
}

View File

@ -58,6 +58,12 @@ void rmove(void *, pool *); /* Move to a different pool */
void *ralloc(pool *, struct resclass *);
pool *rp_new(pool *, const char *); /* Create a new pool */
pool *rp_newf(pool *, const char *, ...); /* Create a new pool with a formatted string as its name */
void rp_init(pool *, const char *); /* Init a new pool */
void rp_initf(pool *, const char *, ...); /* Init a new pool with a formatted string as its name */
static inline void rp_free(pool *p) { rfree(&p->r); } /* Free the whole pool */
extern pool root_pool;
/* Normal memory blocks */
@ -111,6 +117,7 @@ slab *sl_new(pool *, unsigned size);
void *sl_alloc(slab *);
void *sl_allocz(slab *);
void sl_free(void *);
void sl_delete(slab *);
/*
* Low-level memory allocation functions, please don't use

View File

@ -421,7 +421,7 @@ cli_free(cli *c)
c->sock = NULL;
}
else
rfree(c->pool);
rp_free(c->pool);
}
/**

View File

@ -1116,7 +1116,7 @@ proto_cleanup(struct proto *p)
{
CALL(p->proto->cleanup, p);
rfree(p->pool);
rp_free(p->pool);
p->pool = NULL;
p->active = 0;

View File

@ -227,7 +227,7 @@ rt_show_export_stopped_cleanup(struct rt_export_request *req)
req->hook = NULL;
/* And free the CLI (deferred) */
rfree(d->cli->pool);
rp_free(d->cli->pool);
}
static int

View File

@ -2027,7 +2027,7 @@ rt_export_stopped(struct rt_export_hook *hook)
rem_node(&hook->n);
/* Free the hook itself together with its pool */
rfree(hook->pool);
rp_free(hook->pool);
}
static inline void

View File

@ -1881,7 +1881,7 @@ babel_remove_iface(struct babel_proto *p, struct babel_iface *ifa)
rem_node(NODE ifa);
rfree(ifa->pool); /* contains ifa itself, locks, socket, etc */
rp_free(ifa->pool); /* contains ifa itself, locks, socket, etc */
}
static int

View File

@ -1867,7 +1867,7 @@ bgp_free_pending_tx(struct bgp_channel *c)
ASSERT_DIE(c->ptx);
ASSERT_DIE(c->ptx->pool);
rfree(c->ptx->pool);
rp_free(c->ptx->pool);
c->ptx = NULL;
}

View File

@ -590,7 +590,7 @@ mrt_table_dump_free(struct mrt_table_dump_state *s)
config_del_obstacle(s->config);
rfree(s->pool);
rp_free(s->pool);
}

View File

@ -311,7 +311,7 @@ ospf_iface_remove(struct ospf_iface *ifa)
ospf_iface_sm(ifa, ISM_DOWN);
rem_node(NODE ifa);
rfree(ifa->pool);
rp_free(ifa->pool);
}
void

View File

@ -120,7 +120,7 @@ ospf_neigh_down(struct ospf_neighbor *n)
s_get(&(n->dbsi));
release_lsrtl(p, n);
rem_node(NODE n);
rfree(n->pool);
rp_free(n->pool);
OSPF_TRACE(D_EVENTS, "Neighbor %R on %s removed", rid, ifa->ifname);
}

View File

@ -323,7 +323,7 @@ radv_iface_remove(struct radv_iface *ifa)
rem_node(NODE ifa);
rfree(ifa->pool);
rp_free(ifa->pool);
}
static void

View File

@ -746,7 +746,7 @@ bird_thread_cleanup(void *_thr)
pthread_attr_destroy(&thr->thread_attr);
/* Free all remaining memory */
rfree(thr->pool);
rp_free(thr->pool);
}
static struct bird_thread *
@ -839,7 +839,7 @@ bird_thread_shutdown(void * _ UNUSED)
/* Stop the meta loop */
birdloop_leave(thr->meta);
domain_free(thr->meta->time.domain);
rfree(thr->meta->pool);
rp_free(thr->meta->pool);
/* Local pages not needed anymore */
flush_local_pages();
@ -990,7 +990,7 @@ bird_thread_show(void *data)
cli_write_trigger(tsd->cli);
DOMAIN_FREE(control, tsd->lock);
rfree(tsd->pool);
rp_free(tsd->pool);
the_bird_unlock();
}
@ -1258,7 +1258,7 @@ birdloop_free(struct birdloop *loop)
ASSERT_DIE(loop->thread == NULL);
domain_free(loop->time.domain);
rfree(loop->pool);
rp_free(loop->pool);
}
static void