4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
34 * Some drivers need to be able to keep accurate records of open/close
35 * calls to determine whether a device is still in use. To allow this
36 * open/close calls have been typed and the type is passed as a third
37 * argument in open/close calls, as in:
38 * (*cdevsw[getmajor(dev)].d_open)(getminor(dev), flag, OTYP_CHR);
40 * (*cdevsw[getmajor(dev)].d_close)(getminor(dev), flag, OTYP_CHR);
41 * Five types of open/close calls have been defined:
42 * OTYP_BLK: open/close of a block special file
43 * OTYP_MNT: open/close for mounting/unmounting a file system
44 * OTYP_CHR: open/close of a character special file
45 * OTYP_SWP: open/close of a swapping device.
46 * OTYP_LYR: open/close calls from a driver to another driver,
47 * without a file being open for the dev of the lower driver.
49 * The first four types of open/close calls obey the protocol rule
50 * that many more opens may occur for a given minor(dev) for that type of open,
51 * but a close call happens only on the last close of that dev.
52 * This protocol allows a flag to be used (set by opens, cleared by closes)
53 * to keep track of the state for a given minor device value.
55 * Calls of the fifth type (OTYP_LYR) must obey the protocol rule
56 * that open and close call calls are always paired. This protocol
57 * permits several drivers to be layers above the same device driver.
58 * A counter can be used for this protocol.
60 * The value OTYPCNT is defined for the purpose of declaring arrays
61 * in drivers and for performing range checks (0 <= otyp < OTYPCNT)
76 #endif /* _SYS_OPEN_H */