1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Add an external function to unlink a netgraph type from the types list.

This commit is contained in:
Julian Elischer 2001-07-23 21:14:57 +00:00
parent 6b8fa04225
commit c31b4a5381
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80222
2 changed files with 21 additions and 0 deletions

View File

@ -1123,6 +1123,7 @@ item_p ng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg);
void ng_replace_retaddr(node_p here, item_p item, ng_ID_t retaddr);
int ng_rmhook_self(hook_p hook); /* if a node wants to kill a hook */
int ng_rmnode_self(node_p here); /* if a node wants to suicide */
int ng_rmtype(struct ng_type *tp);
int ng_snd_item(item_p item, int queue);
int ng_send_fn(node_p node, hook_p hook, ng_item_fn *fn,
void *arg1, int arg2);

View File

@ -1166,6 +1166,26 @@ ng_newtype(struct ng_type *tp)
return (0);
}
/*
* unlink a netgraph type
* If no examples exist
*/
int
ng_rmtype(struct ng_type *tp)
{
/* Check for name collision */
if (tp->refs != 1) {
TRAP_ERROR();
return (EBUSY);
}
/* Unlink type */
mtx_lock(&ng_typelist_mtx);
LIST_REMOVE(tp, types);
mtx_unlock(&ng_typelist_mtx);
return (0);
}
/*
* Look for a type of the name given
*/