xref: /netbsd-src/sys/miscfs/fifofs/fifo.h (revision aef5eb5f59cdfe8314f1b5f78ac04eb144e44010)
1 /*	$NetBSD: fifo.h,v 1.27 2021/07/18 23:56:13 dholland Exp $	*/
2 
3 /*
4  * Copyright (c) 1991, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)fifo.h	8.6 (Berkeley) 5/21/95
32  */
33 
34 extern int (**fifo_vnodeop_p)(void *);
35 
36 /*
37  * This macro provides an initializer list for the fs-independent part
38  * of a filesystem's fifo vnode ops descriptor table. We still need
39  * such a table in every filesystem, but we can at least avoid the
40  * cutpaste.
41  *
42  * This contains these ops:
43  *    parsepath lookup
44  *    create whiteout mknod open fallocate fdiscard ioctl poll kqfilter
45  *    revoke mmap seek remove link rename mkdir rmdir symlink readdir
46  *    readlink abortop bmap pathconf advlock getpages putpages
47  *
48  * The filesystem should provide these ops that need to be its own:
49  *    access and accessx
50  *    getattr
51  *    setattr
52  *    fcntl
53  *    inactive
54  *    reclaim
55  *    lock
56  *    unlock
57  *    strategy
58  *    print (should probably also call fifo_print)
59  *    islocked
60  *    bwrite (normally vn_bwrite)
61  *    openextattr
62  *    closeextattr
63  *    getextattr
64  *    setextattr
65  *    listextattr
66  *    deleteextattr
67  *    getacl
68  *    setacl
69  *    aclcheck
70  *
71  * The filesystem should also provide these ops that some filesystems
72  * do their own things with:
73  *    close
74  *    read
75  *    write
76  *    fsync
77  * In most cases "their own things" means adjust timestamps and call
78  * fifo_foo (currently via vn_fifo_bypass). For fsync it varies.
79  *
80  * Note that because the op descriptor tables are unordered it does not
81  * matter where in the table this macro goes (except I think default
82  * still needs to be first...)
83  *
84  * XXX currently all the ops are vn_fifo_bypass, which does an
85  * indirect call via the fifofs ops table (externed above), which
86  * someone decided was preferable to exposing the function
87  * definitions. This includes (for now at least) the ones that are
88  * sent to genfs by that table. This should probably be changed, but
89  * not just yet.
90  */
91 #define GENFS_FIFOOP_ENTRIES \
92 	{ &vop_parsepath_desc, genfs_badop },		/* parsepath */	\
93 	{ &vop_lookup_desc, vn_fifo_bypass },		/* lookup */	\
94 	{ &vop_create_desc, vn_fifo_bypass },		/* create */	\
95 	{ &vop_whiteout_desc, vn_fifo_bypass },		/* whiteout */	\
96 	{ &vop_mknod_desc, vn_fifo_bypass },		/* mknod */	\
97 	{ &vop_open_desc, vn_fifo_bypass },		/* open */	\
98 	{ &vop_fallocate_desc, vn_fifo_bypass },	/* fallocate */	\
99 	{ &vop_fdiscard_desc, vn_fifo_bypass },		/* fdiscard */	\
100 	{ &vop_ioctl_desc, vn_fifo_bypass },		/* ioctl */	\
101 	{ &vop_poll_desc, vn_fifo_bypass },		/* poll */	\
102 	{ &vop_kqfilter_desc, vn_fifo_bypass },		/* kqfilter */	\
103 	{ &vop_revoke_desc, vn_fifo_bypass },		/* revoke */	\
104 	{ &vop_mmap_desc, vn_fifo_bypass },		/* mmap */	\
105 	{ &vop_seek_desc, vn_fifo_bypass },		/* seek */	\
106 	{ &vop_remove_desc, vn_fifo_bypass },		/* remove */	\
107 	{ &vop_link_desc, vn_fifo_bypass },		/* link */	\
108 	{ &vop_rename_desc, vn_fifo_bypass },		/* rename */	\
109 	{ &vop_mkdir_desc, vn_fifo_bypass },		/* mkdir */	\
110 	{ &vop_rmdir_desc, vn_fifo_bypass },		/* rmdir */	\
111 	{ &vop_symlink_desc, vn_fifo_bypass },		/* symlink */	\
112 	{ &vop_readdir_desc, vn_fifo_bypass },		/* readdir */	\
113 	{ &vop_readlink_desc, vn_fifo_bypass },		/* readlink */	\
114 	{ &vop_abortop_desc, vn_fifo_bypass },		/* abortop */	\
115 	{ &vop_bmap_desc, vn_fifo_bypass },		/* bmap */	\
116 	{ &vop_pathconf_desc, vn_fifo_bypass },		/* pathconf */	\
117 	{ &vop_advlock_desc, vn_fifo_bypass },		/* advlock */	\
118 	{ &vop_getpages_desc, genfs_badop },	 	/* getpages */	\
119 	{ &vop_putpages_desc, vn_fifo_bypass }	 	/* putpages */
120