1rmallocmap(9F)           Kernel Functions for Drivers           rmallocmap(9F)
2
3
4

NAME

6       rmallocmap,  rmallocmap_wait,  rmfreemap  -  allocate and free resource
7       maps
8

SYNOPSIS

10       #include <sys/ddi.h>
11       #include <sys/sunddi.h>
12
13
14
15       struct map *rmallocmap(size_t mapsize);
16
17
18       struct map *rmallocmap_wait(size_t mapsize);
19
20
21       void rmfreemap(struct map *mp);
22
23

INTERFACE LEVEL

25       Architecture independent level 1 (DDI/DKI).
26

PARAMETERS

28       mapsize     Number of entries for the map.
29
30
31       mp          A pointer to the map structure to be deallocated.
32
33

DESCRIPTION

35       rmallocmap() dynamically allocates a resource map structure. The  argu‐
36       ment  mapsize defines the total number of entries in the map.  In  par‐
37       ticular, it is the total number of allocations that can be  outstanding
38       at any one time.
39
40
41       rmallocmap()  initializes  the  map  but does not associate it with the
42       actual resource. In  order  to  associate   the  map  with  the  actual
43       resource,  a  call  to  rmfree(9F)  is used to make the entirety of the
44       actual resource available for allocation, starting from the first index
45       into the resource. Typically, the call to rmallocmap() is followed by a
46       call to rmfree(9F), passing the address of the map returned from  rmal‐
47       locmap(),  the total size of the resource, and the first index into the
48       actual resource.
49
50
51       The resource map allocated by rmallocmap() can be used to  describe  an
52       arbitrary  resource  in whatever allocation units are appropriate, such
53       as blocks, pages, or data structures. This resource can then be managed
54       by  the  system  by subsequent calls to  rmalloc(9F), rmalloc_wait(9F),
55       and rmfree(9F).
56
57
58       rmallocmap_wait() is similar to  rmallocmap(), with the exception  that
59       it will wait for space to become available if necessary.
60
61
62       rmfreemap()  deallocates  a resource map structure previously allocated
63       by rmallocmap() or rmallocmap_wait(). The argument mp is a  pointer  to
64       the map structure to be deallocated.
65

RETURN VALUES

67       Upon  successful completion, rmallocmap() and  rmallocmap_wait() return
68       a pointer to the newly allocated map  structure.  Upon  failure,  rmal‐
69       locmap() returns a  NULL pointer.
70

CONTEXT

72       rmallocmap() and rmfreemap() can be called from user, kernel, or inter‐
73       rupt context.
74
75
76       rmallocmap_wait() can only be called from user or kernel context.
77

SEE ALSO

79       rmalloc(9F), rmalloc_wait(9F), rmfree(9F)
80
81
82       Writing Device Drivers
83
84
85
86SunOS 5.11                        20 Nov 1996                   rmallocmap(9F)
Impressum