ng_base.c (170035) | ng_base.c (170180) |
---|---|
1/* 2 * ng_base.c 3 */ 4 5/*- 6 * Copyright (c) 1996-1999 Whistle Communications, Inc. 7 * All rights reserved. 8 * --- 24 unchanged lines hidden (view full) --- 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 36 * OF SUCH DAMAGE. 37 * 38 * Authors: Julian Elischer <julian@freebsd.org> 39 * Archie Cobbs <archie@freebsd.org> 40 * | 1/* 2 * ng_base.c 3 */ 4 5/*- 6 * Copyright (c) 1996-1999 Whistle Communications, Inc. 7 * All rights reserved. 8 * --- 24 unchanged lines hidden (view full) --- 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY 36 * OF SUCH DAMAGE. 37 * 38 * Authors: Julian Elischer <julian@freebsd.org> 39 * Archie Cobbs <archie@freebsd.org> 40 * |
41 * $FreeBSD: head/sys/netgraph/ng_base.c 170035 2007-05-27 20:50:23Z rwatson $ | 41 * $FreeBSD: head/sys/netgraph/ng_base.c 170180 2007-06-01 09:20:57Z glebius $ |
42 * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ 43 */ 44 45/* 46 * This file implements the base netgraph code. 47 */ 48 49#include <sys/param.h> --- 137 unchanged lines hidden (view full) --- 187 188/* Internal functions */ 189static int ng_add_hook(node_p node, const char *name, hook_p * hookp); 190static int ng_generic_msg(node_p here, item_p item, hook_p lasthook); 191static ng_ID_t ng_decodeidname(const char *name); 192static int ngb_mod_event(module_t mod, int event, void *data); 193static void ng_worklist_remove(node_p node); 194static void ngintr(void); | 42 * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ 43 */ 44 45/* 46 * This file implements the base netgraph code. 47 */ 48 49#include <sys/param.h> --- 137 unchanged lines hidden (view full) --- 187 188/* Internal functions */ 189static int ng_add_hook(node_p node, const char *name, hook_p * hookp); 190static int ng_generic_msg(node_p here, item_p item, hook_p lasthook); 191static ng_ID_t ng_decodeidname(const char *name); 192static int ngb_mod_event(module_t mod, int event, void *data); 193static void ng_worklist_remove(node_p node); 194static void ngintr(void); |
195static void ng_apply_item(node_p node, item_p item, int rw); | 195static int ng_apply_item(node_p node, item_p item, int rw); |
196static void ng_flush_input_queue(struct ng_queue * ngq); 197static void ng_setisr(node_p node); 198static node_p ng_ID2noderef(ng_ID_t ID); 199static int ng_con_nodes(node_p node, const char *name, node_p node2, 200 const char *name2); 201static void ng_con_part2(node_p node, hook_p hook, void *arg1, int arg2); 202static void ng_con_part3(node_p node, hook_p hook, void *arg1, int arg2); 203static int ng_mkpeer(node_p node, const char *name, --- 2177 unchanged lines hidden (view full) --- 2381 } 2382 2383#ifdef NETGRAPH_DEBUG 2384 _ngi_check(item, __FILE__, __LINE__); 2385#endif 2386 2387 NGI_GET_NODE(item, node); /* zaps stored node */ 2388 | 196static void ng_flush_input_queue(struct ng_queue * ngq); 197static void ng_setisr(node_p node); 198static node_p ng_ID2noderef(ng_ID_t ID); 199static int ng_con_nodes(node_p node, const char *name, node_p node2, 200 const char *name2); 201static void ng_con_part2(node_p node, hook_p hook, void *arg1, int arg2); 202static void ng_con_part3(node_p node, hook_p hook, void *arg1, int arg2); 203static int ng_mkpeer(node_p node, const char *name, --- 2177 unchanged lines hidden (view full) --- 2381 } 2382 2383#ifdef NETGRAPH_DEBUG 2384 _ngi_check(item, __FILE__, __LINE__); 2385#endif 2386 2387 NGI_GET_NODE(item, node); /* zaps stored node */ 2388 |
2389 /* Don't report any errors. act as if it had been queued */ 2390 ng_apply_item(node, item, rw); /* drops r/w lock when done */ | 2389 error = ng_apply_item(node, item, rw); /* drops r/w lock when done */ |
2391 2392 /* 2393 * If the node goes away when we remove the reference, 2394 * whatever we just did caused it.. whatever we do, DO NOT 2395 * access the node again! 2396 */ 2397 if (NG_NODE_UNREF(node) == 0) { 2398 return (error); --- 7 unchanged lines hidden (view full) --- 2406 return (error); 2407} 2408 2409/* 2410 * We have an item that was possibly queued somewhere. 2411 * It should contain all the information needed 2412 * to run it on the appropriate node/hook. 2413 */ | 2390 2391 /* 2392 * If the node goes away when we remove the reference, 2393 * whatever we just did caused it.. whatever we do, DO NOT 2394 * access the node again! 2395 */ 2396 if (NG_NODE_UNREF(node) == 0) { 2397 return (error); --- 7 unchanged lines hidden (view full) --- 2405 return (error); 2406} 2407 2408/* 2409 * We have an item that was possibly queued somewhere. 2410 * It should contain all the information needed 2411 * to run it on the appropriate node/hook. 2412 */ |
2414static void | 2413static int |
2415ng_apply_item(node_p node, item_p item, int rw) 2416{ 2417 hook_p hook; 2418 int error = 0; 2419 ng_rcvdata_t *rcvdata; 2420 ng_rcvmsg_t *rcvmsg; 2421 ng_apply_t *apply = NULL; 2422 void *context = NULL; --- 129 unchanged lines hidden (view full) --- 2552 } else { 2553 ng_leave_write(&node->nd_input_queue); 2554 } 2555 2556 /* Apply callback. */ 2557 if (apply != NULL) 2558 (*apply)(context, error); 2559 | 2414ng_apply_item(node_p node, item_p item, int rw) 2415{ 2416 hook_p hook; 2417 int error = 0; 2418 ng_rcvdata_t *rcvdata; 2419 ng_rcvmsg_t *rcvmsg; 2420 ng_apply_t *apply = NULL; 2421 void *context = NULL; --- 129 unchanged lines hidden (view full) --- 2551 } else { 2552 ng_leave_write(&node->nd_input_queue); 2553 } 2554 2555 /* Apply callback. */ 2556 if (apply != NULL) 2557 (*apply)(context, error); 2558 |
2560 return; | 2559 return (error); |
2561} 2562 2563/*********************************************************************** 2564 * Implement the 'generic' control messages 2565 ***********************************************************************/ 2566static int 2567ng_generic_msg(node_p here, item_p item, hook_p lasthook) 2568{ --- 1210 unchanged lines hidden --- | 2560} 2561 2562/*********************************************************************** 2563 * Implement the 'generic' control messages 2564 ***********************************************************************/ 2565static int 2566ng_generic_msg(node_p here, item_p item, hook_p lasthook) 2567{ --- 1210 unchanged lines hidden --- |