1
0
Files
irix-657m-src/irix/kern/sys/open.h
2022-09-29 17:59:04 +03:00

52 lines
2.1 KiB
C

/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
/*#ident "@(#)kern-port:sys/open.h 10.2"*/
#ident "$Revision: 3.5 $"
/* Some drivers need to be able to keep accurate records of open/close
* calls to determine whether a device is still in use. To allow this
* open/close calls have been typed and the type is passed as a third
* argument in open/close calls, as in:
* (*cdevsw[major(dev)].d_open)(minor(dev), flag, OTYP_CHR);
* or
* (*cdevsw[major(dev)].d_close)(minor(dev), flag, OTYP_CHR);
* Five types of open/close calls have been defined:
* OTYP_BLK: open/close of a block special file
* OTYP_MNT: open/close for mounting/unmounting a file system
* OTYP_CHR: open/close of a character special file
* OTYP_SWP: open/close of a swapping device.
* OTYP_LYR: open/close calls from a driver to another driver,
* without a file being open for the dev of the lower driver.
*
* The first four types of open/close calls obey the protocol rule
* that many more opens may occur for a given minor(dev) for that type of open,
* but a close call happens only on the last close of that dev.
* This protocol allows a flag to be used (set by opens, cleared by closes)
* to keep track of the state for a given minor device value.
*
* Calls of the fifth type (OTYP_LYR) must obey the protocol rule
* that open and close call calls are always paired. This protocol
* permits several drivers to be layers above the same device driver.
* A counter can be used for this protocol.
*
* OTYP_CLONE is used by the cln2 driver, to let the device open routine
* know that the open is through the cln2 device (the same way that the
* streams clone driver uses CLONEOPEN.)
*
* The value OTYPCNT is defined for the purpose of declaring arrays
* in drivers and for performing range checks (0 <= otyp < OTYPCNT)
* on values passed.
*/
#define OTYPCNT 6
#define OTYP_BLK 0
#define OTYP_MNT 1
#define OTYP_CHR 2
#define OTYP_SWP 3
#define OTYP_LYR 4
#define OTYP_CLONE 5