예제 #1
0
void
udp_init()
{
	LIST_INIT(&udb);
	udbinfo.listhead = &udb;
	udbinfo.hashbase = phashinit(UDBHASHSIZE, M_PCB, &udbinfo.hashsize);
}
예제 #2
0
int
hc_init(int af, struct hccallback *hccb, int init_nelem, int primes)
{
	struct hctable *hct;
	struct hchead *heads;
	u_long nelem;

	hct = &hctable[af];
	nelem = init_nelem;
	if (hct->hct_nentries)
		return 0;

	if (primes) {
		heads = phashinit(init_nelem, M_HOSTCACHE, &nelem);
	} else {
		int i;
		MALLOC(heads, struct hchead *, nelem * sizeof *heads,
		       M_HOSTCACHE, M_WAITOK);
		for (i = 0; i < nelem; i++) {
			LIST_INIT(&heads[i]);
		}
	}
	
	hct->hct_heads = heads;
	hct->hct_nentries = nelem;
	hct->hct_primes = primes;
	timeout(hc_timeout, hct, hc_timeout_interval * hz);
	return 0;
}