diff options
author | glebius <glebius@FreeBSD.org> | 2005-05-13 11:35:02 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-05-13 11:35:02 +0000 |
commit | cbfa8be50b1ff837df58c0dd07675578a2fd5bc6 (patch) | |
tree | a319223fd4c84b9662f53f52fc519192a81f616e | |
parent | 67a392cd252956828d37fc77abc33af097ddbba0 (diff) | |
download | FreeBSD-src-cbfa8be50b1ff837df58c0dd07675578a2fd5bc6.zip FreeBSD-src-cbfa8be50b1ff837df58c0dd07675578a2fd5bc6.tar.gz |
Since there is no way to queue a function call to node, create
ng_queue_fn() - a queue version of ng_send_fn().
-rw-r--r-- | sys/netgraph/netgraph.h | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_base.c | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 415b5d4..c2d580f 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -1077,6 +1077,8 @@ 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); +int ng_queue_fn(node_p node, hook_p hook, ng_item_fn *fn, + void *arg1, int arg2); int ng_uncallout(struct callout *c, node_p node); int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks, ng_item_fn *fn, void * arg1, int arg2); diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 3a87a7f..6747761 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3568,8 +3568,9 @@ ng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg) return (item); } -int -ng_send_fn(node_p node, hook_p hook, ng_item_fn *fn, void * arg1, int arg2) +static __inline int +ng_send_fn1(node_p node, hook_p hook, ng_item_fn *fn, void * arg1, int arg2, + int queue) { item_p item; @@ -3586,7 +3587,19 @@ ng_send_fn(node_p node, hook_p hook, ng_item_fn *fn, void * arg1, int arg2) NGI_FN(item) = fn; NGI_ARG1(item) = arg1; NGI_ARG2(item) = arg2; - return(ng_snd_item(item, 0)); + return(ng_snd_item(item, queue)); +} + +int +ng_send_fn(node_p node, hook_p hook, ng_item_fn *fn, void * arg1, int arg2) +{ + return (ng_send_fn1(node, hook, fn, arg1, arg2, 0)); +} + +int +ng_queue_fn(node_p node, hook_p hook, ng_item_fn *fn, void * arg1, int arg2) +{ + return (ng_send_fn1(node, hook, fn, arg1, arg2, 1)); } /* |