| 564 | } |
| 565 | |
| 566 | struct lltable * |
| 567 | lltable_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. |
no test coverage detected