sysvbfs_vfsops.c revision 1.37 1 1.37 njoly /* $NetBSD: sysvbfs_vfsops.c,v 1.37 2011/07/13 19:51:29 njoly Exp $ */
2 1.1 tsutsui
3 1.1 tsutsui /*-
4 1.1 tsutsui * Copyright (c) 2004 The NetBSD Foundation, Inc.
5 1.1 tsutsui * All rights reserved.
6 1.1 tsutsui *
7 1.1 tsutsui * This code is derived from software contributed to The NetBSD Foundation
8 1.1 tsutsui * by UCHIYAMA Yasushi.
9 1.1 tsutsui *
10 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
11 1.1 tsutsui * modification, are permitted provided that the following conditions
12 1.1 tsutsui * are met:
13 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
14 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
15 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
17 1.1 tsutsui * documentation and/or other materials provided with the distribution.
18 1.1 tsutsui *
19 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 tsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 tsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 tsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 tsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 tsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 tsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 tsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 tsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 tsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 tsutsui * POSSIBILITY OF SUCH DAMAGE.
30 1.1 tsutsui */
31 1.1 tsutsui
32 1.1 tsutsui #include <sys/cdefs.h>
33 1.37 njoly __KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.37 2011/07/13 19:51:29 njoly Exp $");
34 1.1 tsutsui
35 1.1 tsutsui #include <sys/types.h>
36 1.1 tsutsui #include <sys/param.h>
37 1.1 tsutsui #include <sys/systm.h>
38 1.1 tsutsui #include <sys/pool.h>
39 1.1 tsutsui #include <sys/time.h>
40 1.1 tsutsui #include <sys/ucred.h>
41 1.1 tsutsui #include <sys/mount.h>
42 1.1 tsutsui #include <sys/disklabel.h>
43 1.1 tsutsui #include <sys/fcntl.h>
44 1.1 tsutsui #include <sys/malloc.h>
45 1.4 yamt #include <sys/kauth.h>
46 1.14 ad #include <sys/proc.h>
47 1.1 tsutsui
48 1.1 tsutsui /* v-node */
49 1.1 tsutsui #include <sys/namei.h>
50 1.1 tsutsui #include <sys/vnode.h>
51 1.1 tsutsui /* devsw */
52 1.1 tsutsui #include <sys/conf.h>
53 1.1 tsutsui
54 1.1 tsutsui #include <fs/sysvbfs/sysvbfs.h> /* external interface */
55 1.1 tsutsui #include <fs/sysvbfs/bfs.h> /* internal interface */
56 1.1 tsutsui
57 1.1 tsutsui #ifdef SYSVBFS_VNOPS_DEBUG
58 1.1 tsutsui #define DPRINTF(fmt, args...) printf(fmt, ##args)
59 1.1 tsutsui #else
60 1.1 tsutsui #define DPRINTF(arg...) ((void)0)
61 1.1 tsutsui #endif
62 1.1 tsutsui
63 1.11 pooka MALLOC_JUSTDEFINE(M_SYSVBFS_VFS, "sysvbfs vfs", "sysvbfs vfs structures");
64 1.1 tsutsui
65 1.11 pooka struct pool sysvbfs_node_pool;
66 1.1 tsutsui
67 1.1 tsutsui int sysvbfs_mountfs(struct vnode *, struct mount *, struct lwp *);
68 1.1 tsutsui
69 1.1 tsutsui int
70 1.18 pooka sysvbfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
71 1.1 tsutsui {
72 1.18 pooka struct lwp *l = curlwp;
73 1.12 dsl struct sysvbfs_args *args = data;
74 1.1 tsutsui struct sysvbfs_mount *bmp = NULL;
75 1.1 tsutsui struct vnode *devvp = NULL;
76 1.1 tsutsui int error;
77 1.8 thorpej bool update;
78 1.1 tsutsui
79 1.20 perry DPRINTF("%s: mnt_flag=%x\n", __func__, mp->mnt_flag);
80 1.1 tsutsui
81 1.12 dsl if (*data_len < sizeof *args)
82 1.12 dsl return EINVAL;
83 1.12 dsl
84 1.1 tsutsui if (mp->mnt_flag & MNT_GETARGS) {
85 1.1 tsutsui if ((bmp = (void *)mp->mnt_data) == NULL)
86 1.1 tsutsui return EIO;
87 1.12 dsl args->fspec = NULL;
88 1.12 dsl *data_len = sizeof *args;
89 1.12 dsl return 0;
90 1.1 tsutsui }
91 1.1 tsutsui
92 1.1 tsutsui
93 1.20 perry DPRINTF("%s: args->fspec=%s\n", __func__, args->fspec);
94 1.1 tsutsui update = mp->mnt_flag & MNT_UPDATE;
95 1.12 dsl if (args->fspec == NULL) {
96 1.1 tsutsui /* nothing to do. */
97 1.1 tsutsui return EINVAL;
98 1.1 tsutsui }
99 1.1 tsutsui
100 1.12 dsl if (args->fspec != NULL) {
101 1.1 tsutsui /* Look up the name and verify that it's sane. */
102 1.30 dholland error = namei_simple_user(args->fspec,
103 1.30 dholland NSM_FOLLOW_NOEMULROOT, &devvp);
104 1.30 dholland if (error != 0)
105 1.1 tsutsui return (error);
106 1.1 tsutsui
107 1.1 tsutsui if (!update) {
108 1.1 tsutsui /*
109 1.1 tsutsui * Be sure this is a valid block device
110 1.1 tsutsui */
111 1.1 tsutsui if (devvp->v_type != VBLK)
112 1.1 tsutsui error = ENOTBLK;
113 1.22 ad else if (bdevsw_lookup(devvp->v_rdev) == NULL)
114 1.1 tsutsui error = ENXIO;
115 1.1 tsutsui } else {
116 1.1 tsutsui /*
117 1.1 tsutsui * Be sure we're still naming the same device
118 1.1 tsutsui * used for our initial mount
119 1.1 tsutsui */
120 1.1 tsutsui if (devvp != bmp->devvp)
121 1.1 tsutsui error = EINVAL;
122 1.1 tsutsui }
123 1.1 tsutsui }
124 1.1 tsutsui
125 1.1 tsutsui /*
126 1.1 tsutsui * If mount by non-root, then verify that user has necessary
127 1.1 tsutsui * permissions on the device.
128 1.29 elad *
129 1.29 elad * Permission to update a mount is checked higher, so here we presume
130 1.29 elad * updating the mount is okay (for example, as far as securelevel goes)
131 1.29 elad * which leaves us with the normal check.
132 1.1 tsutsui */
133 1.29 elad if (error == 0) {
134 1.1 tsutsui int accessmode = VREAD;
135 1.1 tsutsui if (update ?
136 1.1 tsutsui (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
137 1.1 tsutsui (mp->mnt_flag & MNT_RDONLY) == 0)
138 1.1 tsutsui accessmode |= VWRITE;
139 1.29 elad
140 1.29 elad error = genfs_can_mount(devvp, accessmode, l->l_cred);
141 1.1 tsutsui }
142 1.1 tsutsui
143 1.1 tsutsui if (error) {
144 1.1 tsutsui vrele(devvp);
145 1.1 tsutsui return error;
146 1.1 tsutsui }
147 1.1 tsutsui
148 1.1 tsutsui if (!update) {
149 1.1 tsutsui if ((error = sysvbfs_mountfs(devvp, mp, l)) != 0) {
150 1.1 tsutsui vrele(devvp);
151 1.1 tsutsui return error;
152 1.1 tsutsui }
153 1.1 tsutsui } else if (mp->mnt_flag & MNT_RDONLY) {
154 1.1 tsutsui /* XXX: r/w -> read only */
155 1.1 tsutsui }
156 1.1 tsutsui
157 1.12 dsl return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
158 1.13 pooka mp->mnt_op->vfs_name, mp, l);
159 1.1 tsutsui }
160 1.1 tsutsui
161 1.1 tsutsui int
162 1.1 tsutsui sysvbfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
163 1.1 tsutsui {
164 1.6 ad kauth_cred_t cred = l->l_cred;
165 1.1 tsutsui struct sysvbfs_mount *bmp;
166 1.1 tsutsui struct partinfo dpart;
167 1.26 pooka int error, oflags;
168 1.31 pooka bool devopen = false;
169 1.1 tsutsui
170 1.1 tsutsui vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
171 1.1 tsutsui error = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0);
172 1.1 tsutsui if (error)
173 1.31 pooka goto out;
174 1.1 tsutsui
175 1.1 tsutsui /* Open block device */
176 1.26 pooka oflags = FREAD;
177 1.26 pooka if ((mp->mnt_flag & MNT_RDONLY) == 0)
178 1.26 pooka oflags |= FWRITE;
179 1.26 pooka if ((error = VOP_OPEN(devvp, oflags, NOCRED)) != 0)
180 1.31 pooka goto out;
181 1.31 pooka devopen = true;
182 1.1 tsutsui
183 1.2 wiz /* Get partition information */
184 1.27 pooka if ((error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred)) != 0) {
185 1.31 pooka goto out;
186 1.27 pooka }
187 1.1 tsutsui
188 1.1 tsutsui bmp = malloc(sizeof(struct sysvbfs_mount), M_SYSVBFS_VFS, M_WAITOK);
189 1.27 pooka if (bmp == NULL) {
190 1.31 pooka error = ENOMEM;
191 1.31 pooka goto out;
192 1.27 pooka }
193 1.1 tsutsui bmp->devvp = devvp;
194 1.1 tsutsui bmp->mountp = mp;
195 1.1 tsutsui if ((error = sysvbfs_bfs_init(&bmp->bfs, devvp)) != 0) {
196 1.1 tsutsui free(bmp, M_SYSVBFS_VFS);
197 1.31 pooka goto out;
198 1.1 tsutsui }
199 1.1 tsutsui LIST_INIT(&bmp->bnode_head);
200 1.1 tsutsui
201 1.1 tsutsui mp->mnt_data = bmp;
202 1.1 tsutsui mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)devvp->v_rdev;
203 1.1 tsutsui mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_SYSVBFS);
204 1.1 tsutsui mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
205 1.33 njoly mp->mnt_stat.f_namemax = BFS_FILENAME_MAXLEN;
206 1.1 tsutsui mp->mnt_flag |= MNT_LOCAL;
207 1.10 tsutsui mp->mnt_dev_bshift = BFS_BSHIFT;
208 1.1 tsutsui mp->mnt_fs_bshift = BFS_BSHIFT;
209 1.1 tsutsui
210 1.37 njoly DPRINTF("%s: fstype=%d dtype=%d bsize=%d\n", __func__,
211 1.37 njoly dpart.part->p_fstype, dpart.disklab->d_type,
212 1.37 njoly dpart.disklab->d_secsize);
213 1.1 tsutsui
214 1.31 pooka out:
215 1.31 pooka if (devopen && error)
216 1.31 pooka VOP_CLOSE(devvp, oflags, NOCRED);
217 1.32 hannken VOP_UNLOCK(devvp);
218 1.31 pooka return error;
219 1.1 tsutsui }
220 1.1 tsutsui
221 1.1 tsutsui int
222 1.18 pooka sysvbfs_start(struct mount *mp, int flags)
223 1.1 tsutsui {
224 1.1 tsutsui
225 1.20 perry DPRINTF("%s:\n", __func__);
226 1.1 tsutsui /* Nothing to do. */
227 1.1 tsutsui return 0;
228 1.1 tsutsui }
229 1.1 tsutsui
230 1.1 tsutsui int
231 1.18 pooka sysvbfs_unmount(struct mount *mp, int mntflags)
232 1.1 tsutsui {
233 1.1 tsutsui struct sysvbfs_mount *bmp = (void *)mp->mnt_data;
234 1.1 tsutsui int error;
235 1.1 tsutsui
236 1.20 perry DPRINTF("%s: %p\n", __func__, bmp);
237 1.1 tsutsui
238 1.1 tsutsui if ((error = vflush(mp, NULLVP,
239 1.1 tsutsui mntflags & MNT_FORCE ? FORCECLOSE : 0)) != 0)
240 1.1 tsutsui return error;
241 1.1 tsutsui
242 1.1 tsutsui vn_lock(bmp->devvp, LK_EXCLUSIVE | LK_RETRY);
243 1.18 pooka error = VOP_CLOSE(bmp->devvp, FREAD, NOCRED);
244 1.1 tsutsui vput(bmp->devvp);
245 1.1 tsutsui
246 1.1 tsutsui sysvbfs_bfs_fini(bmp->bfs);
247 1.1 tsutsui
248 1.1 tsutsui free(bmp, M_SYSVBFS_VFS);
249 1.1 tsutsui mp->mnt_data = NULL;
250 1.1 tsutsui mp->mnt_flag &= ~MNT_LOCAL;
251 1.1 tsutsui
252 1.1 tsutsui return 0;
253 1.1 tsutsui }
254 1.1 tsutsui
255 1.1 tsutsui int
256 1.1 tsutsui sysvbfs_root(struct mount *mp, struct vnode **vpp)
257 1.1 tsutsui {
258 1.1 tsutsui struct vnode *vp;
259 1.1 tsutsui int error;
260 1.1 tsutsui
261 1.20 perry DPRINTF("%s:\n", __func__);
262 1.1 tsutsui if ((error = VFS_VGET(mp, BFS_ROOT_INODE, &vp)) != 0)
263 1.1 tsutsui return error;
264 1.1 tsutsui *vpp = vp;
265 1.1 tsutsui
266 1.1 tsutsui return 0;
267 1.1 tsutsui }
268 1.1 tsutsui
269 1.1 tsutsui int
270 1.18 pooka sysvbfs_statvfs(struct mount *mp, struct statvfs *f)
271 1.1 tsutsui {
272 1.1 tsutsui struct sysvbfs_mount *bmp = mp->mnt_data;
273 1.1 tsutsui struct bfs *bfs = bmp->bfs;
274 1.1 tsutsui int free_block;
275 1.1 tsutsui size_t data_block;
276 1.1 tsutsui
277 1.1 tsutsui data_block = (bfs->data_end - bfs->data_start) >> BFS_BSHIFT;
278 1.1 tsutsui if (bfs_inode_alloc(bfs, 0, 0, &free_block) != 0)
279 1.1 tsutsui free_block = 0;
280 1.1 tsutsui else
281 1.1 tsutsui free_block = (bfs->data_end >> BFS_BSHIFT) - free_block;
282 1.1 tsutsui
283 1.20 perry DPRINTF("%s: %d %d %d\n", __func__, bfs->data_start,
284 1.1 tsutsui bfs->data_end, free_block);
285 1.1 tsutsui
286 1.1 tsutsui f->f_bsize = BFS_BSIZE;
287 1.1 tsutsui f->f_frsize = BFS_BSIZE;
288 1.1 tsutsui f->f_iosize = BFS_BSIZE;
289 1.1 tsutsui f->f_blocks = data_block;
290 1.1 tsutsui f->f_bfree = free_block;
291 1.1 tsutsui f->f_bavail = f->f_bfree;
292 1.1 tsutsui f->f_bresvd = 0;
293 1.1 tsutsui f->f_files = bfs->n_inode;
294 1.1 tsutsui f->f_ffree = bfs->max_inode - f->f_files;
295 1.1 tsutsui f->f_favail = f->f_ffree;
296 1.1 tsutsui f->f_fresvd = 0;
297 1.1 tsutsui copy_statvfs_info(f, mp);
298 1.1 tsutsui
299 1.1 tsutsui return 0;
300 1.1 tsutsui }
301 1.1 tsutsui
302 1.1 tsutsui int
303 1.18 pooka sysvbfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
304 1.1 tsutsui {
305 1.1 tsutsui struct sysvbfs_mount *bmp = mp->mnt_data;
306 1.1 tsutsui struct sysvbfs_node *bnode;
307 1.1 tsutsui struct vnode *v;
308 1.1 tsutsui int err, error;
309 1.1 tsutsui
310 1.20 perry DPRINTF("%s:\n", __func__);
311 1.1 tsutsui error = 0;
312 1.21 ad mutex_enter(&mntvnode_lock);
313 1.1 tsutsui for (bnode = LIST_FIRST(&bmp->bnode_head); bnode != NULL;
314 1.1 tsutsui bnode = LIST_NEXT(bnode, link)) {
315 1.1 tsutsui v = bnode->vnode;
316 1.36 rmind mutex_enter(v->v_interlock);
317 1.21 ad mutex_exit(&mntvnode_lock);
318 1.34 hannken err = vget(v, LK_EXCLUSIVE | LK_NOWAIT);
319 1.1 tsutsui if (err == 0) {
320 1.18 pooka err = VOP_FSYNC(v, cred, FSYNC_WAIT, 0, 0);
321 1.1 tsutsui vput(v);
322 1.1 tsutsui }
323 1.1 tsutsui if (err != 0)
324 1.1 tsutsui error = err;
325 1.21 ad mutex_enter(&mntvnode_lock);
326 1.1 tsutsui }
327 1.21 ad mutex_exit(&mntvnode_lock);
328 1.1 tsutsui
329 1.1 tsutsui return error;
330 1.1 tsutsui }
331 1.1 tsutsui
332 1.1 tsutsui int
333 1.1 tsutsui sysvbfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
334 1.1 tsutsui {
335 1.1 tsutsui struct sysvbfs_mount *bmp = mp->mnt_data;
336 1.1 tsutsui struct bfs *bfs = bmp->bfs;
337 1.1 tsutsui struct vnode *vp;
338 1.1 tsutsui struct sysvbfs_node *bnode;
339 1.1 tsutsui struct bfs_inode *inode;
340 1.1 tsutsui int error;
341 1.1 tsutsui
342 1.24 ad DPRINTF("%s: i-node=%lld\n", __func__, (long long)ino);
343 1.1 tsutsui /* Lookup requested i-node */
344 1.1 tsutsui if (!bfs_inode_lookup(bfs, ino, &inode)) {
345 1.37 njoly DPRINTF("%s: bfs_inode_lookup failed.\n", __func__);
346 1.1 tsutsui return ENOENT;
347 1.1 tsutsui }
348 1.28 pooka
349 1.28 pooka retry:
350 1.28 pooka mutex_enter(&mntvnode_lock);
351 1.1 tsutsui for (bnode = LIST_FIRST(&bmp->bnode_head); bnode != NULL;
352 1.1 tsutsui bnode = LIST_NEXT(bnode, link)) {
353 1.1 tsutsui if (bnode->inode->number == ino) {
354 1.28 pooka vp = bnode->vnode;
355 1.36 rmind mutex_enter(vp->v_interlock);
356 1.28 pooka mutex_exit(&mntvnode_lock);
357 1.35 hannken if (vget(vp, LK_EXCLUSIVE) == 0) {
358 1.28 pooka *vpp = vp;
359 1.28 pooka return 0;
360 1.28 pooka } else {
361 1.28 pooka goto retry;
362 1.28 pooka }
363 1.1 tsutsui }
364 1.1 tsutsui }
365 1.28 pooka mutex_exit(&mntvnode_lock);
366 1.1 tsutsui
367 1.1 tsutsui /* Allocate v-node. */
368 1.36 rmind error = getnewvnode(VT_SYSVBFS, mp, sysvbfs_vnodeop_p, NULL, &vp);
369 1.36 rmind if (error) {
370 1.20 perry DPRINTF("%s: getnewvnode error.\n", __func__);
371 1.1 tsutsui return error;
372 1.1 tsutsui }
373 1.1 tsutsui /* Lock vnode here */
374 1.1 tsutsui vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
375 1.1 tsutsui
376 1.1 tsutsui /* Allocate i-node */
377 1.1 tsutsui vp->v_data = pool_get(&sysvbfs_node_pool, PR_WAITOK);
378 1.1 tsutsui memset(vp->v_data, 0, sizeof(struct sysvbfs_node));
379 1.1 tsutsui bnode = vp->v_data;
380 1.21 ad mutex_enter(&mntvnode_lock);
381 1.1 tsutsui LIST_INSERT_HEAD(&bmp->bnode_head, bnode, link);
382 1.21 ad mutex_exit(&mntvnode_lock);
383 1.1 tsutsui bnode->vnode = vp;
384 1.1 tsutsui bnode->bmp = bmp;
385 1.1 tsutsui bnode->inode = inode;
386 1.1 tsutsui bnode->lockf = NULL; /* advlock */
387 1.1 tsutsui
388 1.1 tsutsui if (ino == BFS_ROOT_INODE) { /* BFS is flat filesystem */
389 1.1 tsutsui vp->v_type = VDIR;
390 1.17 ad vp->v_vflag |= VV_ROOT;
391 1.1 tsutsui } else {
392 1.1 tsutsui vp->v_type = VREG;
393 1.1 tsutsui }
394 1.1 tsutsui
395 1.1 tsutsui genfs_node_init(vp, &sysvbfs_genfsops);
396 1.16 rumble uvm_vnp_setsize(vp, bfs_file_size(inode));
397 1.1 tsutsui *vpp = vp;
398 1.1 tsutsui
399 1.1 tsutsui return 0;
400 1.1 tsutsui }
401 1.1 tsutsui
402 1.1 tsutsui int
403 1.1 tsutsui sysvbfs_fhtovp(struct mount *mp, struct fid *fid, struct vnode **vpp)
404 1.1 tsutsui {
405 1.1 tsutsui
406 1.20 perry DPRINTF("%s:\n", __func__);
407 1.1 tsutsui /* notyet */
408 1.1 tsutsui return EOPNOTSUPP;
409 1.1 tsutsui }
410 1.1 tsutsui
411 1.1 tsutsui int
412 1.5 martin sysvbfs_vptofh(struct vnode *vpp, struct fid *fid, size_t *fh_size)
413 1.1 tsutsui {
414 1.1 tsutsui
415 1.20 perry DPRINTF("%s:\n", __func__);
416 1.1 tsutsui /* notyet */
417 1.1 tsutsui return EOPNOTSUPP;
418 1.1 tsutsui }
419 1.1 tsutsui
420 1.11 pooka MALLOC_DECLARE(M_BFS);
421 1.11 pooka MALLOC_DECLARE(M_SYSVBFS_VNODE);
422 1.11 pooka
423 1.1 tsutsui void
424 1.1 tsutsui sysvbfs_init(void)
425 1.1 tsutsui {
426 1.1 tsutsui
427 1.20 perry DPRINTF("%s:\n", __func__);
428 1.11 pooka malloc_type_attach(M_SYSVBFS_VFS);
429 1.11 pooka malloc_type_attach(M_BFS);
430 1.11 pooka malloc_type_attach(M_SYSVBFS_VNODE);
431 1.11 pooka pool_init(&sysvbfs_node_pool, sizeof(struct sysvbfs_node), 0, 0, 0,
432 1.11 pooka "sysvbfs_node_pool", &pool_allocator_nointr, IPL_NONE);
433 1.1 tsutsui }
434 1.1 tsutsui
435 1.1 tsutsui void
436 1.1 tsutsui sysvbfs_reinit(void)
437 1.1 tsutsui {
438 1.1 tsutsui
439 1.1 tsutsui /* Nothing to do. */
440 1.20 perry DPRINTF("%s:\n", __func__);
441 1.1 tsutsui }
442 1.1 tsutsui
443 1.1 tsutsui void
444 1.1 tsutsui sysvbfs_done(void)
445 1.1 tsutsui {
446 1.1 tsutsui
447 1.20 perry DPRINTF("%s:\n", __func__);
448 1.1 tsutsui pool_destroy(&sysvbfs_node_pool);
449 1.11 pooka malloc_type_detach(M_BFS);
450 1.11 pooka malloc_type_detach(M_SYSVBFS_VFS);
451 1.11 pooka malloc_type_detach(M_SYSVBFS_VNODE);
452 1.1 tsutsui }
453 1.1 tsutsui
454 1.1 tsutsui int
455 1.1 tsutsui sysvbfs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,
456 1.3 elad kauth_cred_t cred)
457 1.1 tsutsui {
458 1.1 tsutsui
459 1.1 tsutsui return 0;
460 1.1 tsutsui }
461