home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / open.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.1 KB  |  53 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_OPEN_H
  11. #define _SYS_OPEN_H
  12.  
  13. #ident    "@(#)/usr/include/sys/open.h.sl 1.1 4.0 12/08/90 25648 AT&T-USL"
  14. /* Some drivers need to be able to keep accurate records of open/close
  15.  * calls to determine whether a device is still in use.  To allow this
  16.  * open/close calls have been typed and the type is passed as a third
  17.  * argument in open/close calls, as in:
  18.  *    (*cdevsw[getmajor(dev)].d_open)(getminor(dev), flag, OTYP_CHR);
  19.  * or
  20.  *    (*cdevsw[getmajor(dev)].d_close)(getminor(dev), flag, OTYP_CHR);
  21.  * Five types of open/close calls have been defined:
  22.  * OTYP_BLK:    open/close of a block special file
  23.  * OTYP_MNT:    open/close for mounting/unmounting a file system
  24.  * OTYP_CHR:    open/close of a character special file
  25.  * OTYP_SWP:    open/close of a swapping device.
  26.  * OTYP_LYR:    open/close calls from a driver to another driver,
  27.  *        without a file being open for the dev of the lower driver.
  28.  *
  29.  * The first four types of open/close calls obey the protocol rule
  30.  * that many more opens may occur for a given minor(dev) for that type of open,
  31.  * but a close call happens only on the last close of that dev.
  32.  * This protocol allows a flag to be used (set by opens, cleared by closes)
  33.  * to keep track of the state for a given minor device value.
  34.  *
  35.  * Calls of the fifth type (OTYP_LYR) must obey the protocol rule
  36.  * that open and close call calls are always paired.  This protocol
  37.  * permits several drivers to be layers above the same device driver.
  38.  * A counter can be used for this protocol.
  39.  *
  40.  * The value OTYPCNT is defined for the purpose of declaring arrays
  41.  * in drivers and for performing range checks (0 <= otyp < OTYPCNT)
  42.  * on values passed.
  43.  */
  44.  
  45. #define OTYPCNT        5
  46. #define OTYP_BLK    0
  47. #define OTYP_MNT    1
  48. #define OTYP_CHR    2
  49. #define OTYP_SWP    3
  50. #define OTYP_LYR    4
  51.  
  52. #endif    /* _SYS_OPEN_H */
  53.