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

Function lltable_allocate_htbl

freebsd/net/if_llatbl.c:566–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564}
565
566struct lltable *
567lltable_allocate_htbl(uint32_t hsize)
568{
569 struct lltable *llt;
570 int i;
571
572 llt = malloc(sizeof(struct lltable), M_LLTABLE, M_WAITOK | M_ZERO);
573 llt->llt_hsize = hsize;
574 llt->lle_head = malloc(sizeof(struct llentries) * hsize,
575 M_LLTABLE, M_WAITOK | M_ZERO);
576
577 for (i = 0; i < llt->llt_hsize; i++)
578 CK_LIST_INIT(&llt->lle_head[i]);
579
580 /* Set some default callbacks */
581 llt->llt_link_entry = htable_link_entry;
582 llt->llt_unlink_entry = htable_unlink_entry;
583 llt->llt_prefix_free = htable_prefix_free;
584 llt->llt_foreach_entry = htable_foreach_lle;
585 llt->llt_free_tbl = htable_free_tbl;
586
587 return (llt);
588}
589
590/*
591 * Links lltable to global llt list.

Callers 2

in_lltattachFunction · 0.85
in6_lltattachFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected