No empty .Rs/.Re
[netbsd-mini2440.git] / sys / fs / tmpfs / tmpfs_specops.c
blob77e5c8d5d3f29a2a6ea626d0442df996cf50be50
1 /* $NetBSD: tmpfs_specops.c,v 1.8 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 special devices.
37 #include <sys/cdefs.h>
38 __KERNEL_RCSID(0, "$NetBSD: tmpfs_specops.c,v 1.8 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_specops.h>
46 /* --------------------------------------------------------------------- */
49 * vnode operations vector used for special devices stored in a tmpfs
50 * file system.
52 int (**tmpfs_specop_p)(void *);
53 const struct vnodeopv_entry_desc tmpfs_specop_entries[] = {
54 { &vop_default_desc, vn_default_error },
55 { &vop_lookup_desc, tmpfs_spec_lookup },
56 { &vop_create_desc, tmpfs_spec_create },
57 { &vop_mknod_desc, tmpfs_spec_mknod },
58 { &vop_open_desc, tmpfs_spec_open },
59 { &vop_close_desc, tmpfs_spec_close },
60 { &vop_access_desc, tmpfs_spec_access },
61 { &vop_getattr_desc, tmpfs_spec_getattr },
62 { &vop_setattr_desc, tmpfs_spec_setattr },
63 { &vop_read_desc, tmpfs_spec_read },
64 { &vop_write_desc, tmpfs_spec_write },
65 { &vop_ioctl_desc, tmpfs_spec_ioctl },
66 { &vop_fcntl_desc, tmpfs_spec_fcntl },
67 { &vop_poll_desc, tmpfs_spec_poll },
68 { &vop_kqfilter_desc, tmpfs_spec_kqfilter },
69 { &vop_revoke_desc, tmpfs_spec_revoke },
70 { &vop_mmap_desc, tmpfs_spec_mmap },
71 { &vop_fsync_desc, tmpfs_spec_fsync },
72 { &vop_seek_desc, tmpfs_spec_seek },
73 { &vop_remove_desc, tmpfs_spec_remove },
74 { &vop_link_desc, tmpfs_spec_link },
75 { &vop_rename_desc, tmpfs_spec_rename },
76 { &vop_mkdir_desc, tmpfs_spec_mkdir },
77 { &vop_rmdir_desc, tmpfs_spec_rmdir },
78 { &vop_symlink_desc, tmpfs_spec_symlink },
79 { &vop_readdir_desc, tmpfs_spec_readdir },
80 { &vop_readlink_desc, tmpfs_spec_readlink },
81 { &vop_abortop_desc, tmpfs_spec_abortop },
82 { &vop_inactive_desc, tmpfs_spec_inactive },
83 { &vop_reclaim_desc, tmpfs_spec_reclaim },
84 { &vop_lock_desc, tmpfs_spec_lock },
85 { &vop_unlock_desc, tmpfs_spec_unlock },
86 { &vop_bmap_desc, tmpfs_spec_bmap },
87 { &vop_strategy_desc, tmpfs_spec_strategy },
88 { &vop_print_desc, tmpfs_spec_print },
89 { &vop_pathconf_desc, tmpfs_spec_pathconf },
90 { &vop_islocked_desc, tmpfs_spec_islocked },
91 { &vop_advlock_desc, tmpfs_spec_advlock },
92 { &vop_bwrite_desc, tmpfs_spec_bwrite },
93 { &vop_getpages_desc, tmpfs_spec_getpages },
94 { &vop_putpages_desc, tmpfs_spec_putpages },
95 { NULL, NULL }
97 const struct vnodeopv_desc tmpfs_specop_opv_desc =
98 { &tmpfs_specop_p, tmpfs_specop_entries };
100 /* --------------------------------------------------------------------- */
103 tmpfs_spec_close(void *v)
105 struct vnode *vp = ((struct vop_close_args *)v)->a_vp;
107 int error;
109 tmpfs_update(vp, NULL, NULL, NULL, UPDATE_CLOSE);
110 error = VOCALL(spec_vnodeop_p, VOFFSET(vop_close), v);
112 return error;
115 /* --------------------------------------------------------------------- */
118 tmpfs_spec_read(void *v)
120 struct vnode *vp = ((struct vop_read_args *)v)->a_vp;
122 VP_TO_TMPFS_NODE(vp)->tn_status |= TMPFS_NODE_ACCESSED;
123 return VOCALL(spec_vnodeop_p, VOFFSET(vop_read), v);
126 /* --------------------------------------------------------------------- */
129 tmpfs_spec_write(void *v)
131 struct vnode *vp = ((struct vop_write_args *)v)->a_vp;
133 VP_TO_TMPFS_NODE(vp)->tn_status |= TMPFS_NODE_MODIFIED;
134 return VOCALL(spec_vnodeop_p, VOFFSET(vop_write), v);