1devmap_dup(9E)                Driver Entry Points               devmap_dup(9E)
2
3
4

NAME

6       devmap_dup - device mapping duplication entry point
7

SYNOPSIS

9       #include <sys/ddi.h>
10       #include <sys/sunddi.h
11
12
13
14        int prefixdevmap_dup(devmap_cookie_t dhp, void *pvtp,
15            devmap_cookie_t new_dhp, void **new_pvtp);
16
17

INTERFACE LEVEL

19       Solaris DDI specific (Solaris DDI).
20

ARGUMENTS

22       dhp          An  opaque mapping handle that the system uses to describe
23                    the mapping currently being duplicated.
24
25
26       pvtp         Driver private mapping  data  for  the  mapping  currently
27                    being duplicated.
28
29
30       new_dhp      An  opaque data structure that the system uses to describe
31                    the duplicated device mapping.
32
33
34       new_pvtp     A pointer to be filled  in  by  device  drivers  with  the
35                    driver private mapping data for the duplicated device map‐
36                    ping.
37
38

DESCRIPTION

40       The system calls devmap_dup() when a device mapping is duplicated, such
41       as during the execution of the fork(2) system call.  The system expects
42       devmap_dup() to generate new driver private data for the  new  mapping,
43       and  to  set  new_pvtp to point to it. new_dhp is the handle of the new
44       mapped object.
45
46
47       A non-zero return value from  devmap_dup() will cause  a  corresponding
48       operation such as fork() to fail.
49

RETURN VALUES

51       devmap_dup() returns the following values:
52
53       0           Successful completion.
54
55
56       Non-zero    An error occurred.
57
58

EXAMPLES

60         static int
61         xxdevmap_dup(devmap_cookie_t dhp, void *pvtp, \
62             devmap_cookie_t new_dhp,
63             void **new_pvtp)
64         {
65             struct xxpvtdata    *prvtdata;
66             struct xxpvtdata    *p = (struct xxpvtdata *)pvtp;
67             struct xx_softc     *softc = p->softc;
68             mutex_enter(&softc->mutex);
69             /* Allocate a new private data structure */
70             prvtdata = kmem_alloc(sizeof (struct xxpvtdata), KM_SLEEP);
71             /* Return the new data */
72             prvtdata->off = p->off;
73             prvtdata->len = p->len;
74             prvtdata->ctx = p->ctx;
75             prvtdata->dhp = new_dhp;
76             prvtdata->softc = p->softc;
77             *new_pvtp = prvtdata;
78             mutex_exit(&softc->mutex);
79             return (0);
80         }
81
82

SEE ALSO

84       fork(2), devmap_callback_ctl(9S)
85
86
87       Writing Device Drivers
88
89
90
91SunOS 5.11                        21 Jan 1997                   devmap_dup(9E)
Impressum