'\"macro stdmacro
.if n .pH ddi_dki.rmfree @(#)rmfree	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} rmfree D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} rmfree D3DK "" "DDI/DKI"
.if \nX=2 .ds x} rmfree D3DK "" "\&"
.if \nX=3 .ds x} rmfree "" "" "\&"
.TH \*(x}
.SH NAME
\f4rmfree\f1 \- free space back into a private space management map
.IX "\f4rmfree\fP(D3DK)"
.SH SYNOPSIS
.nf
.na
\f4#include <sys/map.h>
#include <sys/ddi.h>
.sp 0.5
void rmfree(struct map *\f2mp, \f4long \f2size, \f4unsigned long \f2index\f4);\f1
.ad
.fi
.SH ARGUMENTS
.RS 0n 10
.IP "\f2*mp\f1" 10n
Pointer to the \f4map\f1(D4DK) structure.
.IP "\f2size\f1" 10n
Number of units being freed.
.IP "\f2index\f1" 10n
Index of the first unit of the allocated resource.
.RE
.SH DESCRIPTION
\f4rmfree\f1 releases space back into a private space management map.
It is the opposite of \f4rmalloc\f1(D3DK), which allocates space that is
controlled by a private \f4map\f1 structure.
.P
Drivers may define private space management buffers for allocation of
memory space, in terms of arbitrary units, using the \f4rmalloc\f1(D3DK),
\f4rmfree\f1 and \f4rminit\f1(D3DK) functions.  The drivers
must include the file \f4map.h\f1.  The system maintains the memory map
list structure by size and index, computed in units appropriate for the
memory map.  For example, units may be byte addresses, pages of memory,
or blocks.  The elements of the memory map are sorted by index, and the
system uses the size member so that adjacent objects are combined into
one memory map entry.  The system allocates objects from the
memory map on a first-fit basis.  \f4rmfree\f1 frees up unallocated
memory for re-use.
.SH RETURN VALUE
None.  However, if the \f4m_addr\f1
member of the \f4map\f1 structure is
returned as \f40\f1, the following warning message is displayed on the
console:
.P
.RS
\f4WARNING: rmfree map overflow \f2mp\f4 lost \f2size\f4 items at \f2index\f1
.RE
.P
where
\f2mp\f1 is the hexadecimal address of the \f4map\f1 structure,
\f2size\f1 is the decimal number of buffers freed,
and
\f2index\f1 is the decimal address to the first buffer unit freed.
.SH LEVEL
Base or Interrupt
.SH SEE ALSO
.na
\f4rmalloc\f1(D3DK),
\f4rminit\f1(D3DK),
\f4rmwant\f1(D3DK)
.ad
.SH EXAMPLE
See \f4rmalloc\f1(D3DK).
