Sync usage with man page.
[netbsd-mini2440.git] / sys / fs / tmpfs / tmpfs_fifoops.c
blob87a38c6452159d7a0fc02765435611f7f1244566
1 /* $NetBSD: tmpfs_fifoops.c,v 1.7 2008/04/28 20:24:02 martin Exp $ */
3 /*
4 * Copyright (c) 2005 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal, developed as part of Google's Summer of Code
9 * 2005 program.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
34 * tmpfs vnode interface for named pipes.
37 #include <sys/cdefs.h>
38 __KERNEL_RCSID(0, "$NetBSD: tmpfs_fifoops.c,v 1.7 2008/04/28 20:24:02 martin Exp $");
40 #include <sys/param.h>
41 #include <sys/vnode.h>
43 #include <fs/tmpfs/tmpfs.h>
44 #include <fs/tmpfs/tmpfs_fifoops.h>
46 /* --------------------------------------------------------------------- */
49 * vnode operations vector used for fifos stored in a tmpfs file system.
51 int (**tmpfs_fifoop_p)(void *);
52 const struct vnodeopv_entry_desc tmpfs_fifoop_entries[] = {
53 { &vop_default_desc, vn_default_error },
54 { &vop_lookup_desc, tmpfs_fifo_lookup },
55 { &vop_create_desc, tmpfs_fifo_create },
56 { &vop_mknod_desc, tmpfs_fifo_mknod },
57 { &vop_open_desc, tmpfs_fifo_open },
58 { &vop_close_desc, tmpfs_fifo_close },
59 { &vop_access_desc, tmpfs_fifo_access },
60 { &vop_getattr_desc, tmpfs_fifo_getattr },
61 { &vop_setattr_desc, tmpfs_fifo_setattr },
62 { &vop_read_desc, tmpfs_fifo_read },
63 { &vop_write_desc, tmpfs_fifo_write },
64 { &vop_ioctl_desc, tmpfs_fifo_ioctl },
65 { &vop_fcntl_desc, tmpfs_fifo_fcntl },
66 { &vop_poll_desc, tmpfs_fifo_poll },
67 { &vop_kqfilter_desc, tmpfs_fifo_kqfilter },
68 { &vop_revoke_desc, tmpfs_fifo_revoke },
69 { &vop_mmap_desc, tmpfs_fifo_mmap },
70 { &vop_fsync_desc, tmpfs_fifo_fsync },
71 { &vop_seek_desc, tmpfs_fifo_seek },
72 { &vop_remove_desc, tmpfs_fifo_remove },
73 { &vop_link_desc, tmpfs_fifo_link },
74 { &vop_rename_desc, tmpfs_fifo_rename },
75 { &vop_mkdir_desc, tmpfs_fifo_mkdir },
76 { &vop_rmdir_desc, tmpfs_fifo_rmdir },
77 { &vop_symlink_desc, tmpfs_fifo_symlink },
78 { &vop_readdir_desc, tmpfs_fifo_readdir },
79 { &vop_readlink_desc, tmpfs_fifo_readlink },
80 { &vop_abortop_desc, tmpfs_fifo_abortop },
81 { &vop_inactive_desc, tmpfs_fifo_inactive },
82 { &vop_reclaim_desc, tmpfs_fifo_reclaim },
83 { &vop_lock_desc, tmpfs_fifo_lock },
84 { &vop_unlock_desc, tmpfs_fifo_unlock },
85 { &vop_bmap_desc, tmpfs_fifo_bmap },
86 { &vop_strategy_desc, tmpfs_fifo_strategy },
87 { &vop_print_desc, tmpfs_fifo_print },
88 { &vop_pathconf_desc, tmpfs_fifo_pathconf },
89 { &vop_islocked_desc, tmpfs_fifo_islocked },
90 { &vop_advlock_desc, tmpfs_fifo_advlock },
91 { &vop_bwrite_desc, tmpfs_fifo_bwrite },
92 { &vop_getpages_desc, tmpfs_fifo_getpages },
93 { &vop_putpages_desc, tmpfs_fifo_putpages },
94 { NULL, NULL }
96 const struct vnodeopv_desc tmpfs_fifoop_opv_desc =
97 { &tmpfs_fifoop_p, tmpfs_fifoop_entries };
99 /* --------------------------------------------------------------------- */
102 tmpfs_fifo_close(void *v)
104 struct vnode *vp = ((struct vop_close_args *)v)->a_vp;
106 int error;
108 tmpfs_update(vp, NULL, NULL, NULL, UPDATE_CLOSE);
109 error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), v);
111 return error;
114 /* --------------------------------------------------------------------- */
117 tmpfs_fifo_read(void *v)
119 struct vnode *vp = ((struct vop_read_args *)v)->a_vp;
121 VP_TO_TMPFS_NODE(vp)->tn_status |= TMPFS_NODE_ACCESSED;
122 return VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), v);
125 /* --------------------------------------------------------------------- */
128 tmpfs_fifo_write(void *v)
130 struct vnode *vp = ((struct vop_write_args *)v)->a_vp;
132 VP_TO_TMPFS_NODE(vp)->tn_status |= TMPFS_NODE_MODIFIED;
133 return VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), v);