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