2 .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
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 RMALLOCMAP 9F "Nov 20, 1996"
8 rmallocmap, rmallocmap_wait, rmfreemap \- allocate and free resource maps
13 #include <sys/sunddi.h>
17 \fBstruct map *\fR\fBrmallocmap\fR(\fBsize_t\fR \fImapsize\fR);
22 \fBstruct map *\fR\fBrmallocmap_wait\fR(\fBsize_t\fR \fImapsize\fR);
27 \fBvoid\fR \fBrmfreemap\fR(\fBstruct map *\fR\fImp\fR);
33 Architecture independent level 1 (\fBDDI/DKI\fR).
41 Number of entries for the map.
50 A pointer to the map structure to be deallocated.
56 \fBrmallocmap()\fR dynamically allocates a resource map structure. The argument
57 \fImapsize\fR defines the total number of entries in the map. In particular,
58 it is the total number of allocations that can be outstanding at any one time.
61 \fBrmallocmap()\fR initializes the map but does not associate it with the
62 actual resource. In order to associate the map with the actual resource, a
63 call to \fBrmfree\fR(9F) is used to make the entirety of the actual resource
64 available for allocation, starting from the first index into the resource.
65 Typically, the call to \fBrmallocmap()\fR is followed by a call to
66 \fBrmfree\fR(9F), passing the address of the map returned from
67 \fBrmallocmap()\fR, the total size of the resource, and the first index into
71 The resource map allocated by \fBrmallocmap()\fR can be used to describe an
72 arbitrary resource in whatever allocation units are appropriate, such as
73 blocks, pages, or data structures. This resource can then be managed by the
74 system by subsequent calls to \fBrmalloc\fR(9F), \fBrmalloc_wait\fR(9F), and
78 \fBrmallocmap_wait()\fR is similar to \fBrmallocmap()\fR, with the exception
79 that it will wait for space to become available if necessary.
82 \fBrmfreemap()\fR deallocates a resource map structure previously allocated by
83 \fBrmallocmap()\fR or \fBrmallocmap_wait()\fR. The argument \fImp\fR is a
84 pointer to the map structure to be deallocated.
88 Upon successful completion, \fBrmallocmap()\fR and \fBrmallocmap_wait()\fR
89 return a pointer to the newly allocated map structure. Upon failure,
90 \fBrmallocmap()\fR returns a \fBNULL\fR pointer.
94 \fBrmallocmap()\fR and \fBrmfreemap()\fR can be called from user, kernel, or
98 \fBrmallocmap_wait()\fR can only be called from user or kernel context.
102 \fBrmalloc\fR(9F), \fBrmalloc_wait\fR(9F), \fBrmfree\fR(9F)
105 \fIWriting Device Drivers\fR