FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Gets number of items from table either using
 * internal counter or calling algo callback for
 * externally-managed tables.
 *
 * Returns number of records.
 */
Gets number of items from table either using
internal counter or calling algo callback for
externally-managed tables.

Returns number of records.
Gets number of items from table either using internal counter or calling algo callback for externally - managed tables . Returns number of records .
static uint32_t
table_get_count(struct ip_fw_chain *ch, struct table_config *tc)
{
	struct table_info *ti;
	struct table_algo *ta;
	struct dump_args da;
	ti = KIDX_TO_TI(ch, tc->no.kidx);
	ta = tc->ta;
	if ((ta->flags & TA_FLAG_READONLY) == 0)
		return (tc->count);
	if ((ta->flags & TA_FLAG_EXTCOUNTER) != 0)
		return (ta->get_count(tc->astate, ti));
	memset(&da, 0, sizeof(da));
	ta->foreach(tc->astate, ti, count_ext_entries, &da);
	return (da.cnt);
}
static uint32_t table_get_count ( struct ip_fw_chain * ch , struct table_config * tc ) { struct table_info * ti ; struct table_algo * ta ; struct dump_args da ; ti = KIDX_TO_TI ( ch , tc -> no . kidx ) ; ta = tc -> ta ; if ( ( ta -> flags & TA_FLAG_READONLY ) == 0 ) return ( tc -> count ) ; if ( ( ta -> flags & TA_FLAG_EXTCOUNTER ) != 0 ) return ( ta -> get_count ( tc -> astate , ti ) ) ; memset ( & da , 0 , sizeof ( da ) ) ; ta -> foreach ( tc -> astate , ti , count_ext_entries , & da ) ; return ( da . cnt ) ; }
Gets number of items from table either using
 internal counter or calling algo callback for
 externally-managed tables.
Gets number of items from table either using internal counter or calling algo callback for externally - managed tables .
/* Use internal counter for self-managed tables */ /* Use callback to quickly get number of items */ /* Count number of iterms ourselves */