'\" te .\" Copyright (c) 2006, Sun Microsystems, Inc. .TH rmfree 9F "16 Jan 2006" "SunOS 5.11" "Kernel Functions for Drivers" .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 .mk .na \fB\fImp\fR\fR .ad .RS 9n .rt Pointer to the map structure. .RE .sp .ne 2 .mk .na \fB\fIsize\fR\fR .ad .RS 9n .rt Number of units being freed. .RE .sp .ne 2 .mk .na \fB\fIindex\fR\fR .ad .RS 9n .rt 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 for Oracle Solaris 11.2\fR