xref: /csrg-svn/sys/miscfs/specfs/specdev.h (revision 69596)
140654Smckusick /*
263247Sbostic  * Copyright (c) 1990, 1993
363247Sbostic  *	The Regents of the University of California.  All rights reserved.
440654Smckusick  *
544523Sbostic  * %sccs.include.redist.c%
640654Smckusick  *
7*69596Smckusick  *	@(#)specdev.h	8.6 (Berkeley) 05/21/95
840654Smckusick  */
940654Smckusick 
1040654Smckusick /*
1140654Smckusick  * This structure defines the information maintained about
1240654Smckusick  * special devices. It is allocated in checkalias and freed
1340654Smckusick  * in vgone.
1440654Smckusick  */
1540654Smckusick struct specinfo {
1640654Smckusick 	struct	vnode **si_hashchain;
1740654Smckusick 	struct	vnode *si_specnext;
1840654Smckusick 	long	si_flags;
1940654Smckusick 	dev_t	si_rdev;
2040654Smckusick };
2140654Smckusick /*
2240654Smckusick  * Exported shorthand
2340654Smckusick  */
2440654Smckusick #define v_rdev v_specinfo->si_rdev
2540654Smckusick #define v_hashchain v_specinfo->si_hashchain
2640654Smckusick #define v_specnext v_specinfo->si_specnext
2740654Smckusick #define v_specflags v_specinfo->si_flags
2840654Smckusick 
2940654Smckusick /*
3040654Smckusick  * Flags for specinfo
3140654Smckusick  */
3240654Smckusick #define	SI_MOUNTEDON	0x0001	/* block special device is mounted on */
3340654Smckusick 
3440654Smckusick /*
3540654Smckusick  * Special device management
3640654Smckusick  */
3740654Smckusick #define	SPECHSZ	64
3840654Smckusick #if	((SPECHSZ&(SPECHSZ-1)) == 0)
3940654Smckusick #define	SPECHASH(rdev)	(((rdev>>5)+(rdev))&(SPECHSZ-1))
4040654Smckusick #else
4140654Smckusick #define	SPECHASH(rdev)	(((unsigned)((rdev>>5)+(rdev)))%SPECHSZ)
4240654Smckusick #endif
4340654Smckusick 
4440654Smckusick struct vnode *speclisth[SPECHSZ];
4548009Smckusick 
4648009Smckusick /*
4748009Smckusick  * Prototypes for special file operations on vnodes.
4848009Smckusick  */
4955700Smckusick extern	int (**spec_vnodeop_p)();
5048363Smckusick struct	nameidata;
5152313Sheideman struct	componentname;
5248363Smckusick struct	ucred;
5348363Smckusick struct	flock;
5448363Smckusick struct	buf;
5548363Smckusick struct	uio;
5648363Smckusick 
5748009Smckusick int	spec_badop(),
5848009Smckusick 	spec_ebadf();
5948009Smckusick 
6053558Sheideman int	spec_lookup __P((struct vop_lookup_args *));
6153558Sheideman #define spec_create ((int (*) __P((struct  vop_create_args *)))spec_badop)
6253558Sheideman #define spec_mknod ((int (*) __P((struct  vop_mknod_args *)))spec_badop)
6353558Sheideman int	spec_open __P((struct vop_open_args *));
6453558Sheideman int	spec_close __P((struct vop_close_args *));
6553558Sheideman #define spec_access ((int (*) __P((struct  vop_access_args *)))spec_ebadf)
6653558Sheideman #define spec_getattr ((int (*) __P((struct  vop_getattr_args *)))spec_ebadf)
6753558Sheideman #define spec_setattr ((int (*) __P((struct  vop_setattr_args *)))spec_ebadf)
6853558Sheideman int	spec_read __P((struct vop_read_args *));
6953558Sheideman int	spec_write __P((struct vop_write_args *));
7067644Smckusick #define	spec_lease_check ((int (*) __P((struct  vop_lease_args *)))nullop)
7153558Sheideman int	spec_ioctl __P((struct vop_ioctl_args *));
7253558Sheideman int	spec_select __P((struct vop_select_args *));
7368410Smckusick #define	spec_revoke vop_revoke
7453558Sheideman #define spec_mmap ((int (*) __P((struct  vop_mmap_args *)))spec_badop)
7554379Smckusick int	spec_fsync __P((struct  vop_fsync_args *));
7653558Sheideman #define spec_seek ((int (*) __P((struct  vop_seek_args *)))spec_badop)
7753558Sheideman #define spec_remove ((int (*) __P((struct  vop_remove_args *)))spec_badop)
7853558Sheideman #define spec_link ((int (*) __P((struct  vop_link_args *)))spec_badop)
7953558Sheideman #define spec_rename ((int (*) __P((struct  vop_rename_args *)))spec_badop)
8053558Sheideman #define spec_mkdir ((int (*) __P((struct  vop_mkdir_args *)))spec_badop)
8153558Sheideman #define spec_rmdir ((int (*) __P((struct  vop_rmdir_args *)))spec_badop)
8253558Sheideman #define spec_symlink ((int (*) __P((struct  vop_symlink_args *)))spec_badop)
8353558Sheideman #define spec_readdir ((int (*) __P((struct  vop_readdir_args *)))spec_badop)
8453558Sheideman #define spec_readlink ((int (*) __P((struct  vop_readlink_args *)))spec_badop)
8553558Sheideman #define spec_abortop ((int (*) __P((struct  vop_abortop_args *)))spec_badop)
86*69596Smckusick int	spec_inactive __P((struct  vop_inactive_args *));
8753558Sheideman #define spec_reclaim ((int (*) __P((struct  vop_reclaim_args *)))nullop)
8869443Smckusick #define spec_lock ((int (*) __P((struct  vop_lock_args *)))vop_nolock)
8969443Smckusick #define spec_unlock ((int (*) __P((struct  vop_unlock_args *)))vop_nounlock)
9053558Sheideman int	spec_bmap __P((struct vop_bmap_args *));
9153558Sheideman int	spec_strategy __P((struct vop_strategy_args *));
9253558Sheideman int	spec_print __P((struct vop_print_args *));
9369443Smckusick #define spec_islocked ((int(*) __P((struct vop_islocked_args *)))vop_noislocked)
9460391Smckusick int	spec_pathconf __P((struct vop_pathconf_args *));
9553558Sheideman int	spec_advlock __P((struct vop_advlock_args *));
9653558Sheideman #define spec_blkatoff ((int (*) __P((struct  vop_blkatoff_args *)))spec_badop)
9753558Sheideman #define spec_valloc ((int (*) __P((struct  vop_valloc_args *)))spec_badop)
9865973Smckusick #define spec_reallocblks \
9965973Smckusick 	((int (*) __P((struct  vop_reallocblks_args *)))spec_badop)
10053558Sheideman #define spec_vfree ((int (*) __P((struct  vop_vfree_args *)))spec_badop)
10153558Sheideman #define spec_truncate ((int (*) __P((struct  vop_truncate_args *)))nullop)
10253558Sheideman #define spec_update ((int (*) __P((struct  vop_update_args *)))nullop)
10353558Sheideman #define spec_bwrite ((int (*) __P((struct  vop_bwrite_args *)))nullop)
104