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 DEVMAP_DUP 9E "Jan 21, 1997"
8 devmap_dup \- device mapping duplication entry point
13 #include <sys/sunddi.h
17 \fB int prefix\fR\fBdevmap_dup\fR(\fBdevmap_cookie_t\fR \fIdhp\fR, \fBvoid *\fR\fIpvtp\fR,
18 \fBdevmap_cookie_t\fR \fInew_dhp\fR, \fBvoid **\fR\fInew_pvtp\fR);
24 Solaris DDI specific (Solaris DDI).
32 An opaque mapping handle that the system uses to describe the mapping currently
42 Driver private mapping data for the mapping currently being duplicated.
51 An opaque data structure that the system uses to describe the duplicated device
61 A pointer to be filled in by device drivers with the driver private mapping
62 data for the duplicated device mapping.
68 The system calls \fBdevmap_dup()\fR when a device mapping is duplicated, such
69 as during the execution of the \fBfork\fR(2) system call. The system expects
70 \fBdevmap_dup()\fR to generate new driver private data for the new mapping, and
71 to set \fInew_pvtp\fR to point to it. \fInew_dhp\fR is the handle of the new
75 A non-zero return value from \fBdevmap_dup()\fR will cause a corresponding
76 operation such as \fBfork()\fR to fail.
80 \fBdevmap_dup()\fR returns the following values:
87 Successful completion.
104 xxdevmap_dup(devmap_cookie_t dhp, void *pvtp, \e
105 devmap_cookie_t new_dhp,
108 struct xxpvtdata *prvtdata;
109 struct xxpvtdata *p = (struct xxpvtdata *)pvtp;
110 struct xx_softc *softc = p->softc;
111 mutex_enter(&softc->mutex);
112 /* Allocate a new private data structure */
113 prvtdata = kmem_alloc(sizeof (struct xxpvtdata), KM_SLEEP);
114 /* Return the new data */
115 prvtdata->off = p->off;
116 prvtdata->len = p->len;
117 prvtdata->ctx = p->ctx;
118 prvtdata->dhp = new_dhp;
119 prvtdata->softc = p->softc;
120 *new_pvtp = prvtdata;
121 mutex_exit(&softc->mutex);
130 \fBfork\fR(2), \fBdevmap_callback_ctl\fR(9S)
133 \fIWriting Device Drivers\fR