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

Function ng_acquire_write

freebsd/netgraph/ng_base.c:2068–2087  ·  view source on GitHub ↗

Acquire writer lock on node. If node is busy, queue the packet. */

Source from the content-addressed store, hash-verified

2066
2067/* Acquire writer lock on node. If node is busy, queue the packet. */
2068static __inline item_p
2069ng_acquire_write(node_p node, item_p item)
2070{
2071 KASSERT(node != &ng_deadnode,
2072 ("%s: working on deadnode", __func__));
2073
2074 /* Writer needs completely idle node. */
2075 if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, 0,
2076 WRITER_ACTIVE)) {
2077 /* Successfully grabbed node */
2078 CTR4(KTR_NET, "%20s: node [%x] (%p) acquired item %p",
2079 __func__, node->nd_ID, node, item);
2080 return (item);
2081 }
2082
2083 /* Queue the request for later. */
2084 ng_queue_rw(node, item, NGQRW_W);
2085
2086 return (NULL);
2087}
2088
2089#if 0
2090static __inline item_p

Callers 1

ng_snd_itemFunction · 0.70

Calls 1

ng_queue_rwFunction · 0.70

Tested by

no test coverage detected