home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / sad.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.8 KB  |  145 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_SAD_H
  11. #define _SYS_SAD_H
  12.  
  13. #ident    "@(#)/usr/include/sys/sad.h.sl 1.1 4.0 12/08/90 46301 AT&T-USL"
  14.  
  15. /*
  16.  * Streams Administrative Driver
  17.  */
  18.  
  19. /*
  20.  *  ioctl defines
  21.  */
  22. #define    SADIOC        ('D'<<8)
  23. #define SAD_SAP        (SADIOC|01)    /* set autopush */
  24. #define SAD_GAP        (SADIOC|02)    /* get autopush */
  25. #define SAD_VML        (SADIOC|03)    /* validate module list */
  26.  
  27. /*
  28.  * Device naming and numbering conventions.
  29.  */
  30. #define USERDEV "/dev/sad/user"
  31. #define ADMINDEV "/dev/sad/admin"
  32.  
  33. #define USRMIN 0
  34. #define ADMMIN 1
  35.  
  36. /*
  37.  * The maximum modules you can push on a stream using
  38.  * the autopush feature.  This should be less than NSTRPUSH.
  39.  */
  40. #define MAXAPUSH    8
  41.  
  42. /*
  43.  * autopush info common to user and kernel
  44.  */
  45. struct apcommon {
  46.     uint    apc_cmd;        /* command (see below) */
  47.     long    apc_major;        /* major # of device */
  48.     long    apc_minor;        /* minor # of device */
  49.     long    apc_lastminor;        /* last minor for range */
  50.     uint    apc_npush;        /* number of modules to push */
  51. };
  52.  
  53. /*
  54.  * ap_cmd: various flavors of autopush
  55.  */
  56. #define SAP_CLEAR    0        /* remove configuration list */
  57. #define SAP_ONE        1        /* configure one minor device */
  58. #define SAP_RANGE    2        /* configure range of minor devices */
  59. #define SAP_ALL        3        /* configure all minor devices */
  60.  
  61. /*
  62.  * format for autopush ioctls
  63.  */
  64. struct strapush {
  65.     struct apcommon sap_common;                /* see above */
  66.     char        sap_list[MAXAPUSH][FMNAMESZ + 1];    /* module list */
  67. };
  68.  
  69. #define sap_cmd        sap_common.apc_cmd
  70. #define sap_major    sap_common.apc_major
  71. #define sap_minor    sap_common.apc_minor
  72. #define sap_lastminor    sap_common.apc_lastminor
  73. #define sap_npush    sap_common.apc_npush
  74.  
  75. #ifdef _KERNEL
  76.  
  77. /*
  78.  * state values for ioctls
  79.  */
  80. #define GETSTRUCT    1
  81. #define GETRESULT    2
  82. #define GETLIST        3
  83.  
  84. struct saddev {
  85.     queue_t    *sa_qp;        /* pointer to read queue */
  86.     caddr_t     sa_addr;    /* saved address for copyout */
  87.     int     sa_flags;    /* see below */
  88. };
  89.  
  90. /*
  91.  * values for saddev flags field.
  92.  */
  93. #define SADPRIV        0x01
  94.  
  95. /*
  96.  * Module Autopush Cache
  97.  */
  98. struct autopush {
  99.     struct autopush    *ap_nextp;        /* next on list */
  100.     int         ap_flags;        /* see below */
  101.     struct apcommon  ap_common;        /* see above */
  102.     ushort         ap_list[MAXAPUSH];    /* list of modules to push */
  103.                         /* (indices into fmodsw array) */
  104. };
  105.  
  106. /*
  107.  * The command issued by the user ultimately becomes
  108.  * the type of the autopush entry.  Therefore, occurrences of
  109.  * "type" in the code refer to an existing autopush entry.
  110.  * Occurrences of "cmd" in the code refer to the command the
  111.  * user is currently trying to complete.  types and cmds take
  112.  * on the same values.
  113.  */
  114. #define ap_type        ap_common.apc_cmd
  115. #define ap_major    ap_common.apc_major
  116. #define ap_minor    ap_common.apc_minor
  117. #define ap_lastminor    ap_common.apc_lastminor
  118. #define ap_npush    ap_common.apc_npush
  119.  
  120. /*
  121.  * autopush flag values
  122.  */
  123. #define APFREE    0x00    /* free */
  124. #define APUSED    0x01    /* used */
  125. #define APHASH    0x02    /* on hash list */
  126.  
  127. /*
  128.  * hash function for cache
  129.  */
  130. #define strphash(maj)    strpcache[(((int)maj)&strpmask)]
  131.  
  132. extern struct saddev saddev[];        /* sad device array */
  133. extern int sadcnt;            /* number of sad devices */
  134. extern struct autopush autopush[];    /* autopush data array */
  135. extern int nautopush;            /* maximum number of autopushable devices */
  136. extern struct autopush *strpfreep;    /* autopush freelist */
  137. extern struct autopush *strpcache[];    /* autopush hash list */
  138. extern int nstrphash;            /* size of hash list */
  139. extern int strpmask;            /* used in hash function */
  140. extern queue_t *sadminqp;        /* queue for STREAMS admin daemon */
  141.  
  142. #endif /* _KERNEL */
  143.  
  144. #endif    /* _SYS_SAD_H */
  145.