Remove building with NOCRYPTO option
[minix3.git] / sys / fs / v7fs / v7fs_extern.c
blobc111c87ef6d8d838bb0bfdbeff9f71ffc0322bd7
1 /* $NetBSD: v7fs_extern.c,v 1.4 2014/12/29 15:29:38 hannken Exp $ */
3 /*-
4 * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by UCHIYAMA Yasushi.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: v7fs_extern.c,v 1.4 2014/12/29 15:29:38 hannken Exp $");
35 #if defined _KERNEL_OPT
36 #include "opt_v7fs.h"
37 #endif
38 #include <sys/resource.h>
39 #include <sys/param.h>
40 #include <sys/vnode.h>
41 #include <sys/mount.h>
42 #include <sys/module.h>
44 #include <miscfs/fifofs/fifo.h>
45 #include <miscfs/genfs/genfs.h>
46 #include <miscfs/genfs/genfs_node.h>
48 #include <fs/v7fs/v7fs_extern.h>
50 MODULE(MODULE_CLASS_VFS, v7fs, NULL);
52 /* External interfaces */
54 int (**v7fs_vnodeop_p)(void *); /* filled by getnewvnode (vnode.h) */
56 const struct vnodeopv_entry_desc v7fs_vnodeop_entries[] = {
57 { &vop_default_desc, vn_default_error },
58 { &vop_lookup_desc, v7fs_lookup }, /* lookup */
59 { &vop_create_desc, v7fs_create }, /* create */
60 { &vop_mknod_desc, v7fs_mknod }, /* mknod */
61 { &vop_open_desc, v7fs_open }, /* open */
62 { &vop_close_desc, v7fs_close }, /* close */
63 { &vop_access_desc, v7fs_access }, /* access */
64 { &vop_getattr_desc, v7fs_getattr }, /* getattr */
65 { &vop_setattr_desc, v7fs_setattr }, /* setattr */
66 { &vop_read_desc, v7fs_read }, /* read */
67 { &vop_write_desc, v7fs_write }, /* write */
68 { &vop_fallocate_desc, genfs_eopnotsupp }, /* fallocate */
69 { &vop_fdiscard_desc, genfs_eopnotsupp }, /* fdiscard */
70 { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
71 { &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */
72 { &vop_poll_desc, genfs_poll }, /* poll */
73 { &vop_kqfilter_desc, genfs_kqfilter }, /* kqfilter */
74 { &vop_revoke_desc, genfs_revoke }, /* revoke */
75 { &vop_mmap_desc, genfs_mmap }, /* mmap */
76 { &vop_fsync_desc, v7fs_fsync }, /* fsync */
77 { &vop_seek_desc, genfs_seek }, /* seek */
78 { &vop_remove_desc, v7fs_remove }, /* remove */
79 { &vop_link_desc, v7fs_link }, /* link */
80 { &vop_rename_desc, v7fs_rename }, /* rename */
81 { &vop_mkdir_desc, v7fs_mkdir }, /* mkdir */
82 { &vop_rmdir_desc, v7fs_rmdir }, /* rmdir */
83 { &vop_symlink_desc, v7fs_symlink }, /* symlink */
84 { &vop_readdir_desc, v7fs_readdir }, /* readdir */
85 { &vop_readlink_desc, v7fs_readlink }, /* readlink */
86 { &vop_abortop_desc, genfs_abortop }, /* abortop */
87 { &vop_inactive_desc, v7fs_inactive }, /* inactive */
88 { &vop_reclaim_desc, v7fs_reclaim }, /* reclaim */
89 { &vop_lock_desc, genfs_lock }, /* lock */
90 { &vop_unlock_desc, genfs_unlock }, /* unlock */
91 { &vop_bmap_desc, v7fs_bmap }, /* bmap */
92 { &vop_strategy_desc, v7fs_strategy }, /* strategy */
93 { &vop_print_desc, v7fs_print }, /* print */
94 { &vop_islocked_desc, genfs_islocked }, /* islocked */
95 { &vop_pathconf_desc, v7fs_pathconf }, /* pathconf */
96 { &vop_advlock_desc, v7fs_advlock }, /* advlock */
97 { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
98 { &vop_getpages_desc, genfs_getpages }, /* getpages */
99 { &vop_putpages_desc, genfs_putpages }, /* putpages */
100 { NULL, NULL }
104 int (**v7fs_specop_p)(void *);
105 const struct vnodeopv_entry_desc v7fs_specop_entries[] = {
106 { &vop_default_desc, vn_default_error },
107 { &vop_lookup_desc, spec_lookup }, /* lookup */
108 { &vop_create_desc, spec_create }, /* create xxx*/
109 { &vop_mknod_desc, spec_mknod }, /* mknod xxx*/
110 { &vop_open_desc, spec_open }, /* open */
111 { &vop_close_desc, spec_close }, /* close */
112 { &vop_access_desc, v7fs_access }, /* access */
113 { &vop_getattr_desc, v7fs_getattr }, /* getattr */
114 { &vop_setattr_desc, v7fs_setattr }, /* setattr */
115 { &vop_read_desc, spec_read }, /* read */
116 { &vop_write_desc, spec_write }, /* write */
117 { &vop_fallocate_desc, spec_fallocate }, /* fallocate */
118 { &vop_fdiscard_desc, spec_fdiscard }, /* fdiscard */
119 { &vop_ioctl_desc, spec_ioctl }, /* ioctl */
120 { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
121 { &vop_poll_desc, spec_poll }, /* poll */
122 { &vop_kqfilter_desc, spec_kqfilter }, /* kqfilter */
123 { &vop_revoke_desc, spec_revoke }, /* revoke */
124 { &vop_mmap_desc, spec_mmap }, /* mmap */
125 { &vop_fsync_desc, spec_fsync }, /* fsync */
126 { &vop_seek_desc, spec_seek }, /* seek */
127 { &vop_remove_desc, spec_remove }, /* remove */
128 { &vop_link_desc, spec_link }, /* link */
129 { &vop_rename_desc, spec_rename }, /* rename */
130 { &vop_mkdir_desc, spec_mkdir }, /* mkdir */
131 { &vop_rmdir_desc, spec_rmdir }, /* rmdir */
132 { &vop_symlink_desc, spec_symlink }, /* symlink */
133 { &vop_readdir_desc, spec_readdir }, /* readdir */
134 { &vop_readlink_desc, spec_readlink }, /* readlink */
135 { &vop_abortop_desc, spec_abortop }, /* abortop */
136 { &vop_inactive_desc, v7fs_inactive }, /* inactive */
137 { &vop_reclaim_desc, v7fs_reclaim }, /* reclaim */
138 { &vop_lock_desc, genfs_lock }, /* lock */
139 { &vop_unlock_desc, genfs_unlock }, /* unlock */
140 { &vop_bmap_desc, spec_bmap }, /* bmap */
141 { &vop_strategy_desc, spec_strategy }, /* strategy */
142 { &vop_print_desc, spec_print }, /* print */
143 { &vop_islocked_desc, genfs_islocked }, /* islocked */
144 { &vop_pathconf_desc, spec_pathconf }, /* pathconf */
145 { &vop_advlock_desc, spec_advlock }, /* advlock */
146 { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
147 { &vop_getpages_desc, spec_getpages }, /* getpages */
148 { &vop_putpages_desc, spec_putpages }, /* putpages */
149 { NULL, NULL }
152 int (**v7fs_fifoop_p)(void *);
153 const struct vnodeopv_entry_desc v7fs_fifoop_entries[] = {
154 { &vop_default_desc, vn_default_error },
155 { &vop_lookup_desc, vn_fifo_bypass }, /* lookup */
156 { &vop_create_desc, vn_fifo_bypass }, /* create */
157 { &vop_mknod_desc, vn_fifo_bypass }, /* mknod */
158 { &vop_open_desc, vn_fifo_bypass }, /* open */
159 { &vop_close_desc, vn_fifo_bypass }, /* close */
160 { &vop_access_desc, v7fs_access }, /* access */
161 { &vop_getattr_desc, v7fs_getattr }, /* getattr */
162 { &vop_setattr_desc, v7fs_setattr }, /* setattr */
163 { &vop_read_desc, vn_fifo_bypass }, /* read */
164 { &vop_write_desc, vn_fifo_bypass }, /* write */
165 { &vop_fallocate_desc, vn_fifo_bypass }, /* fallocate */
166 { &vop_fdiscard_desc, vn_fifo_bypass }, /* fdiscard */
167 { &vop_ioctl_desc, vn_fifo_bypass }, /* ioctl */
168 { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
169 { &vop_poll_desc, vn_fifo_bypass }, /* poll */
170 { &vop_kqfilter_desc, vn_fifo_bypass }, /* kqfilter */
171 { &vop_revoke_desc, vn_fifo_bypass }, /* revoke */
172 { &vop_mmap_desc, vn_fifo_bypass }, /* mmap */
173 { &vop_fsync_desc, vn_fifo_bypass }, /* fsync */
174 { &vop_seek_desc, vn_fifo_bypass }, /* seek */
175 { &vop_remove_desc, vn_fifo_bypass }, /* remove */
176 { &vop_link_desc, vn_fifo_bypass }, /* link */
177 { &vop_rename_desc, vn_fifo_bypass }, /* rename */
178 { &vop_mkdir_desc, vn_fifo_bypass }, /* mkdir */
179 { &vop_rmdir_desc, vn_fifo_bypass }, /* rmdir */
180 { &vop_symlink_desc, vn_fifo_bypass }, /* symlink */
181 { &vop_readdir_desc, vn_fifo_bypass }, /* readdir */
182 { &vop_readlink_desc, vn_fifo_bypass }, /* readlink */
183 { &vop_abortop_desc, vn_fifo_bypass }, /* abortop */
184 { &vop_inactive_desc, v7fs_inactive }, /* inactive */
185 { &vop_reclaim_desc, v7fs_reclaim }, /* reclaim */
186 { &vop_lock_desc, vn_fifo_bypass }, /* lock */
187 { &vop_unlock_desc, vn_fifo_bypass }, /* unlock */
188 { &vop_bmap_desc, vn_fifo_bypass }, /* bmap */
189 { &vop_strategy_desc, vn_fifo_bypass }, /* strategy */
190 { &vop_print_desc, vn_fifo_bypass }, /* print */
191 { &vop_islocked_desc, vn_fifo_bypass }, /* islocked */
192 { &vop_pathconf_desc, vn_fifo_bypass }, /* pathconf */
193 { &vop_advlock_desc, vn_fifo_bypass }, /* advlock */
194 { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
195 { &vop_putpages_desc, vn_fifo_bypass }, /* putpages */
196 { NULL, NULL }
199 const struct vnodeopv_desc v7fs_fifoop_opv_desc = {
200 &v7fs_fifoop_p,
201 v7fs_fifoop_entries
204 const struct vnodeopv_desc v7fs_vnodeop_opv_desc = {
205 &v7fs_vnodeop_p,
206 v7fs_vnodeop_entries
209 const struct vnodeopv_desc v7fs_specop_opv_desc = {
210 &v7fs_specop_p,
211 v7fs_specop_entries
214 const struct vnodeopv_desc *v7fs_vnodeopv_descs[] = {
215 &v7fs_vnodeop_opv_desc,
216 &v7fs_specop_opv_desc,
217 &v7fs_fifoop_opv_desc,
218 NULL,
221 const struct genfs_ops v7fs_genfsops = {
222 .gop_size = genfs_size,
223 .gop_alloc = v7fs_gop_alloc,
224 .gop_write = genfs_gop_write,
227 struct vfsops v7fs_vfsops = {
228 .vfs_name = MOUNT_V7FS,
229 .vfs_min_mount_data = sizeof(struct v7fs_args),
230 .vfs_mount = v7fs_mount,
231 .vfs_start = v7fs_start,
232 .vfs_unmount = v7fs_unmount,
233 .vfs_root = v7fs_root,
234 .vfs_quotactl = (void *)eopnotsupp,
235 .vfs_statvfs = v7fs_statvfs,
236 .vfs_sync = v7fs_sync,
237 .vfs_vget = v7fs_vget,
238 .vfs_loadvnode = v7fs_loadvnode,
239 .vfs_fhtovp = v7fs_fhtovp,
240 .vfs_vptofh = v7fs_vptofh,
241 .vfs_init = v7fs_init,
242 .vfs_reinit = v7fs_reinit,
243 .vfs_done = v7fs_done,
244 .vfs_mountroot = v7fs_mountroot,
245 .vfs_snapshot = (void *)eopnotsupp,
246 .vfs_extattrctl = vfs_stdextattrctl,
247 .vfs_suspendctl = (void *)eopnotsupp,
248 .vfs_renamelock_enter = genfs_renamelock_enter,
249 .vfs_renamelock_exit = genfs_renamelock_exit,
250 .vfs_fsync = (void *)eopnotsupp,
251 .vfs_opv_descs = v7fs_vnodeopv_descs
254 static int
255 v7fs_modcmd(modcmd_t cmd, void *arg)
258 switch (cmd) {
259 case MODULE_CMD_INIT:
260 return vfs_attach(&v7fs_vfsops);
261 case MODULE_CMD_FINI:
262 return vfs_detach(&v7fs_vfsops);
263 default:
264 return ENOTTY;