mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Reengineer subr_unit
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).
This commit is contained in:
parent
3238ec33e1
commit
d9a54d5c23
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143283
File diff suppressed because it is too large
Load Diff
@ -320,9 +320,10 @@ void DELAY(int usec);
|
||||
* Unit number allocation API. (kern/subr_unit.c)
|
||||
*/
|
||||
struct unrhdr;
|
||||
struct unrhdr *new_unrhdr(u_int low, u_int high, struct mtx *mutex);
|
||||
struct unrhdr *new_unrhdr(int low, int high, struct mtx *mutex);
|
||||
void delete_unrhdr(struct unrhdr *uh);
|
||||
u_int alloc_unr(struct unrhdr *uh);
|
||||
int alloc_unr(struct unrhdr *uh);
|
||||
int alloc_unrl(struct unrhdr *uh);
|
||||
void free_unr(struct unrhdr *uh, u_int item);
|
||||
|
||||
#endif /* !_SYS_SYSTM_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user