Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / rmfree.9f
blob94528d4a2a0e20e6d48770206c1f059872dc5b94
1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH RMFREE 9F "Jan 16, 2006"
7 .SH NAME
8 rmfree \- free space back into a resource map
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/map.h>
13 #include <sys/ddi.h>
17 \fBvoid\fR \fBrmfree\fR(\fBstruct map *\fR\fImp\fR, \fBsize_t\fR \fIsize\fR, \fBulong_t\fR \fIindex\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .sp
22 .LP
23 Architecture independent level 1 (DDI/DKI).
24 .SH PARAMETERS
25 .sp
26 .ne 2
27 .na
28 \fB\fImp\fR\fR
29 .ad
30 .RS 9n
31 Pointer to the map structure.
32 .RE
34 .sp
35 .ne 2
36 .na
37 \fB\fIsize\fR\fR
38 .ad
39 .RS 9n
40 Number of units being freed.
41 .RE
43 .sp
44 .ne 2
45 .na
46 \fB\fIindex\fR\fR
47 .ad
48 .RS 9n
49 Index of the first unit of the allocated resource.
50 .RE
52 .SH DESCRIPTION
53 .sp
54 .LP
55 The \fBrmfree()\fR function releases space back into a resource map. It is the
56 opposite of \fBrmalloc\fR(9F), which allocates space that is controlled by a
57 resource map structure.
58 .sp
59 .LP
60 When releasing resources using \fBrmfree()\fR the size and index passed to
61 \fBrmfree()\fR must exactly match the size and index values passed to and
62 returned from a previous call to \fBrmalloc()\fR. Resources cannot be returned
63 piecemeal.
64 .sp
65 .LP
66 Drivers may define resource maps for resource allocation, in terms of arbitrary
67 units, using the \fBrmallocmap\fR(9F) function. The system maintains the
68 resource map structure by size and index, computed in units appropriate for the
69 resource. For example, units may be byte addresses, pages of memory, or blocks.
70 \fBrmfree()\fR frees up unallocated space for re-use.
71 .sp
72 .LP
73 The \fBrmfree()\fR function can also be used to initialize a resource map, in
74 which case the size and index should cover the entire resource area.
75 .SH CONTEXT
76 .sp
77 .LP
78 The \fBrmfree()\fR function can be called from user, interrupt, or kernel
79 context.
80 .SH SEE ALSO
81 .sp
82 .LP
83 \fBrmalloc\fR(9F), \fBrmalloc_wait\fR(9F), \fBrmallocmap\fR(9F),
84 \fBrmfreemap\fR(9F)
85 .sp
86 .LP
87 \fIWriting Device Drivers\fR