summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-07-05 16:23:55 +0000
committerjh <jh@FreeBSD.org>2010-07-05 16:23:55 +0000
commitb0744cfb8dbf62bf31a6e89b2de383ebfd461213 (patch)
treeaa72b34baee9922e9040fa167dd3bab331b4d8cc /share
parentd33b286554c298f108e3e84d632332893f5a4f54 (diff)
downloadFreeBSD-src-b0744cfb8dbf62bf31a6e89b2de383ebfd461213.zip
FreeBSD-src-b0744cfb8dbf62bf31a6e89b2de383ebfd461213.tar.gz
Extend the kernel unit number allocator for allocating specific unit
numbers. This change adds a new function alloc_unr_specific() which returns the requested unit number if it is free. If the number is already allocated or out of the range, -1 is returned. Update alloc_unr(9) manual page accordingly and add a MLINK for alloc_unr_specific(9). Discussed on: freebsd-hackers
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile1
-rw-r--r--share/man/man9/alloc_unr.912
2 files changed, 12 insertions, 1 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 4e8b0ce..6e93244 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -374,6 +374,7 @@ MAN= accept_filter.9 \
zone.9
MLINKS= alloc_unr.9 alloc_unrl.9 \
+ alloc_unr.9 alloc_unr_specific.9 \
alloc_unr.9 delete_unrhdr.9 \
alloc_unr.9 free_unr.9 \
alloc_unr.9 new_unrhdr.9
diff --git a/share/man/man9/alloc_unr.9 b/share/man/man9/alloc_unr.9
index 2ba93e6..43c145f 100644
--- a/share/man/man9/alloc_unr.9
+++ b/share/man/man9/alloc_unr.9
@@ -24,13 +24,14 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 7, 2010
+.Dd July 5, 2010
.Dt ALLOC_UNR 9
.Os
.Sh NAME
.Nm new_unrhdr ,
.Nm delete_unrhdr ,
.Nm alloc_unr ,
+.Nm alloc_unr_specific ,
.Nm free_unr
.Nd "kernel unit number allocator"
.Sh SYNOPSIS
@@ -43,6 +44,8 @@
.Fn alloc_unr "struct unrhdr *uh"
.Ft int
.Fn alloc_unrl "struct unrhdr *uh"
+.Ft int
+.Fn alloc_unr_specific "struct unrhdr *uh" "u_int item"
.Ft void
.Fn free_unr "struct unrhdr *uh" "u_int item"
.Sh DESCRIPTION
@@ -81,6 +84,13 @@ is returned.
Same as
.Fn alloc_unr
except that mutex is assumed to be already locked and thus is not used.
+.It Fn alloc_unr_specific uh item
+Allocate a specific unit number.
+This function allocates memory and thus may sleep.
+The allocated unit number is returned on success.
+If the specified number is already allocated or out of the range,
+.Li \-1
+is returned.
.It Fn free_unr uh item
Free a previously allocated unit number.
This function may require allocating memory, and thus it can sleep.
OpenPOWER on IntegriCloud