summaryrefslogtreecommitdiff
path: root/sys/kern/subr_unit.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove debugging printfs.Poul-Henning Kamp2005-03-141-8/+3
| | | | Notes: svn path=/head/; revision=143550
* Reengineer subr_unitPoul-Henning Kamp2005-03-081-287/+511
| | | | | | | | | | | | | | | | | | Add support for passing in a mutex. If NULL is passed a global subr_unit mutex is used. Add alloc_unrl() which expects the mutex to be held. Allocating a unit will never sleep as it does not need to allocate memory. Cut possible range in half so we can use -1 to mean "out of number". Collapse first and last runs into the head by means of counters. This saves memory in the common case(s). Notes: svn path=/head/; revision=143283
* Add placeholder mutex argument to new_unrhdr().Poul-Henning Kamp2005-03-071-2/+2
| | | | Notes: svn path=/head/; revision=143238
* /* -> /*- for copyright notices, minor format tweaks as necessaryWarner Losh2005-01-061-2/+3
| | | | Notes: svn path=/head/; revision=139804
* Add delete_unrhdr() function.Poul-Henning Kamp2004-10-251-2/+19
| | | | | | | It will fail fatally if all allocated numbers have not been returned first. Notes: svn path=/head/; revision=136945
* Fix a typo to fix the !DIAGNOSTIC build.John Baldwin2004-09-301-1/+1
| | | | | | | Submitted by: many Notes: svn path=/head/; revision=135979
* Add a new API for allocating unit number (-like) resources.Poul-Henning Kamp2004-09-301-0/+597
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. Notes: svn path=/head/; revision=135956