sysvbfs.c revision 1.6 1 1.6 pooka /* $NetBSD: sysvbfs.c,v 1.6 2007/07/26 22:57:38 pooka 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 * 3. All advertising materials mentioning features or use of this software
19 1.1 tsutsui * must display the following acknowledgement:
20 1.1 tsutsui * This product includes software developed by the NetBSD
21 1.1 tsutsui * Foundation, Inc. and its contributors.
22 1.1 tsutsui * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 tsutsui * contributors may be used to endorse or promote products derived
24 1.1 tsutsui * from this software without specific prior written permission.
25 1.1 tsutsui *
26 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 tsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 tsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 tsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 tsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 tsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 tsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 tsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 tsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 tsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 tsutsui * POSSIBILITY OF SUCH DAMAGE.
37 1.1 tsutsui */
38 1.1 tsutsui
39 1.1 tsutsui #include <sys/cdefs.h>
40 1.6 pooka __KERNEL_RCSID(0, "$NetBSD: sysvbfs.c,v 1.6 2007/07/26 22:57:38 pooka Exp $");
41 1.1 tsutsui
42 1.1 tsutsui #include <sys/resource.h>
43 1.2 martin #include <sys/param.h>
44 1.1 tsutsui #include <sys/vnode.h>
45 1.1 tsutsui #include <sys/mount.h>
46 1.1 tsutsui #include <miscfs/genfs/genfs.h>
47 1.1 tsutsui #include <miscfs/genfs/genfs_node.h>
48 1.1 tsutsui #include <fs/sysvbfs/sysvbfs.h>
49 1.1 tsutsui
50 1.1 tsutsui /* External interfaces */
51 1.1 tsutsui
52 1.1 tsutsui int (**sysvbfs_vnodeop_p)(void *); /* filled by getnewvnode (vnode.h) */
53 1.1 tsutsui
54 1.1 tsutsui const struct vnodeopv_entry_desc sysvbfs_vnodeop_entries[] = {
55 1.1 tsutsui { &vop_default_desc, vn_default_error },
56 1.1 tsutsui { &vop_lookup_desc, sysvbfs_lookup }, /* lookup */
57 1.1 tsutsui { &vop_create_desc, sysvbfs_create }, /* create */
58 1.1 tsutsui { &vop_mknod_desc, genfs_eopnotsupp }, /* mknod */
59 1.1 tsutsui { &vop_open_desc, sysvbfs_open }, /* open */
60 1.1 tsutsui { &vop_close_desc, sysvbfs_close }, /* close */
61 1.1 tsutsui { &vop_access_desc, sysvbfs_access }, /* access */
62 1.1 tsutsui { &vop_getattr_desc, sysvbfs_getattr }, /* getattr */
63 1.1 tsutsui { &vop_setattr_desc, sysvbfs_setattr }, /* setattr */
64 1.1 tsutsui { &vop_read_desc, sysvbfs_read }, /* read */
65 1.1 tsutsui { &vop_write_desc, sysvbfs_write }, /* write */
66 1.1 tsutsui { &vop_lease_desc, genfs_lease_check }, /* lease */
67 1.1 tsutsui { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
68 1.1 tsutsui { &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */
69 1.1 tsutsui { &vop_poll_desc, genfs_poll }, /* poll */
70 1.1 tsutsui { &vop_kqfilter_desc, genfs_kqfilter }, /* kqfilter */
71 1.1 tsutsui { &vop_revoke_desc, genfs_revoke }, /* revoke */
72 1.1 tsutsui { &vop_mmap_desc, genfs_mmap }, /* mmap */
73 1.1 tsutsui { &vop_fsync_desc, sysvbfs_fsync }, /* fsync */
74 1.1 tsutsui { &vop_seek_desc, genfs_seek }, /* seek */
75 1.1 tsutsui { &vop_remove_desc, sysvbfs_remove }, /* remove */
76 1.1 tsutsui { &vop_link_desc, genfs_eopnotsupp }, /* link */
77 1.1 tsutsui { &vop_rename_desc, sysvbfs_rename }, /* rename */
78 1.1 tsutsui { &vop_mkdir_desc, genfs_eopnotsupp }, /* mkdir */
79 1.1 tsutsui { &vop_rmdir_desc, genfs_eopnotsupp }, /* rmdir */
80 1.1 tsutsui { &vop_symlink_desc, genfs_eopnotsupp }, /* symlink */
81 1.1 tsutsui { &vop_readdir_desc, sysvbfs_readdir }, /* readdir */
82 1.1 tsutsui { &vop_readlink_desc, genfs_eopnotsupp }, /* readlink */
83 1.1 tsutsui { &vop_abortop_desc, genfs_abortop }, /* abortop */
84 1.1 tsutsui { &vop_inactive_desc, sysvbfs_inactive }, /* inactive */
85 1.1 tsutsui { &vop_reclaim_desc, sysvbfs_reclaim }, /* reclaim */
86 1.1 tsutsui { &vop_lock_desc, genfs_lock }, /* lock */
87 1.1 tsutsui { &vop_unlock_desc, genfs_unlock }, /* unlock */
88 1.1 tsutsui { &vop_bmap_desc, sysvbfs_bmap }, /* bmap */
89 1.1 tsutsui { &vop_strategy_desc, sysvbfs_strategy }, /* strategy */
90 1.1 tsutsui { &vop_print_desc, sysvbfs_print }, /* print */
91 1.1 tsutsui { &vop_islocked_desc, genfs_islocked }, /* islocked */
92 1.1 tsutsui { &vop_pathconf_desc, sysvbfs_pathconf }, /* pathconf */
93 1.1 tsutsui { &vop_advlock_desc, sysvbfs_advlock }, /* advlock */
94 1.1 tsutsui { &vop_bwrite_desc, vn_bwrite }, /* bwrite */
95 1.1 tsutsui { &vop_getpages_desc, genfs_getpages }, /* getpages */
96 1.1 tsutsui { &vop_putpages_desc, genfs_putpages }, /* putpages */
97 1.1 tsutsui { NULL, NULL }
98 1.1 tsutsui };
99 1.1 tsutsui
100 1.1 tsutsui const struct vnodeopv_desc sysvbfs_vnodeop_opv_desc = {
101 1.1 tsutsui &sysvbfs_vnodeop_p,
102 1.1 tsutsui sysvbfs_vnodeop_entries
103 1.1 tsutsui };
104 1.1 tsutsui
105 1.1 tsutsui const struct vnodeopv_desc *sysvbfs_vnodeopv_descs[] = {
106 1.1 tsutsui &sysvbfs_vnodeop_opv_desc,
107 1.1 tsutsui NULL,
108 1.1 tsutsui };
109 1.1 tsutsui
110 1.1 tsutsui const struct genfs_ops sysvbfs_genfsops = {
111 1.1 tsutsui .gop_size = genfs_size,
112 1.1 tsutsui .gop_alloc = sysvbfs_gop_alloc,
113 1.1 tsutsui .gop_write = genfs_gop_write,
114 1.1 tsutsui };
115 1.1 tsutsui
116 1.1 tsutsui struct vfsops sysvbfs_vfsops = {
117 1.1 tsutsui MOUNT_SYSVBFS,
118 1.5 dsl sizeof (struct sysvbfs_args),
119 1.1 tsutsui sysvbfs_mount,
120 1.1 tsutsui sysvbfs_start,
121 1.1 tsutsui sysvbfs_unmount,
122 1.1 tsutsui sysvbfs_root,
123 1.1 tsutsui sysvbfs_quotactl,
124 1.1 tsutsui sysvbfs_statvfs,
125 1.1 tsutsui sysvbfs_sync,
126 1.1 tsutsui sysvbfs_vget,
127 1.1 tsutsui sysvbfs_fhtovp,
128 1.1 tsutsui sysvbfs_vptofh,
129 1.1 tsutsui sysvbfs_init,
130 1.1 tsutsui sysvbfs_reinit,
131 1.1 tsutsui sysvbfs_done,
132 1.1 tsutsui NULL, /* vfs_mountroot */
133 1.1 tsutsui (int (*)(struct mount *, struct vnode *, struct timespec *))
134 1.1 tsutsui eopnotsupp, /* snapshot */
135 1.1 tsutsui vfs_stdextattrctl,
136 1.6 pooka (void *)eopnotsupp, /* vfs_suspendctl */
137 1.1 tsutsui sysvbfs_vnodeopv_descs,
138 1.3 chs 0,
139 1.3 chs { NULL, NULL }
140 1.1 tsutsui };
141 1.1 tsutsui VFS_ATTACH(sysvbfs_vfsops);
142