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