Introduce a function rn_detachhead() that will free the

radix table root nodes.  This is only needed (and available)
in the virtualization case to free the resources when tearing
down a virtual network stack.

Sponsored by:	ISPsystem
Reviewed by:	julian, zec
MFC after:	5 days
This commit is contained in:
Bjoern A. Zeeb 2010-03-06 21:27:26 +00:00
parent 391dab1c2d
commit 1bb635b04d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204808
2 changed files with 21 additions and 0 deletions

View File

@ -1161,6 +1161,24 @@ rn_inithead(head, off)
return (1);
}
#ifdef VIMAGE
int
rn_detachhead(void **head)
{
struct radix_node_head *rnh;
KASSERT((head != NULL && *head != NULL),
("%s: head already freed", __func__));
rnh = *head;
/* Free <left,root,right> nodes. */
Free(rnh);
*head = NULL;
return (1);
}
#endif
void
rn_init(int maxk)
{

View File

@ -162,6 +162,9 @@ struct radix_node_head {
void rn_init(int);
int rn_inithead(void **, int);
#ifdef VIMAGE
int rn_detachhead(void **);
#endif
int rn_refines(void *, void *);
struct radix_node
*rn_addmask(void *, int, int),