FreeBSD/sys/netpfil/pf/pf.c
/*
 * Find state by ID: returns with locked row on success.
 */
Find state by ID: returns with locked row on success.
Find state by ID : returns with locked row on success .
struct pf_state *
pf_find_state_byid(uint64_t id, uint32_t creatorid)
{
	struct pf_idhash *ih;
	struct pf_state *s;
	counter_u64_add(V_pf_status.fcounters[FCNT_STATE_SEARCH], 1);
	ih = &V_pf_idhash[(be64toh(id) % (pf_hashmask + 1))];
	PF_HASHROW_LOCK(ih);
	LIST_FOREACH(s, &ih->states, entry)
		if (s->id == id && s->creatorid == creatorid)
			break;
	if (s == NULL)
		PF_HASHROW_UNLOCK(ih);
	return (s);
}
struct pf_state * pf_find_state_byid ( uint64_t id , uint32_t creatorid ) { struct pf_idhash * ih ; struct pf_state * s ; counter_u64_add ( V_pf_status . fcounters [ FCNT_STATE_SEARCH ] , 1 ) ; ih = & V_pf_idhash [ ( be64toh ( id ) % ( pf_hashmask + 1 ) ) ] ; PF_HASHROW_LOCK ( ih ) ; LIST_FOREACH ( s , & ih -> states , entry ) if ( s -> id == id && s -> creatorid == creatorid ) break ; if ( s == NULL ) PF_HASHROW_UNLOCK ( ih ) ; return ( s ) ; }
Find state by ID: returns with locked row on success.
Find state by ID : returns with locked row on success .