1 /* $OpenBSD: specdev.h,v 1.17 2003/09/23 16:51:13 millert Exp $ */ 2 /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ 3 4 /* 5 * Copyright (c) 1990, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)specdev.h 8.3 (Berkeley) 8/10/94 33 */ 34 35 /* 36 * This structure defines the information maintained about 37 * special devices. It is allocated in checkalias and freed 38 * in vgone. 39 */ 40 struct specinfo { 41 struct vnode **si_hashchain; 42 struct vnode *si_specnext; 43 struct mount *si_mountpoint; 44 dev_t si_rdev; 45 struct lockf *si_lockf; 46 daddr_t si_lastr; 47 }; 48 /* 49 * Exported shorthand 50 */ 51 #define v_rdev v_specinfo->si_rdev 52 #define v_hashchain v_specinfo->si_hashchain 53 #define v_specnext v_specinfo->si_specnext 54 #define v_specmountpoint v_specinfo->si_mountpoint 55 #define v_speclockf v_specinfo->si_lockf 56 57 /* 58 * Special device management 59 */ 60 #define SPECHSZ 64 61 #if ((SPECHSZ&(SPECHSZ-1)) == 0) 62 #define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1)) 63 #else 64 #define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ) 65 #endif 66 67 extern struct vnode *speclisth[SPECHSZ]; 68 69 /* 70 * Prototypes for special file operations on vnodes. 71 */ 72 extern int (**spec_vnodeop_p)(void *); 73 struct nameidata; 74 struct componentname; 75 struct ucred; 76 struct flock; 77 struct buf; 78 struct uio; 79 80 int spec_badop(void *); 81 int spec_ebadf(void *); 82 83 int spec_lookup(void *); 84 #define spec_create spec_badop 85 #define spec_mknod spec_badop 86 int spec_open(void *); 87 int spec_close(void *); 88 #define spec_access spec_ebadf 89 #define spec_getattr spec_ebadf 90 #define spec_setattr spec_ebadf 91 int spec_read(void *); 92 int spec_write(void *); 93 #define spec_lease_check nullop 94 int spec_ioctl(void *); 95 int spec_poll(void *); 96 int spec_kqfilter(void *); 97 int spec_fsync(void *); 98 #define spec_remove spec_badop 99 #define spec_link spec_badop 100 #define spec_rename spec_badop 101 #define spec_mkdir spec_badop 102 #define spec_rmdir spec_badop 103 #define spec_symlink spec_badop 104 #define spec_readdir spec_badop 105 #define spec_readlink spec_badop 106 #define spec_abortop spec_badop 107 int spec_inactive(void *); 108 #define spec_reclaim nullop 109 #define spec_lock vop_generic_lock 110 #define spec_unlock vop_generic_unlock 111 #define spec_islocked vop_generic_islocked 112 int spec_bmap(void *); 113 int spec_strategy(void *); 114 int spec_print(void *); 115 int spec_pathconf(void *); 116 int spec_advlock(void *); 117 #define spec_reallocblks spec_badop 118 #define spec_bwrite vop_generic_bwrite 119 #define spec_revoke vop_generic_revoke 120 121 int spec_vnoperate(void *); 122