xref: /netbsd-src/sys/miscfs/nullfs/null_vnops.c (revision 9aa2a9c323eb12a08584c70d6ea91d316703d3fe)
1*9aa2a9c3Schristos /*	$NetBSD: null_vnops.c,v 1.43 2020/05/16 18:31:51 christos Exp $	*/
2cf92afd6Scgd 
3cde1d475Smycroft /*
49866514dSwrstuden  * Copyright (c) 1999 National Aeronautics & Space Administration
59866514dSwrstuden  * All rights reserved.
69866514dSwrstuden  *
79866514dSwrstuden  * This software was written by William Studenmund of the
8e265f988Swiz  * Numerical Aerospace Simulation Facility, NASA Ames Research Center.
99866514dSwrstuden  *
109866514dSwrstuden  * Redistribution and use in source and binary forms, with or without
119866514dSwrstuden  * modification, are permitted provided that the following conditions
129866514dSwrstuden  * are met:
139866514dSwrstuden  * 1. Redistributions of source code must retain the above copyright
149866514dSwrstuden  *    notice, this list of conditions and the following disclaimer.
159866514dSwrstuden  * 2. Redistributions in binary form must reproduce the above copyright
169866514dSwrstuden  *    notice, this list of conditions and the following disclaimer in the
179866514dSwrstuden  *    documentation and/or other materials provided with the distribution.
1895054da1Ssoren  * 3. Neither the name of the National Aeronautics & Space Administration
199866514dSwrstuden  *    nor the names of its contributors may be used to endorse or promote
209866514dSwrstuden  *    products derived from this software without specific prior written
219866514dSwrstuden  *    permission.
229866514dSwrstuden  *
239866514dSwrstuden  * THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION
249866514dSwrstuden  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
259866514dSwrstuden  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
269866514dSwrstuden  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ADMINISTRATION OR CONTRIB-
279866514dSwrstuden  * UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
289866514dSwrstuden  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
299866514dSwrstuden  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
309866514dSwrstuden  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
319866514dSwrstuden  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
329866514dSwrstuden  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
339866514dSwrstuden  * POSSIBILITY OF SUCH DAMAGE.
349866514dSwrstuden  */
3597272194Srmind 
369866514dSwrstuden /*
37cde1d475Smycroft  * Copyright (c) 1992, 1993
38cde1d475Smycroft  *	The Regents of the University of California.  All rights reserved.
39cde1d475Smycroft  *
40cde1d475Smycroft  * This code is derived from software contributed to Berkeley by
41cde1d475Smycroft  * John Heidemann of the UCLA Ficus project.
42cde1d475Smycroft  *
43cde1d475Smycroft  * Redistribution and use in source and binary forms, with or without
44cde1d475Smycroft  * modification, are permitted provided that the following conditions
45cde1d475Smycroft  * are met:
46cde1d475Smycroft  * 1. Redistributions of source code must retain the above copyright
47cde1d475Smycroft  *    notice, this list of conditions and the following disclaimer.
48cde1d475Smycroft  * 2. Redistributions in binary form must reproduce the above copyright
49cde1d475Smycroft  *    notice, this list of conditions and the following disclaimer in the
50cde1d475Smycroft  *    documentation and/or other materials provided with the distribution.
51aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
52cde1d475Smycroft  *    may be used to endorse or promote products derived from this software
53cde1d475Smycroft  *    without specific prior written permission.
54cde1d475Smycroft  *
55cde1d475Smycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56cde1d475Smycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57cde1d475Smycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58cde1d475Smycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59cde1d475Smycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60cde1d475Smycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61cde1d475Smycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62cde1d475Smycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63cde1d475Smycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64cde1d475Smycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65cde1d475Smycroft  * SUCH DAMAGE.
66cde1d475Smycroft  *
67e5bc90f4Sfvdl  *	@(#)null_vnops.c	8.6 (Berkeley) 5/27/95
68cde1d475Smycroft  *
69cde1d475Smycroft  * Ancestors:
70cde1d475Smycroft  *	@(#)lofs_vnops.c	1.2 (Berkeley) 6/18/92
712bbcff81Sjtk  *      Id: lofs_vnops.c,v 1.11 1992/05/30 10:05:43 jsp Exp jsp
72cde1d475Smycroft  *	...and...
73cde1d475Smycroft  *	@(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
74cde1d475Smycroft  */
75cde1d475Smycroft 
76cde1d475Smycroft /*
7797272194Srmind  * Null file-system.
78cde1d475Smycroft  *
7997272194Srmind  * Implemented using layerfs, see layer_vnops.c for a description.
80cde1d475Smycroft  */
81cde1d475Smycroft 
82e4b00f43Slukem #include <sys/cdefs.h>
83*9aa2a9c3Schristos __KERNEL_RCSID(0, "$NetBSD: null_vnops.c,v 1.43 2020/05/16 18:31:51 christos Exp $");
84e4b00f43Slukem 
85cde1d475Smycroft #include <sys/param.h>
86cde1d475Smycroft #include <sys/systm.h>
87cde1d475Smycroft #include <sys/vnode.h>
8897272194Srmind 
89e5bc90f4Sfvdl #include <miscfs/genfs/genfs.h>
909866514dSwrstuden #include <miscfs/genfs/layer_extern.h>
9197272194Srmind #include <miscfs/nullfs/null.h>
92cde1d475Smycroft 
93cde1d475Smycroft /*
9497272194Srmind  * Global VFS data structures.
95cde1d475Smycroft  */
9697272194Srmind 
97af97f2e8Sxtraeme int (**null_vnodeop_p)(void *);
9897272194Srmind 
99d9466585Sjdolecek const struct vnodeopv_entry_desc null_vnodeop_entries[] = {
1009866514dSwrstuden 	{ &vop_default_desc,	layer_bypass },
101cde1d475Smycroft 
1029866514dSwrstuden 	{ &vop_lookup_desc,	layer_lookup },
1039866514dSwrstuden 	{ &vop_setattr_desc,	layer_setattr },
1049866514dSwrstuden 	{ &vop_getattr_desc,	layer_getattr },
1059866514dSwrstuden 	{ &vop_access_desc,	layer_access },
106*9aa2a9c3Schristos 	{ &vop_accessx_desc,	genfs_accessx },
1079866514dSwrstuden 	{ &vop_fsync_desc,	layer_fsync },
1089866514dSwrstuden 	{ &vop_inactive_desc,	layer_inactive },
1099866514dSwrstuden 	{ &vop_reclaim_desc,	layer_reclaim },
1109866514dSwrstuden 	{ &vop_print_desc,	layer_print },
1116753c745Swrstuden 	{ &vop_remove_desc,	layer_remove },
112656e74e2Syamt 	{ &vop_rename_desc,	layer_rename },
113b89d0815Shannken 	{ &vop_revoke_desc,	layer_revoke },
1147ca8e916Shannken 	{ &vop_rmdir_desc,	layer_rmdir },
115cde1d475Smycroft 
1169866514dSwrstuden 	{ &vop_open_desc,	layer_open },	/* mount option handling */
1176412ef2bShannken 	{ &vop_close_desc,	layer_close },
118e045fbf3Sbouyer 
1199866514dSwrstuden 	{ &vop_bmap_desc,	layer_bmap },
1202776bd06Schs 	{ &vop_getpages_desc,	layer_getpages },
1214d146714Schs 	{ &vop_putpages_desc,	layer_putpages },
122cde1d475Smycroft 
1234d146714Schs 	{ NULL, NULL }
124cde1d475Smycroft };
12597272194Srmind 
12697272194Srmind const struct vnodeopv_desc null_vnodeop_opv_desc = {
12797272194Srmind 	&null_vnodeop_p, null_vnodeop_entries
12897272194Srmind };
129