MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_con_part3

Function ng_con_part3

freebsd/netgraph/ng_base.c:1340–1381  ·  view source on GitHub ↗

Composite routines ************************************************************************/ * Connect two nodes using the specified hooks, using queued functions. */

Source from the content-addressed store, hash-verified

1338 * Connect two nodes using the specified hooks, using queued functions.
1339 */
1340static int
1341ng_con_part3(node_p node, item_p item, hook_p hook)
1342{
1343 int error = 0;
1344
1345 /*
1346 * When we run, we know that the node 'node' is locked for us.
1347 * Our caller has a reference on the hook.
1348 * Our caller has a reference on the node.
1349 * (In this case our caller is ng_apply_item() ).
1350 * The peer hook has a reference on the hook.
1351 * We are all set up except for the final call to the node, and
1352 * the clearing of the INVALID flag.
1353 */
1354 if (NG_HOOK_NODE(hook) == &ng_deadnode) {
1355 /*
1356 * The node must have been freed again since we last visited
1357 * here. ng_destry_hook() has this effect but nothing else does.
1358 * We should just release our references and
1359 * free anything we can think of.
1360 * Since we know it's been destroyed, and it's our caller
1361 * that holds the references, just return.
1362 */
1363 ERROUT(ENOENT);
1364 }
1365 if (hook->hk_node->nd_type->connect) {
1366 if ((error = (*hook->hk_node->nd_type->connect) (hook))) {
1367 ng_destroy_hook(hook); /* also zaps peer */
1368 printf("failed in ng_con_part3()\n");
1369 ERROUT(error);
1370 }
1371 }
1372 /*
1373 * XXX this is wrong for SMP. Possibly we need
1374 * to separate out 'create' and 'invalid' flags.
1375 * should only set flags on hooks we have locked under our node.
1376 */
1377 hook->hk_flags &= ~HK_INVALID;
1378done:
1379 NG_FREE_ITEM(item);
1380 return (error);
1381}
1382
1383static int
1384ng_con_part2(node_p node, item_p item, hook_p hook)

Callers

nothing calls this directly

Calls 2

ng_destroy_hookFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected