| 1 | /* |
| 2 | * Copyright (c) 1990, 1993 |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | * |
| 5 | * %sccs.include.redist.c% |
| 6 | * |
| 7 | * @(#)specdev.h 8.2 (Berkeley) %G% |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * This structure defines the information maintained about |
| 12 | * special devices. It is allocated in checkalias and freed |
| 13 | * in vgone. |
| 14 | */ |
| 15 | struct specinfo { |
| 16 | struct vnode **si_hashchain; |
| 17 | struct vnode *si_specnext; |
| 18 | long si_flags; |
| 19 | dev_t si_rdev; |
| 20 | }; |
| 21 | /* |
| 22 | * Exported shorthand |
| 23 | */ |
| 24 | #define v_rdev v_specinfo->si_rdev |
| 25 | #define v_hashchain v_specinfo->si_hashchain |
| 26 | #define v_specnext v_specinfo->si_specnext |
| 27 | #define v_specflags v_specinfo->si_flags |
| 28 | |
| 29 | /* |
| 30 | * Flags for specinfo |
| 31 | */ |
| 32 | #define SI_MOUNTEDON 0x0001 /* block special device is mounted on */ |
| 33 | |
| 34 | /* |
| 35 | * Special device management |
| 36 | */ |
| 37 | #define SPECHSZ 64 |
| 38 | #if ((SPECHSZ&(SPECHSZ-1)) == 0) |
| 39 | #define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1)) |
| 40 | #else |
| 41 | #define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ) |
| 42 | #endif |
| 43 | |
| 44 | struct vnode *speclisth[SPECHSZ]; |
| 45 | |
| 46 | /* |
| 47 | * Prototypes for special file operations on vnodes. |
| 48 | */ |
| 49 | extern int (**spec_vnodeop_p)(); |
| 50 | struct nameidata; |
| 51 | struct componentname; |
| 52 | struct ucred; |
| 53 | struct flock; |
| 54 | struct buf; |
| 55 | struct uio; |
| 56 | |
| 57 | int spec_badop(), |
| 58 | spec_ebadf(); |
| 59 | |
| 60 | int spec_lookup __P((struct vop_lookup_args *)); |
| 61 | #define spec_create ((int (*) __P((struct vop_create_args *)))spec_badop) |
| 62 | #define spec_mknod ((int (*) __P((struct vop_mknod_args *)))spec_badop) |
| 63 | int spec_open __P((struct vop_open_args *)); |
| 64 | int spec_close __P((struct vop_close_args *)); |
| 65 | #define spec_access ((int (*) __P((struct vop_access_args *)))spec_ebadf) |
| 66 | #define spec_getattr ((int (*) __P((struct vop_getattr_args *)))spec_ebadf) |
| 67 | #define spec_setattr ((int (*) __P((struct vop_setattr_args *)))spec_ebadf) |
| 68 | int spec_read __P((struct vop_read_args *)); |
| 69 | int spec_write __P((struct vop_write_args *)); |
| 70 | int spec_ioctl __P((struct vop_ioctl_args *)); |
| 71 | int spec_select __P((struct vop_select_args *)); |
| 72 | #define spec_mmap ((int (*) __P((struct vop_mmap_args *)))spec_badop) |
| 73 | int spec_fsync __P((struct vop_fsync_args *)); |
| 74 | #define spec_seek ((int (*) __P((struct vop_seek_args *)))spec_badop) |
| 75 | #define spec_remove ((int (*) __P((struct vop_remove_args *)))spec_badop) |
| 76 | #define spec_link ((int (*) __P((struct vop_link_args *)))spec_badop) |
| 77 | #define spec_rename ((int (*) __P((struct vop_rename_args *)))spec_badop) |
| 78 | #define spec_mkdir ((int (*) __P((struct vop_mkdir_args *)))spec_badop) |
| 79 | #define spec_rmdir ((int (*) __P((struct vop_rmdir_args *)))spec_badop) |
| 80 | #define spec_symlink ((int (*) __P((struct vop_symlink_args *)))spec_badop) |
| 81 | #define spec_readdir ((int (*) __P((struct vop_readdir_args *)))spec_badop) |
| 82 | #define spec_readlink ((int (*) __P((struct vop_readlink_args *)))spec_badop) |
| 83 | #define spec_abortop ((int (*) __P((struct vop_abortop_args *)))spec_badop) |
| 84 | #define spec_inactive ((int (*) __P((struct vop_inactive_args *)))nullop) |
| 85 | #define spec_reclaim ((int (*) __P((struct vop_reclaim_args *)))nullop) |
| 86 | int spec_lock __P((struct vop_lock_args *)); |
| 87 | int spec_unlock __P((struct vop_unlock_args *)); |
| 88 | int spec_bmap __P((struct vop_bmap_args *)); |
| 89 | int spec_strategy __P((struct vop_strategy_args *)); |
| 90 | int spec_print __P((struct vop_print_args *)); |
| 91 | #define spec_islocked ((int (*) __P((struct vop_islocked_args *)))nullop) |
| 92 | int spec_pathconf __P((struct vop_pathconf_args *)); |
| 93 | int spec_advlock __P((struct vop_advlock_args *)); |
| 94 | #define spec_blkatoff ((int (*) __P((struct vop_blkatoff_args *)))spec_badop) |
| 95 | #define spec_valloc ((int (*) __P((struct vop_valloc_args *)))spec_badop) |
| 96 | #define spec_reallocblks \ |
| 97 | ((int (*) __P((struct vop_reallocblks_args *)))spec_badop) |
| 98 | #define spec_vfree ((int (*) __P((struct vop_vfree_args *)))spec_badop) |
| 99 | #define spec_truncate ((int (*) __P((struct vop_truncate_args *)))nullop) |
| 100 | #define spec_update ((int (*) __P((struct vop_update_args *)))nullop) |
| 101 | #define spec_bwrite ((int (*) __P((struct vop_bwrite_args *)))nullop) |