Home | History | Annotate | Line # | Download | only in fifofs
      1 /*	$NetBSD: fifo.h,v 1.28 2022/10/26 23:40:20 riastradh 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 #ifndef _MISCFS_FIFOFS_FIFO_H_
     35 #define _MISCFS_FIFOFS_FIFO_H_
     36 
     37 #include <sys/vnode.h>
     38 
     39 #include <miscfs/genfs/genfs.h>
     40 
     41 extern const struct vnodeopv_desc fifo_vnodeop_opv_desc;
     42 
     43 extern int (**fifo_vnodeop_p)(void *);
     44 
     45 /*
     46  * This macro provides an initializer list for the fs-independent part
     47  * of a filesystem's fifo vnode ops descriptor table. We still need
     48  * such a table in every filesystem, but we can at least avoid the
     49  * cutpaste.
     50  *
     51  * This contains these ops:
     52  *    parsepath lookup
     53  *    create whiteout mknod open fallocate fdiscard ioctl poll kqfilter
     54  *    revoke mmap seek remove link rename mkdir rmdir symlink readdir
     55  *    readlink abortop bmap pathconf advlock getpages putpages
     56  *
     57  * The filesystem should provide these ops that need to be its own:
     58  *    access and accessx
     59  *    getattr
     60  *    setattr
     61  *    fcntl
     62  *    inactive
     63  *    reclaim
     64  *    lock
     65  *    unlock
     66  *    strategy
     67  *    print (should probably also call fifo_print)
     68  *    islocked
     69  *    bwrite (normally vn_bwrite)
     70  *    openextattr
     71  *    closeextattr
     72  *    getextattr
     73  *    setextattr
     74  *    listextattr
     75  *    deleteextattr
     76  *    getacl
     77  *    setacl
     78  *    aclcheck
     79  *
     80  * The filesystem should also provide these ops that some filesystems
     81  * do their own things with:
     82  *    close
     83  *    read
     84  *    write
     85  *    fsync
     86  * In most cases "their own things" means adjust timestamps and call
     87  * fifo_foo (currently via vn_fifo_bypass). For fsync it varies.
     88  *
     89  * Note that because the op descriptor tables are unordered it does not
     90  * matter where in the table this macro goes (except I think default
     91  * still needs to be first...)
     92  *
     93  * XXX currently all the ops are vn_fifo_bypass, which does an
     94  * indirect call via the fifofs ops table (externed above), which
     95  * someone decided was preferable to exposing the function
     96  * definitions. This includes (for now at least) the ones that are
     97  * sent to genfs by that table. This should probably be changed, but
     98  * not just yet.
     99  */
    100 #define GENFS_FIFOOP_ENTRIES \
    101 	{ &vop_parsepath_desc, genfs_badop },		/* parsepath */	\
    102 	{ &vop_lookup_desc, vn_fifo_bypass },		/* lookup */	\
    103 	{ &vop_create_desc, vn_fifo_bypass },		/* create */	\
    104 	{ &vop_whiteout_desc, vn_fifo_bypass },		/* whiteout */	\
    105 	{ &vop_mknod_desc, vn_fifo_bypass },		/* mknod */	\
    106 	{ &vop_open_desc, vn_fifo_bypass },		/* open */	\
    107 	{ &vop_fallocate_desc, vn_fifo_bypass },	/* fallocate */	\
    108 	{ &vop_fdiscard_desc, vn_fifo_bypass },		/* fdiscard */	\
    109 	{ &vop_ioctl_desc, vn_fifo_bypass },		/* ioctl */	\
    110 	{ &vop_poll_desc, vn_fifo_bypass },		/* poll */	\
    111 	{ &vop_kqfilter_desc, vn_fifo_bypass },		/* kqfilter */	\
    112 	{ &vop_revoke_desc, vn_fifo_bypass },		/* revoke */	\
    113 	{ &vop_mmap_desc, vn_fifo_bypass },		/* mmap */	\
    114 	{ &vop_seek_desc, vn_fifo_bypass },		/* seek */	\
    115 	{ &vop_remove_desc, vn_fifo_bypass },		/* remove */	\
    116 	{ &vop_link_desc, vn_fifo_bypass },		/* link */	\
    117 	{ &vop_rename_desc, vn_fifo_bypass },		/* rename */	\
    118 	{ &vop_mkdir_desc, vn_fifo_bypass },		/* mkdir */	\
    119 	{ &vop_rmdir_desc, vn_fifo_bypass },		/* rmdir */	\
    120 	{ &vop_symlink_desc, vn_fifo_bypass },		/* symlink */	\
    121 	{ &vop_readdir_desc, vn_fifo_bypass },		/* readdir */	\
    122 	{ &vop_readlink_desc, vn_fifo_bypass },		/* readlink */	\
    123 	{ &vop_abortop_desc, vn_fifo_bypass },		/* abortop */	\
    124 	{ &vop_bmap_desc, vn_fifo_bypass },		/* bmap */	\
    125 	{ &vop_pathconf_desc, vn_fifo_bypass },		/* pathconf */	\
    126 	{ &vop_advlock_desc, vn_fifo_bypass },		/* advlock */	\
    127 	{ &vop_getpages_desc, genfs_badop },	 	/* getpages */	\
    128 	{ &vop_putpages_desc, vn_fifo_bypass }	 	/* putpages */
    129 
    130 #endif	/* _MISCFS_FIFOFS_FIFO_H_ */
    131