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