* Initialize an inpcbinfo -- we should be able to reduce the number of * arguments in time. */
| 517 | * arguments in time. |
| 518 | */ |
| 519 | void |
| 520 | in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char *name, |
| 521 | struct inpcbhead *listhead, int hash_nelements, int porthash_nelements, |
| 522 | char *inpcbzone_name, uma_init inpcbzone_init, u_int hashfields) |
| 523 | { |
| 524 | |
| 525 | porthash_nelements = imin(porthash_nelements, IPPORT_MAX + 1); |
| 526 | |
| 527 | INP_INFO_LOCK_INIT(pcbinfo, name); |
| 528 | INP_HASH_LOCK_INIT(pcbinfo, "pcbinfohash"); /* XXXRW: argument? */ |
| 529 | INP_LIST_LOCK_INIT(pcbinfo, "pcbinfolist"); |
| 530 | #ifdef VIMAGE |
| 531 | pcbinfo->ipi_vnet = curvnet; |
| 532 | #endif |
| 533 | pcbinfo->ipi_listhead = listhead; |
| 534 | CK_LIST_INIT(pcbinfo->ipi_listhead); |
| 535 | pcbinfo->ipi_count = 0; |
| 536 | pcbinfo->ipi_hashbase = hashinit(hash_nelements, M_PCB, |
| 537 | &pcbinfo->ipi_hashmask); |
| 538 | pcbinfo->ipi_porthashbase = hashinit(porthash_nelements, M_PCB, |
| 539 | &pcbinfo->ipi_porthashmask); |
| 540 | pcbinfo->ipi_lbgrouphashbase = hashinit(porthash_nelements, M_PCB, |
| 541 | &pcbinfo->ipi_lbgrouphashmask); |
| 542 | #ifdef PCBGROUP |
| 543 | in_pcbgroup_init(pcbinfo, hashfields, hash_nelements); |
| 544 | #endif |
| 545 | pcbinfo->ipi_zone = uma_zcreate(inpcbzone_name, sizeof(struct inpcb), |
| 546 | NULL, NULL, inpcbzone_init, inpcb_fini, UMA_ALIGN_PTR, 0); |
| 547 | uma_zone_set_max(pcbinfo->ipi_zone, maxsockets); |
| 548 | uma_zone_set_warning(pcbinfo->ipi_zone, |
| 549 | "kern.ipc.maxsockets limit reached"); |
| 550 | } |
| 551 | |
| 552 | /* |
| 553 | * Destroy an inpcbinfo. |
no test coverage detected