From owner-cvs-src@FreeBSD.ORG Thu Sep 30 07:04:04 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5507C16A4D0; Thu, 30 Sep 2004 07:04:04 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A41243D60; Thu, 30 Sep 2004 07:04:04 +0000 (GMT) (envelope-from phk@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i8U744ZP051029; Thu, 30 Sep 2004 07:04:04 GMT (envelope-from phk@repoman.freebsd.org) Received: (from phk@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i8U744rg051025; Thu, 30 Sep 2004 07:04:04 GMT (envelope-from phk) Message-Id: <200409300704.i8U744rg051025@repoman.freebsd.org> From: Poul-Henning Kamp Date: Thu, 30 Sep 2004 07:04:03 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/sys systm.h src/sys/conf files src/sys/kern subr_unit.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2004 07:04:04 -0000 phk 2004-09-30 07:04:03 UTC FreeBSD src repository Modified files: sys/sys systm.h sys/conf files Added files: sys/kern subr_unit.c Log: Add a new API for allocating unit number (-like) resources. Allocation is always lowest free unit number. A mixed range/bitmap strategy for maximum memory efficiency. In the typical case where no unit numbers are freed total memory usage is 56 bytes on i386. malloc is called M_WAITOK but no locking is provided (yet). A bit of experience will be necessary to determine the best strategy. Hopefully a "caller provides locking" strategy can be maintained, but that may require use of M_NOWAIT allocation and failure handling. A userland test driver is included. Revision Changes Path 1.955 +1 -0 src/sys/conf/files 1.1 +597 -0 src/sys/kern/subr_unit.c (new) 1.215 +8 -0 src/sys/sys/systm.h