'\" te .\" Copyright (c) 2006, Sun Microsystems, Inc. .\" 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. .\" 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. .\" 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] .TH RMFREE 9F "Jan 16, 2006" .SH NAME rmfree \- free space back into a resource map .SH SYNOPSIS .LP .nf #include #include \fBvoid\fR \fBrmfree\fR(\fBstruct map *\fR\fImp\fR, \fBsize_t\fR \fIsize\fR, \fBulong_t\fR \fIindex\fR); .fi .SH INTERFACE LEVEL .sp .LP Architecture independent level 1 (DDI/DKI). .SH PARAMETERS .sp .ne 2 .na \fB\fImp\fR\fR .ad .RS 9n Pointer to the map structure. .RE .sp .ne 2 .na \fB\fIsize\fR\fR .ad .RS 9n Number of units being freed. .RE .sp .ne 2 .na \fB\fIindex\fR\fR .ad .RS 9n Index of the first unit of the allocated resource. .RE .SH DESCRIPTION .sp .LP The \fBrmfree()\fR function releases space back into a resource map. It is the opposite of \fBrmalloc\fR(9F), which allocates space that is controlled by a resource map structure. .sp .LP When releasing resources using \fBrmfree()\fR the size and index passed to \fBrmfree()\fR must exactly match the size and index values passed to and returned from a previous call to \fBrmalloc()\fR. Resources cannot be returned piecemeal. .sp .LP Drivers may define resource maps for resource allocation, in terms of arbitrary units, using the \fBrmallocmap\fR(9F) function. The system maintains the resource map structure by size and index, computed in units appropriate for the resource. For example, units may be byte addresses, pages of memory, or blocks. \fBrmfree()\fR frees up unallocated space for re-use. .sp .LP The \fBrmfree()\fR function can also be used to initialize a resource map, in which case the size and index should cover the entire resource area. .SH CONTEXT .sp .LP The \fBrmfree()\fR function can be called from user, interrupt, or kernel context. .SH SEE ALSO .sp .LP \fBrmalloc\fR(9F), \fBrmalloc_wait\fR(9F), \fBrmallocmap\fR(9F), \fBrmfreemap\fR(9F) .sp .LP \fIWriting Device Drivers\fR