diff options
author | thompsa <thompsa@FreeBSD.org> | 2008-09-22 19:28:18 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2008-09-22 19:28:18 +0000 |
commit | a689a9e9146d06326e1194f1798a5000c749f7cd (patch) | |
tree | 744811d7ec07ee8c995cd5af46916302d7a5a182 /sys/netgraph | |
parent | 1475e942ed4a544d79230d9b2774b0e79f9189cd (diff) | |
download | FreeBSD-src-a689a9e9146d06326e1194f1798a5000c749f7cd.zip FreeBSD-src-a689a9e9146d06326e1194f1798a5000c749f7cd.tar.gz |
Add ng_rmnode_flags() so the caller can pass NG_QUEUE and have the node
destroyed asynchronously due to locking or other constraints.
Reviewed by: julian
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/netgraph.h | 1 | ||||
-rw-r--r-- | sys/netgraph/ng_base.c | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 70472d7..53fab56 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -1130,6 +1130,7 @@ item_p ng_package_msg(struct ng_mesg *msg, int flags); 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_flags(node_p here, int flags); 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); diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 4012e35..82caad1 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -1507,7 +1507,7 @@ ng_mkpeer(node_p node, const char *name, const char *name2, char *type) /* Shut this node down as soon as everyone is clear of it */ /* Should add arg "immediately" to jump the queue */ int -ng_rmnode_self(node_p node) +ng_rmnode_flags(node_p node, int flags) { int error; @@ -1517,10 +1517,16 @@ ng_rmnode_self(node_p node) if (node->nd_flags & NGF_CLOSING) return (0); - error = ng_send_fn(node, NULL, &ng_rmnode, NULL, 0); + error = ng_send_fn1(node, NULL, &ng_rmnode, NULL, 0, flags); return (error); } +int +ng_rmnode_self(node_p node) +{ + return (ng_rmnode_flags(node, NG_NOFLAGS)); +} + static void ng_rmhook_part2(node_p node, hook_p hook, void *arg1, int arg2) { |