2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * @(#)dead_vnops.c 8.1 (Berkeley) 6/10/93
33 #include <sys/param.h>
34 #include <sys/systm.h>
35 #include <sys/kernel.h>
37 #include <sys/mutex.h>
39 #include <sys/vnode.h>
42 * Prototypes for dead operations on vnodes.
44 static vop_lookup_t dead_lookup;
45 static vop_open_t dead_open;
46 static vop_poll_t dead_poll;
47 static vop_read_t dead_read;
48 static vop_write_t dead_write;
49 static vop_getwritemount_t dead_getwritemount;
50 static vop_rename_t dead_rename;
52 struct vop_vector dead_vnodeops = {
53 .vop_default = &default_vnodeops,
55 .vop_access = VOP_EBADF,
56 .vop_advlock = VOP_EBADF,
57 .vop_bmap = VOP_EBADF,
58 .vop_create = VOP_PANIC,
59 .vop_getattr = VOP_EBADF,
60 .vop_getwritemount = dead_getwritemount,
61 .vop_inactive = VOP_NULL,
62 .vop_ioctl = VOP_EBADF,
63 .vop_link = VOP_PANIC,
64 .vop_lookup = dead_lookup,
65 .vop_mkdir = VOP_PANIC,
66 .vop_mknod = VOP_PANIC,
67 .vop_open = dead_open,
68 .vop_pathconf = VOP_EBADF, /* per pathconf(2) */
69 .vop_poll = dead_poll,
70 .vop_read = dead_read,
71 .vop_readdir = VOP_EBADF,
72 .vop_readlink = VOP_EBADF,
73 .vop_reclaim = VOP_NULL,
74 .vop_remove = VOP_PANIC,
75 .vop_rename = dead_rename,
76 .vop_rmdir = VOP_PANIC,
77 .vop_setattr = VOP_EBADF,
78 .vop_symlink = VOP_PANIC,
79 .vop_vptocnp = VOP_EBADF,
80 .vop_write = dead_write,
85 dead_getwritemount(ap)
86 struct vop_getwritemount_args /* {
96 * Trivial lookup routine that always fails.
101 struct vop_lookup_args /* {
102 struct vnode * a_dvp;
103 struct vnode ** a_vpp;
104 struct componentname * a_cnp;
113 * Open always fails as if device did not exist.
118 struct vop_open_args /* {
121 struct ucred *a_cred;
135 struct vop_read_args /* {
139 struct ucred *a_cred;
143 * Return EOF for tty devices, EIO for others
145 if ((ap->a_vp->v_vflag & VV_ISTTY) == 0)
156 struct vop_write_args /* {
160 struct ucred *a_cred;
167 * Trivial poll routine that always returns POLLHUP.
168 * This is necessary so that a process which is polling a file
169 * gets notified when that file is revoke()d.
173 struct vop_poll_args *ap;
180 struct vop_rename_args /* {
181 struct vnode *a_fdvp;
183 struct componentname *a_fcnp;
184 struct vnode *a_tdvp;
186 struct componentname *a_tcnp;