aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2001-07-23 21:14:57 +0000
committerJulian Elischer <julian@FreeBSD.org>2001-07-23 21:14:57 +0000
commitc31b4a5381c782d2d196759a8b0c24a8606470ff (patch)
treeb3990a9856719af0230ef00d47ccb95e1426696d /sys
parent6b8fa042256c5fcd5c693892a0537d9dba5f7ffb (diff)
downloadsrc-c31b4a5381c782d2d196759a8b0c24a8606470ff.tar.gz
src-c31b4a5381c782d2d196759a8b0c24a8606470ff.zip
Add an external function to unlink a netgraph type from the types list.
Notes
Notes: svn path=/head/; revision=80222
Diffstat (limited to 'sys')
-rw-r--r--sys/netgraph/netgraph.h1
-rw-r--r--sys/netgraph/ng_base.c20
2 files changed, 21 insertions, 0 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h
index c1f03ce8686b..33fcfb048c70 100644
--- a/sys/netgraph/netgraph.h
+++ b/sys/netgraph/netgraph.h
@@ -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);
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 6cba23b3c473..553193b99c39 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 *