From ad094e6d4f425b96a105c5d240170552d8fc10f9 Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 23 Jul 2001 21:14:57 +0000 Subject: Add an external function to unlink a netgraph type from the types list. --- sys/netgraph/ng_base.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sys/netgraph/ng_base.c') diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 6cba23b..553193b 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -1167,6 +1167,26 @@ ng_newtype(struct ng_type *tp) } /* + * 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 */ struct ng_type * -- cgit v1.1