home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / specdev.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  7.2 KB  |  255 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    specdev.h,v $
  29.  * Revision 2.1  92/04/21  17:16:21  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1990 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)specdev.h    7.4 (Berkeley) 4/19/91
  68.  */
  69.  
  70. /*
  71.  * This structure defines the information maintained about
  72.  * special devices. It is allocated in checkalias and freed
  73.  * in vgone.
  74.  */
  75. struct specinfo {
  76.     struct    vnode **si_hashchain;
  77.     struct    vnode *si_specnext;
  78.     long    si_flags;
  79.     dev_t    si_rdev;
  80. };
  81. /*
  82.  * Exported shorthand
  83.  */
  84. #define v_rdev v_specinfo->si_rdev
  85. #define v_hashchain v_specinfo->si_hashchain
  86. #define v_specnext v_specinfo->si_specnext
  87. #define v_specflags v_specinfo->si_flags
  88.  
  89. /*
  90.  * Flags for specinfo
  91.  */
  92. #define    SI_MOUNTEDON    0x0001    /* block special device is mounted on */
  93.  
  94. /*
  95.  * Special device management
  96.  */
  97. #define    SPECHSZ    64
  98. #if    ((SPECHSZ&(SPECHSZ-1)) == 0)
  99. #define    SPECHASH(rdev)    (((rdev>>5)+(rdev))&(SPECHSZ-1))
  100. #else
  101. #define    SPECHASH(rdev)    (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ)
  102. #endif
  103.  
  104. struct vnode *speclisth[SPECHSZ];
  105.  
  106. /*
  107.  * Prototypes for special file operations on vnodes.
  108.  */
  109. struct    nameidata;
  110. struct    ucred;
  111. struct    flock;
  112. struct    buf;
  113. struct    uio;
  114.  
  115. int    spec_badop(),
  116.     spec_ebadf();
  117.  
  118. int    spec_lookup __P((
  119.         struct vnode *vp,
  120.         struct nameidata *ndp,
  121.         struct proc *p));
  122. #define spec_create ((int (*) __P(( \
  123.         struct nameidata *ndp, \
  124.         struct vattr *vap, \
  125.         struct proc *p))) spec_badop)
  126. #define spec_mknod ((int (*) __P(( \
  127.         struct nameidata *ndp, \
  128.         struct vattr *vap, \
  129.         struct ucred *cred, \
  130.         struct proc *p))) spec_badop)
  131. int    spec_open __P((
  132.         struct vnode *vp,
  133.         int mode,
  134.         struct ucred *cred,
  135.         struct proc *p));
  136. int    spec_close __P((
  137.         struct vnode *vp,
  138.         int fflag,
  139.         struct ucred *cred,
  140.         struct proc *p));
  141. #define spec_access ((int (*) __P(( \
  142.         struct vnode *vp, \
  143.         int mode, \
  144.         struct ucred *cred, \
  145.         struct proc *p))) spec_ebadf)
  146. #define spec_getattr ((int (*) __P(( \
  147.         struct vnode *vp, \
  148.         struct vattr *vap, \
  149.         struct ucred *cred, \
  150.         struct proc *p))) spec_ebadf)
  151. #define spec_setattr ((int (*) __P(( \
  152.         struct vnode *vp, \
  153.         struct vattr *vap, \
  154.         struct ucred *cred, \
  155.         struct proc *p))) spec_ebadf)
  156. int    spec_read __P((
  157.         struct vnode *vp,
  158.         struct uio *uio,
  159.         int ioflag,
  160.         struct ucred *cred));
  161. int    spec_write __P((
  162.         struct vnode *vp,
  163.         struct uio *uio,
  164.         int ioflag,
  165.         struct ucred *cred));
  166. int    spec_ioctl __P((
  167.         struct vnode *vp,
  168.         int command,
  169.         caddr_t data,
  170.         int fflag,
  171.         struct ucred *cred,
  172.         struct proc *p));
  173. int    spec_select __P((
  174.         struct vnode *vp,
  175.         int which,
  176.         int fflags,
  177.         struct ucred *cred,
  178.         struct proc *p));
  179. #define spec_mmap ((int (*) __P(( \
  180.         struct vnode *vp, \
  181.         int fflags, \
  182.         struct ucred *cred, \
  183.         struct proc *p))) spec_badop)
  184. #define spec_fsync ((int (*) __P(( \
  185.         struct vnode *vp, \
  186.         int fflags, \
  187.         struct ucred *cred, \
  188.         int waitfor, \
  189.         struct proc *p))) nullop)
  190. #define spec_seek ((int (*) __P(( \
  191.         struct vnode *vp, \
  192.         off_t oldoff, \
  193.         off_t newoff, \
  194.         struct ucred *cred))) spec_badop)
  195. #define spec_remove ((int (*) __P(( \
  196.         struct nameidata *ndp, \
  197.         struct proc *p))) spec_badop)
  198. #define spec_link ((int (*) __P(( \
  199.         struct vnode *vp, \
  200.         struct nameidata *ndp, \
  201.         struct proc *p))) spec_badop)
  202. #define spec_rename ((int (*) __P(( \
  203.         struct nameidata *fndp, \
  204.         struct nameidata *tdnp, \
  205.         struct proc *p))) spec_badop)
  206. #define spec_mkdir ((int (*) __P(( \
  207.         struct nameidata *ndp, \
  208.         struct vattr *vap, \
  209.         struct proc *p))) spec_badop)
  210. #define spec_rmdir ((int (*) __P(( \
  211.         struct nameidata *ndp, \
  212.         struct proc *p))) spec_badop)
  213. #define spec_symlink ((int (*) __P(( \
  214.         struct nameidata *ndp, \
  215.         struct vattr *vap, \
  216.         char *target, \
  217.         struct proc *p))) spec_badop)
  218. #define spec_readdir ((int (*) __P(( \
  219.         struct vnode *vp, \
  220.         struct uio *uio, \
  221.         struct ucred *cred, \
  222.         int *eofflagp))) spec_badop)
  223. #define spec_readlink ((int (*) __P(( \
  224.         struct vnode *vp, \
  225.         struct uio *uio, \
  226.         struct ucred *cred))) spec_badop)
  227. #define spec_abortop ((int (*) __P(( \
  228.         struct nameidata *ndp))) spec_badop)
  229. #define spec_inactive ((int (*) __P(( \
  230.         struct vnode *vp, \
  231.         struct proc *p))) nullop)
  232. #define spec_reclaim ((int (*) __P(( \
  233.         struct vnode *vp))) nullop)
  234. int    spec_lock __P((
  235.         struct vnode *vp));
  236. int    spec_unlock __P((
  237.         struct vnode *vp));
  238. int    spec_bmap __P((
  239.         struct vnode *vp,
  240.         daddr_t bn,
  241.         struct vnode **vpp,
  242.         daddr_t *bnp));
  243. int    spec_strategy __P((
  244.         struct buf *bp));
  245. int    spec_print __P((
  246.         struct vnode *vp));
  247. #define spec_islocked ((int (*) __P(( \
  248.         struct vnode *vp))) nullop)
  249. int    spec_advlock __P((
  250.         struct vnode *vp,
  251.         caddr_t id,
  252.         int op,
  253.         struct flock *fl,
  254.         int flags));
  255.