No empty .Rs/.Re
[netbsd-mini2440.git] / sys / fs / sysvbfs / sysvbfs.c
blobbd96ecc871b20051415eac7e899f483e2b32b821
1 /* $NetBSD: sysvbfs.c,v 1.11 2008/04/29 18:18:08 ad Exp $ */
3 /*-
4 * Copyright (c) 2004 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: sysvbfs.c,v 1.11 2008/04/29 18:18:08 ad Exp $");
35 #include <sys/resource.h>
36 #include <sys/param.h>
37 #include <sys/vnode.h>
38 #include <sys/mount.h>
39 #include <sys/module.h>
40 #include <miscfs/genfs/genfs.h>
41 #include <miscfs/genfs/genfs_node.h>
42 #include <fs/sysvbfs/sysvbfs.h>
44 MODULE(MODULE_CLASS_VFS, sysvbfs, NULL);
46 /* External interfaces */
48 int (**sysvbfs_vnodeop_p)(void *); /* filled by getnewvnode (vnode.h) */
50 const struct vnodeopv_entry_desc sysvbfs_vnodeop_entries[] = {
51 { &vop_default_desc, vn_default_error },
52 { &vop_lookup_desc, sysvbfs_lookup }, /* lookup */
53 { &vop_create_desc, sysvbfs_create }, /* create */
54 { &vop_mknod_desc, genfs_eopnotsupp }, /* mknod */
55 { &vop_open_desc, sysvbfs_open }, /* open */
56 { &vop_close_desc, sysvbfs_close }, /* close */
57 { &vop_access_desc, sysvbfs_access }, /* access */
58 { &vop_getattr_desc, sysvbfs_getattr }, /* getattr */
59 { &vop_setattr_desc, sysvbfs_setattr }, /* setattr */
60 { &vop_read_desc, sysvbfs_read }, /* read */
61 { &vop_write_desc, sysvbfs_write }, /* write */
62 { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
63 { &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */
64 { &vop_poll_desc, genfs_poll }, /* poll */
65 { &vop_kqfilter_desc, genfs_kqfilter }, /* kqfilter */
66 { &vop_revoke_desc, genfs_revoke }, /* revoke */
67 { &vop_mmap_desc, genfs_mmap }, /* mmap */
68 { &vop_fsync_desc, sysvbfs_fsync }, /* fsync */
69 { &vop_seek_desc, genfs_seek }, /* seek */
70 { &vop_remove_desc, sysvbfs_remove }, /* remove */
71 { &vop_link_desc, genfs_eopnotsupp }, /* link */
72 { &vop_rename_desc, sysvbfs_rename }, /* rename */
73 { &vop_mkdir_desc, genfs_eopnotsupp }, /* mkdir */
74 { &vop_rmdir_desc, genfs_eopnotsupp }, /* rmdir */
75 { &vop_symlink_desc, genfs_eopnotsupp }, /* symlink */
76 { &vop_readdir_desc, sysvbfs_readdir }, /* readdir */
77 { &vop_readlink_desc, genfs_eopnotsupp }, /* readlink */
78 { &vop_abortop_desc, genfs_abortop }, /* abortop */
79 { &vop_inactive_desc, sysvbfs_inactive }, /* inactive */
80 { &vop_reclaim_desc, sysvbfs_reclaim }, /* reclaim */
81 { &vop_lock_desc, genfs_lock }, /* lock */
82 { &vop_unlock_desc, genfs_unlock }, /* unlock */
83 { &vop_bmap_desc, sysvbfs_bmap }, /* bmap */
84 { &vop_strategy_desc, sysvbfs_strategy }, /* strategy */
85 { &vop_print_desc, sysvbfs_print }, /* print */
86 { &vop_islocked_desc, genfs_islocked }, /* islocked */
87 { &vop_pathconf_desc, sysvbfs_pathconf }, /* pathconf */
88 { &vop_advlock_desc, sysvbfs_advlock }, /* advlock */
89 { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
90 { &vop_getpages_desc, genfs_getpages }, /* getpages */
91 { &vop_putpages_desc, genfs_putpages }, /* putpages */
92 { NULL, NULL }
95 const struct vnodeopv_desc sysvbfs_vnodeop_opv_desc = {
96 &sysvbfs_vnodeop_p,
97 sysvbfs_vnodeop_entries
100 const struct vnodeopv_desc *sysvbfs_vnodeopv_descs[] = {
101 &sysvbfs_vnodeop_opv_desc,
102 NULL,
105 const struct genfs_ops sysvbfs_genfsops = {
106 .gop_size = genfs_size,
107 .gop_alloc = sysvbfs_gop_alloc,
108 .gop_write = genfs_gop_write,
111 struct vfsops sysvbfs_vfsops = {
112 MOUNT_SYSVBFS,
113 sizeof (struct sysvbfs_args),
114 sysvbfs_mount,
115 sysvbfs_start,
116 sysvbfs_unmount,
117 sysvbfs_root,
118 (void *)eopnotsupp, /* vfs_quotactl */
119 sysvbfs_statvfs,
120 sysvbfs_sync,
121 sysvbfs_vget,
122 sysvbfs_fhtovp,
123 sysvbfs_vptofh,
124 sysvbfs_init,
125 sysvbfs_reinit,
126 sysvbfs_done,
127 NULL, /* vfs_mountroot */
128 (int (*)(struct mount *, struct vnode *, struct timespec *))
129 eopnotsupp, /* snapshot */
130 vfs_stdextattrctl,
131 (void *)eopnotsupp, /* vfs_suspendctl */
132 genfs_renamelock_enter,
133 genfs_renamelock_exit,
134 (void *)eopnotsupp,
135 sysvbfs_vnodeopv_descs,
137 { NULL, NULL }
140 static int
141 sysvbfs_modcmd(modcmd_t cmd, void *arg)
144 switch (cmd) {
145 case MODULE_CMD_INIT:
146 return vfs_attach(&sysvbfs_vfsops);
147 case MODULE_CMD_FINI:
148 return vfs_detach(&sysvbfs_vfsops);
149 default:
150 return ENOTTY;