From 35e5b8d0ded86e3e6e3110408146a376d4717ec1 Mon Sep 17 00:00:00 2001 From: arr Date: Wed, 24 Apr 2002 18:06:18 +0000 Subject: [PATCH] - Remove atm_attributes_pool and the relating atm_allocate() and atm_free() calls associated with the pool and the objects allocated out from the pool. - Insert atm_attributes_zone which is a uma_zone that is used just as the atm_attributes_pool was (including the max objects value). Also, used the appropriate zalloc and zfree's where necesary. --- sys/netatm/atm_cm.c | 6 +++--- sys/netatm/atm_subr.c | 15 ++++++++------- sys/netatm/atm_var.h | 5 ++++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sys/netatm/atm_cm.c b/sys/netatm/atm_cm.c index f509f3813cd..d8dccef3a39 100644 --- a/sys/netatm/atm_cm.c +++ b/sys/netatm/atm_cm.c @@ -709,7 +709,7 @@ atm_cm_listen(epp, token, ap, copp) /* * Get an attribute block and save listening attributes */ - cop->co_lattr = (Atm_attributes *)atm_allocate(&atm_attributes_pool); + cop->co_lattr = uma_zalloc(atm_attributes_zone, 0); if (cop->co_lattr == NULL) { err = ENOMEM; goto done; @@ -740,7 +740,7 @@ atm_cm_listen(epp, token, ap, copp) */ if (cop) { if (cop->co_lattr) - atm_free((caddr_t)cop->co_lattr); + uma_zfree(atm_attributes_zone, cop->co_lattr); atm_free((caddr_t)cop); } } else { @@ -2360,7 +2360,7 @@ atm_cm_closeconn(cop, cause) switch (cop->co_state) { case COS_LISTEN: - atm_free((caddr_t)cop->co_lattr); + uma_zfree(atm_attributes_zone, cop->co_lattr); UNLINK(cop, Atm_connection, atm_listen_queue, co_next); break; diff --git a/sys/netatm/atm_subr.c b/sys/netatm/atm_subr.c index 05817258407..fc42da60b36 100644 --- a/sys/netatm/atm_subr.c +++ b/sys/netatm/atm_subr.c @@ -79,13 +79,7 @@ int atm_print_data = 0; int atm_version = ATM_VERSION; struct timeval atm_debugtime = {0, 0}; -struct sp_info atm_attributes_pool = { - "atm attributes pool", /* si_name */ - sizeof(Atm_attributes), /* si_blksiz */ - 10, /* si_blkcnt */ - 100 /* si_maxallow */ -}; - +uma_zone_t atm_attributes_zone; /* * Local functions @@ -135,6 +129,13 @@ atm_initialize() mtx_init(&atm_intrq.ifq_mtx, "atm_inq", NULL, MTX_DEF); atmintrq_present = 1; + atm_attributes_zone = uma_zcreate("atm attributes", + sizeof(Atm_attributes), (uma_ctor)&atm_uma_ctor, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + if (atm_attributes_zone == NULL) + panic("atm_initialize: unable to allocate attributes pool"); + uma_zone_set_max(atm_attributes_zone, 100); + register_netisr(NETISR_ATM, atm_intr); /* diff --git a/sys/netatm/atm_var.h b/sys/netatm/atm_var.h index bacee494f4f..eb7ee35e6bb 100644 --- a/sys/netatm/atm_var.h +++ b/sys/netatm/atm_var.h @@ -40,6 +40,9 @@ #ifdef _KERNEL + +#include + /* * Global variable declarations */ @@ -63,7 +66,7 @@ extern int atm_debug; extern struct timeval atm_debugtime; extern int atm_dev_print; extern int atm_print_data; -extern struct sp_info atm_attributes_pool; +extern uma_zone_t atm_attributes_zone; extern struct pr_usrreqs atm_dgram_usrreqs; -- 2.45.0