home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / open.h < prev    next >
Encoding:
Text File  |  1988-06-26  |  1.9 KB  |  48 lines

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