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