Deleted Added
full compact
ffs_vnops.c (30283) ffs_vnops.c (30431)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95
34 * $Id: ffs_vnops.c,v 1.30 1997/09/27 13:40:10 kato Exp $
34 * $Id: ffs_vnops.c,v 1.31 1997/10/10 18:17:00 phk Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/resourcevar.h>
40#include <sys/signalvar.h>
41#include <sys/kernel.h>
42#include <sys/stat.h>
43#include <sys/buf.h>
44#include <sys/proc.h>
45#include <sys/mount.h>
46#include <sys/sysctl.h>
47#include <sys/vnode.h>
48#include <sys/malloc.h>
49
50#include <vm/vm.h>
51#include <vm/vm_prot.h>
52#include <vm/vm_page.h>
53#include <vm/vm_object.h>
54#include <vm/vm_extern.h>
55
56#include <miscfs/specfs/specdev.h>
57#include <miscfs/fifofs/fifo.h>
58
59#include <ufs/ufs/quota.h>
60#include <ufs/ufs/inode.h>
61#include <ufs/ufs/ufsmount.h>
62#include <ufs/ufs/ufs_extern.h>
63
64#include <ufs/ffs/fs.h>
65#include <ufs/ffs/ffs_extern.h>
66
67static int ffs_fsync __P((struct vop_fsync_args *));
68static int ffs_getpages __P((struct vop_getpages_args *));
69static int ffs_read __P((struct vop_read_args *));
70static int ffs_write __P((struct vop_write_args *));
71
72/* Global vfs data structures for ufs. */
73vop_t **ffs_vnodeop_p;
74static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/resourcevar.h>
40#include <sys/signalvar.h>
41#include <sys/kernel.h>
42#include <sys/stat.h>
43#include <sys/buf.h>
44#include <sys/proc.h>
45#include <sys/mount.h>
46#include <sys/sysctl.h>
47#include <sys/vnode.h>
48#include <sys/malloc.h>
49
50#include <vm/vm.h>
51#include <vm/vm_prot.h>
52#include <vm/vm_page.h>
53#include <vm/vm_object.h>
54#include <vm/vm_extern.h>
55
56#include <miscfs/specfs/specdev.h>
57#include <miscfs/fifofs/fifo.h>
58
59#include <ufs/ufs/quota.h>
60#include <ufs/ufs/inode.h>
61#include <ufs/ufs/ufsmount.h>
62#include <ufs/ufs/ufs_extern.h>
63
64#include <ufs/ffs/fs.h>
65#include <ufs/ffs/ffs_extern.h>
66
67static int ffs_fsync __P((struct vop_fsync_args *));
68static int ffs_getpages __P((struct vop_getpages_args *));
69static int ffs_read __P((struct vop_read_args *));
70static int ffs_write __P((struct vop_write_args *));
71
72/* Global vfs data structures for ufs. */
73vop_t **ffs_vnodeop_p;
74static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = {
75 { &vop_default_desc, (vop_t *)vn_default_error },
76 { &vop_lookup_desc, (vop_t *)vfs_cache_lookup },/* lookup */
77 { &vop_cachedlookup_desc, (vop_t *)ufs_lookup },/* cachedlookup */
78 { &vop_create_desc, (vop_t *)ufs_create }, /* create */
79 { &vop_whiteout_desc, (vop_t *)ufs_whiteout }, /* whiteout */
80 { &vop_mknod_desc, (vop_t *)ufs_mknod }, /* mknod */
81 { &vop_open_desc, (vop_t *)ufs_open }, /* open */
82 { &vop_close_desc, (vop_t *)ufs_close }, /* close */
83 { &vop_access_desc, (vop_t *)ufs_access }, /* access */
84 { &vop_getattr_desc, (vop_t *)ufs_getattr }, /* getattr */
85 { &vop_setattr_desc, (vop_t *)ufs_setattr }, /* setattr */
86 { &vop_read_desc, (vop_t *)ffs_read }, /* read */
87 { &vop_write_desc, (vop_t *)ffs_write }, /* write */
88 { &vop_lease_desc, (vop_t *)ufs_lease_check }, /* lease */
89 { &vop_ioctl_desc, (vop_t *)ufs_ioctl }, /* ioctl */
90 { &vop_poll_desc, (vop_t *)ufs_poll }, /* poll */
91 { &vop_revoke_desc, (vop_t *)ufs_revoke }, /* revoke */
92 { &vop_mmap_desc, (vop_t *)ufs_mmap }, /* mmap */
93 { &vop_fsync_desc, (vop_t *)ffs_fsync }, /* fsync */
94 { &vop_seek_desc, (vop_t *)ufs_seek }, /* seek */
95 { &vop_remove_desc, (vop_t *)ufs_remove }, /* remove */
96 { &vop_link_desc, (vop_t *)ufs_link }, /* link */
97 { &vop_rename_desc, (vop_t *)ufs_rename }, /* rename */
98 { &vop_mkdir_desc, (vop_t *)ufs_mkdir }, /* mkdir */
99 { &vop_rmdir_desc, (vop_t *)ufs_rmdir }, /* rmdir */
100 { &vop_symlink_desc, (vop_t *)ufs_symlink }, /* symlink */
101 { &vop_readdir_desc, (vop_t *)ufs_readdir }, /* readdir */
102 { &vop_readlink_desc, (vop_t *)ufs_readlink }, /* readlink */
103 { &vop_abortop_desc, (vop_t *)ufs_abortop }, /* abortop */
104 { &vop_inactive_desc, (vop_t *)ufs_inactive }, /* inactive */
105 { &vop_reclaim_desc, (vop_t *)ufs_reclaim }, /* reclaim */
106 { &vop_lock_desc, (vop_t *)ufs_lock }, /* lock */
107 { &vop_unlock_desc, (vop_t *)ufs_unlock }, /* unlock */
108 { &vop_bmap_desc, (vop_t *)ufs_bmap }, /* bmap */
109 { &vop_strategy_desc, (vop_t *)ufs_strategy }, /* strategy */
110 { &vop_print_desc, (vop_t *)ufs_print }, /* print */
111 { &vop_islocked_desc, (vop_t *)ufs_islocked }, /* islocked */
112 { &vop_pathconf_desc, (vop_t *)ufs_pathconf }, /* pathconf */
113 { &vop_advlock_desc, (vop_t *)ufs_advlock }, /* advlock */
114 { &vop_blkatoff_desc, (vop_t *)ffs_blkatoff }, /* blkatoff */
115 { &vop_valloc_desc, (vop_t *)ffs_valloc }, /* valloc */
116 { &vop_reallocblks_desc, (vop_t *)ffs_reallocblks }, /* reallocblks */
117 { &vop_vfree_desc, (vop_t *)ffs_vfree }, /* vfree */
118 { &vop_truncate_desc, (vop_t *)ffs_truncate }, /* truncate */
119 { &vop_update_desc, (vop_t *)ffs_update }, /* update */
120 { &vop_getpages_desc, (vop_t *)ffs_getpages}, /* getpages */
121/* XXX: vop_putpages */
122 { &vop_bwrite_desc, (vop_t *)vn_bwrite }, /* bwrite */
75 { &vop_default_desc, (vop_t *) vn_default_error },
76 { &vop_abortop_desc, (vop_t *) ufs_abortop },
77 { &vop_access_desc, (vop_t *) ufs_access },
78 { &vop_advlock_desc, (vop_t *) ufs_advlock },
79 { &vop_blkatoff_desc, (vop_t *) ffs_blkatoff },
80 { &vop_bmap_desc, (vop_t *) ufs_bmap },
81 { &vop_bwrite_desc, (vop_t *) vn_bwrite },
82 { &vop_cachedlookup_desc, (vop_t *) ufs_lookup },
83 { &vop_close_desc, (vop_t *) ufs_close },
84 { &vop_create_desc, (vop_t *) ufs_create },
85 { &vop_fsync_desc, (vop_t *) ffs_fsync },
86 { &vop_getattr_desc, (vop_t *) ufs_getattr },
87 { &vop_getpages_desc, (vop_t *) ffs_getpages },
88 { &vop_inactive_desc, (vop_t *) ufs_inactive },
89 { &vop_ioctl_desc, (vop_t *) ufs_ioctl },
90 { &vop_islocked_desc, (vop_t *) ufs_islocked },
91 { &vop_lease_desc, (vop_t *) ufs_lease_check },
92 { &vop_link_desc, (vop_t *) ufs_link },
93 { &vop_lock_desc, (vop_t *) ufs_lock },
94 { &vop_lookup_desc, (vop_t *) vfs_cache_lookup },
95 { &vop_mkdir_desc, (vop_t *) ufs_mkdir },
96 { &vop_mknod_desc, (vop_t *) ufs_mknod },
97 { &vop_mmap_desc, (vop_t *) ufs_mmap },
98 { &vop_open_desc, (vop_t *) ufs_open },
99 { &vop_pathconf_desc, (vop_t *) ufs_pathconf },
100 { &vop_poll_desc, (vop_t *) ufs_poll },
101 { &vop_print_desc, (vop_t *) ufs_print },
102 { &vop_read_desc, (vop_t *) ffs_read },
103 { &vop_readdir_desc, (vop_t *) ufs_readdir },
104 { &vop_readlink_desc, (vop_t *) ufs_readlink },
105 { &vop_reallocblks_desc, (vop_t *) ffs_reallocblks },
106 { &vop_reclaim_desc, (vop_t *) ufs_reclaim },
107 { &vop_remove_desc, (vop_t *) ufs_remove },
108 { &vop_rename_desc, (vop_t *) ufs_rename },
109 { &vop_revoke_desc, (vop_t *) ufs_revoke },
110 { &vop_rmdir_desc, (vop_t *) ufs_rmdir },
111 { &vop_seek_desc, (vop_t *) ufs_seek },
112 { &vop_setattr_desc, (vop_t *) ufs_setattr },
113 { &vop_strategy_desc, (vop_t *) ufs_strategy },
114 { &vop_symlink_desc, (vop_t *) ufs_symlink },
115 { &vop_truncate_desc, (vop_t *) ffs_truncate },
116 { &vop_unlock_desc, (vop_t *) ufs_unlock },
117 { &vop_update_desc, (vop_t *) ffs_update },
118 { &vop_valloc_desc, (vop_t *) ffs_valloc },
119 { &vop_vfree_desc, (vop_t *) ffs_vfree },
120 { &vop_whiteout_desc, (vop_t *) ufs_whiteout },
121 { &vop_write_desc, (vop_t *) ffs_write },
123 { NULL, NULL }
124};
125static struct vnodeopv_desc ffs_vnodeop_opv_desc =
126 { &ffs_vnodeop_p, ffs_vnodeop_entries };
127
128vop_t **ffs_specop_p;
129static struct vnodeopv_entry_desc ffs_specop_entries[] = {
122 { NULL, NULL }
123};
124static struct vnodeopv_desc ffs_vnodeop_opv_desc =
125 { &ffs_vnodeop_p, ffs_vnodeop_entries };
126
127vop_t **ffs_specop_p;
128static struct vnodeopv_entry_desc ffs_specop_entries[] = {
130 { &vop_default_desc, (vop_t *)vn_default_error },
131 { &vop_lookup_desc, (vop_t *)spec_lookup }, /* lookup */
132/* XXX: vop_cachedlookup */
133 { &vop_create_desc, (vop_t *)spec_create }, /* create */
134/* XXX: vop_whiteout */
135 { &vop_mknod_desc, (vop_t *)spec_mknod }, /* mknod */
136 { &vop_open_desc, (vop_t *)spec_open }, /* open */
137 { &vop_close_desc, (vop_t *)ufsspec_close }, /* close */
138 { &vop_access_desc, (vop_t *)ufs_access }, /* access */
139 { &vop_getattr_desc, (vop_t *)ufs_getattr }, /* getattr */
140 { &vop_setattr_desc, (vop_t *)ufs_setattr }, /* setattr */
141 { &vop_read_desc, (vop_t *)ufsspec_read }, /* read */
142 { &vop_write_desc, (vop_t *)ufsspec_write }, /* write */
143 { &vop_lease_desc, (vop_t *)spec_lease_check }, /* lease */
144 { &vop_ioctl_desc, (vop_t *)spec_ioctl }, /* ioctl */
145 { &vop_poll_desc, (vop_t *)spec_poll }, /* poll */
146 { &vop_revoke_desc, (vop_t *)spec_revoke }, /* revoke */
147 { &vop_mmap_desc, (vop_t *)spec_mmap }, /* mmap */
148 { &vop_fsync_desc, (vop_t *)ffs_fsync }, /* fsync */
149 { &vop_seek_desc, (vop_t *)spec_seek }, /* seek */
150 { &vop_remove_desc, (vop_t *)spec_remove }, /* remove */
151 { &vop_link_desc, (vop_t *)spec_link }, /* link */
152 { &vop_rename_desc, (vop_t *)spec_rename }, /* rename */
153 { &vop_mkdir_desc, (vop_t *)spec_mkdir }, /* mkdir */
154 { &vop_rmdir_desc, (vop_t *)spec_rmdir }, /* rmdir */
155 { &vop_symlink_desc, (vop_t *)spec_symlink }, /* symlink */
156 { &vop_readdir_desc, (vop_t *)spec_readdir }, /* readdir */
157 { &vop_readlink_desc, (vop_t *)spec_readlink }, /* readlink */
158 { &vop_abortop_desc, (vop_t *)spec_abortop }, /* abortop */
159 { &vop_inactive_desc, (vop_t *)ufs_inactive }, /* inactive */
160 { &vop_reclaim_desc, (vop_t *)ufs_reclaim }, /* reclaim */
161 { &vop_lock_desc, (vop_t *)ufs_lock }, /* lock */
162 { &vop_unlock_desc, (vop_t *)ufs_unlock }, /* unlock */
163 { &vop_bmap_desc, (vop_t *)spec_bmap }, /* bmap */
164 { &vop_strategy_desc, (vop_t *)spec_strategy }, /* strategy */
165 { &vop_print_desc, (vop_t *)ufs_print }, /* print */
166 { &vop_islocked_desc, (vop_t *)ufs_islocked }, /* islocked */
167 { &vop_pathconf_desc, (vop_t *)spec_pathconf }, /* pathconf */
168 { &vop_advlock_desc, (vop_t *)spec_advlock }, /* advlock */
169 { &vop_blkatoff_desc, (vop_t *)spec_blkatoff }, /* blkatoff */
170 { &vop_valloc_desc, (vop_t *)spec_valloc }, /* valloc */
171 { &vop_reallocblks_desc, (vop_t *)spec_reallocblks }, /* reallocblks */
172 { &vop_vfree_desc, (vop_t *)ffs_vfree }, /* vfree */
173 { &vop_truncate_desc, (vop_t *)spec_truncate }, /* truncate */
174 { &vop_update_desc, (vop_t *)ffs_update }, /* update */
175 { &vop_getpages_desc, (vop_t *)spec_getpages}, /* getpages */
176/* XXX: vop_putpages */
177 { &vop_bwrite_desc, (vop_t *)vn_bwrite }, /* bwrite */
129 { &vop_default_desc, (vop_t *) vn_default_error },
130 { &vop_abortop_desc, (vop_t *) spec_abortop },
131 { &vop_access_desc, (vop_t *) ufs_access },
132 { &vop_advlock_desc, (vop_t *) spec_advlock },
133 { &vop_blkatoff_desc, (vop_t *) spec_blkatoff },
134 { &vop_bmap_desc, (vop_t *) spec_bmap },
135 { &vop_bwrite_desc, (vop_t *) vn_bwrite },
136 { &vop_close_desc, (vop_t *) ufsspec_close },
137 { &vop_create_desc, (vop_t *) spec_create },
138 { &vop_fsync_desc, (vop_t *) ffs_fsync },
139 { &vop_getattr_desc, (vop_t *) ufs_getattr },
140 { &vop_getpages_desc, (vop_t *) spec_getpages },
141 { &vop_inactive_desc, (vop_t *) ufs_inactive },
142 { &vop_ioctl_desc, (vop_t *) spec_ioctl },
143 { &vop_islocked_desc, (vop_t *) ufs_islocked },
144 { &vop_lease_desc, (vop_t *) spec_lease_check },
145 { &vop_link_desc, (vop_t *) spec_link },
146 { &vop_lock_desc, (vop_t *) ufs_lock },
147 { &vop_lookup_desc, (vop_t *) spec_lookup },
148 { &vop_mkdir_desc, (vop_t *) spec_mkdir },
149 { &vop_mknod_desc, (vop_t *) spec_mknod },
150 { &vop_mmap_desc, (vop_t *) spec_mmap },
151 { &vop_open_desc, (vop_t *) spec_open },
152 { &vop_pathconf_desc, (vop_t *) spec_pathconf },
153 { &vop_poll_desc, (vop_t *) spec_poll },
154 { &vop_print_desc, (vop_t *) ufs_print },
155 { &vop_read_desc, (vop_t *) ufsspec_read },
156 { &vop_readdir_desc, (vop_t *) spec_readdir },
157 { &vop_readlink_desc, (vop_t *) spec_readlink },
158 { &vop_reallocblks_desc, (vop_t *) spec_reallocblks },
159 { &vop_reclaim_desc, (vop_t *) ufs_reclaim },
160 { &vop_remove_desc, (vop_t *) spec_remove },
161 { &vop_rename_desc, (vop_t *) spec_rename },
162 { &vop_revoke_desc, (vop_t *) spec_revoke },
163 { &vop_rmdir_desc, (vop_t *) spec_rmdir },
164 { &vop_seek_desc, (vop_t *) spec_seek },
165 { &vop_setattr_desc, (vop_t *) ufs_setattr },
166 { &vop_strategy_desc, (vop_t *) spec_strategy },
167 { &vop_symlink_desc, (vop_t *) spec_symlink },
168 { &vop_truncate_desc, (vop_t *) spec_truncate },
169 { &vop_unlock_desc, (vop_t *) ufs_unlock },
170 { &vop_update_desc, (vop_t *) ffs_update },
171 { &vop_valloc_desc, (vop_t *) spec_valloc },
172 { &vop_vfree_desc, (vop_t *) ffs_vfree },
173 { &vop_write_desc, (vop_t *) ufsspec_write },
178 { NULL, NULL }
179};
180static struct vnodeopv_desc ffs_specop_opv_desc =
181 { &ffs_specop_p, ffs_specop_entries };
182
183vop_t **ffs_fifoop_p;
184static struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
174 { NULL, NULL }
175};
176static struct vnodeopv_desc ffs_specop_opv_desc =
177 { &ffs_specop_p, ffs_specop_entries };
178
179vop_t **ffs_fifoop_p;
180static struct vnodeopv_entry_desc ffs_fifoop_entries[] = {
185 { &vop_default_desc, (vop_t *)vn_default_error },
186 { &vop_lookup_desc, (vop_t *)fifo_lookup }, /* lookup */
187/* XXX: vop_cachedlookup */
188 { &vop_create_desc, (vop_t *)fifo_create }, /* create */
189/* XXX: vop_whiteout */
190 { &vop_mknod_desc, (vop_t *)fifo_mknod }, /* mknod */
191 { &vop_open_desc, (vop_t *)fifo_open }, /* open */
192 { &vop_close_desc, (vop_t *)ufsfifo_close }, /* close */
193 { &vop_access_desc, (vop_t *)ufs_access }, /* access */
194 { &vop_getattr_desc, (vop_t *)ufs_getattr }, /* getattr */
195 { &vop_setattr_desc, (vop_t *)ufs_setattr }, /* setattr */
196 { &vop_read_desc, (vop_t *)ufsfifo_read }, /* read */
197 { &vop_write_desc, (vop_t *)ufsfifo_write }, /* write */
198 { &vop_lease_desc, (vop_t *)fifo_lease_check }, /* lease */
199 { &vop_ioctl_desc, (vop_t *)fifo_ioctl }, /* ioctl */
200 { &vop_poll_desc, (vop_t *)fifo_poll }, /* poll */
201 { &vop_revoke_desc, (vop_t *)fifo_revoke }, /* revoke */
202 { &vop_mmap_desc, (vop_t *)fifo_mmap }, /* mmap */
203 { &vop_fsync_desc, (vop_t *)ffs_fsync }, /* fsync */
204 { &vop_seek_desc, (vop_t *)fifo_seek }, /* seek */
205 { &vop_remove_desc, (vop_t *)fifo_remove }, /* remove */
206 { &vop_link_desc, (vop_t *)fifo_link }, /* link */
207 { &vop_rename_desc, (vop_t *)fifo_rename }, /* rename */
208 { &vop_mkdir_desc, (vop_t *)fifo_mkdir }, /* mkdir */
209 { &vop_rmdir_desc, (vop_t *)fifo_rmdir }, /* rmdir */
210 { &vop_symlink_desc, (vop_t *)fifo_symlink }, /* symlink */
211 { &vop_readdir_desc, (vop_t *)fifo_readdir }, /* readdir */
212 { &vop_readlink_desc, (vop_t *)fifo_readlink }, /* readlink */
213 { &vop_abortop_desc, (vop_t *)fifo_abortop }, /* abortop */
214 { &vop_inactive_desc, (vop_t *)ufs_inactive }, /* inactive */
215 { &vop_reclaim_desc, (vop_t *)ufs_reclaim }, /* reclaim */
216 { &vop_lock_desc, (vop_t *)ufs_lock }, /* lock */
217 { &vop_unlock_desc, (vop_t *)ufs_unlock }, /* unlock */
218 { &vop_bmap_desc, (vop_t *)fifo_bmap }, /* bmap */
219 { &vop_strategy_desc, (vop_t *)fifo_strategy }, /* strategy */
220 { &vop_print_desc, (vop_t *)ufs_print }, /* print */
221 { &vop_islocked_desc, (vop_t *)ufs_islocked }, /* islocked */
222 { &vop_pathconf_desc, (vop_t *)fifo_pathconf }, /* pathconf */
223 { &vop_advlock_desc, (vop_t *)fifo_advlock }, /* advlock */
224 { &vop_blkatoff_desc, (vop_t *)fifo_blkatoff }, /* blkatoff */
225 { &vop_valloc_desc, (vop_t *)fifo_valloc }, /* valloc */
226 { &vop_reallocblks_desc, (vop_t *)fifo_reallocblks }, /* reallocblks */
227 { &vop_vfree_desc, (vop_t *)ffs_vfree }, /* vfree */
228 { &vop_truncate_desc, (vop_t *)fifo_truncate }, /* truncate */
229 { &vop_update_desc, (vop_t *)ffs_update }, /* update */
230/* XXX: vop_getpages */
231/* XXX: vop_putpages */
232 { &vop_bwrite_desc, (vop_t *)vn_bwrite }, /* bwrite */
181 { &vop_default_desc, (vop_t *) vn_default_error },
182 { &vop_abortop_desc, (vop_t *) fifo_abortop },
183 { &vop_access_desc, (vop_t *) ufs_access },
184 { &vop_advlock_desc, (vop_t *) fifo_advlock },
185 { &vop_blkatoff_desc, (vop_t *) fifo_blkatoff },
186 { &vop_bmap_desc, (vop_t *) fifo_bmap },
187 { &vop_bwrite_desc, (vop_t *) vn_bwrite },
188 { &vop_close_desc, (vop_t *) ufsfifo_close },
189 { &vop_create_desc, (vop_t *) fifo_create },
190 { &vop_fsync_desc, (vop_t *) ffs_fsync },
191 { &vop_getattr_desc, (vop_t *) ufs_getattr },
192 { &vop_inactive_desc, (vop_t *) ufs_inactive },
193 { &vop_ioctl_desc, (vop_t *) fifo_ioctl },
194 { &vop_islocked_desc, (vop_t *) ufs_islocked },
195 { &vop_lease_desc, (vop_t *) fifo_lease_check },
196 { &vop_link_desc, (vop_t *) fifo_link },
197 { &vop_lock_desc, (vop_t *) ufs_lock },
198 { &vop_lookup_desc, (vop_t *) fifo_lookup },
199 { &vop_mkdir_desc, (vop_t *) fifo_mkdir },
200 { &vop_mknod_desc, (vop_t *) fifo_mknod },
201 { &vop_mmap_desc, (vop_t *) fifo_mmap },
202 { &vop_open_desc, (vop_t *) fifo_open },
203 { &vop_pathconf_desc, (vop_t *) fifo_pathconf },
204 { &vop_poll_desc, (vop_t *) fifo_poll },
205 { &vop_print_desc, (vop_t *) ufs_print },
206 { &vop_read_desc, (vop_t *) ufsfifo_read },
207 { &vop_readdir_desc, (vop_t *) fifo_readdir },
208 { &vop_readlink_desc, (vop_t *) fifo_readlink },
209 { &vop_reallocblks_desc, (vop_t *) fifo_reallocblks },
210 { &vop_reclaim_desc, (vop_t *) ufs_reclaim },
211 { &vop_remove_desc, (vop_t *) fifo_remove },
212 { &vop_rename_desc, (vop_t *) fifo_rename },
213 { &vop_revoke_desc, (vop_t *) fifo_revoke },
214 { &vop_rmdir_desc, (vop_t *) fifo_rmdir },
215 { &vop_seek_desc, (vop_t *) fifo_seek },
216 { &vop_setattr_desc, (vop_t *) ufs_setattr },
217 { &vop_strategy_desc, (vop_t *) fifo_strategy },
218 { &vop_symlink_desc, (vop_t *) fifo_symlink },
219 { &vop_truncate_desc, (vop_t *) fifo_truncate },
220 { &vop_unlock_desc, (vop_t *) ufs_unlock },
221 { &vop_update_desc, (vop_t *) ffs_update },
222 { &vop_valloc_desc, (vop_t *) fifo_valloc },
223 { &vop_vfree_desc, (vop_t *) ffs_vfree },
224 { &vop_write_desc, (vop_t *) ufsfifo_write },
233 { NULL, NULL }
234};
235static struct vnodeopv_desc ffs_fifoop_opv_desc =
236 { &ffs_fifoop_p, ffs_fifoop_entries };
237
238VNODEOP_SET(ffs_vnodeop_opv_desc);
239VNODEOP_SET(ffs_specop_opv_desc);
240VNODEOP_SET(ffs_fifoop_opv_desc);
241
242SYSCTL_NODE(_vfs, MOUNT_UFS, ffs, CTLFLAG_RW, 0, "FFS filesystem");
243
244#include <ufs/ufs/ufs_readwrite.c>
245
246/*
247 * Synch an open file.
248 */
249/* ARGSUSED */
250static int
251ffs_fsync(ap)
252 struct vop_fsync_args /* {
253 struct vnode *a_vp;
254 struct ucred *a_cred;
255 int a_waitfor;
256 struct proc *a_p;
257 } */ *ap;
258{
259 register struct vnode *vp = ap->a_vp;
260 register struct buf *bp;
261 struct timeval tv;
262 struct buf *nbp;
263 int pass;
264 int s;
265
266 pass = 0;
267 /*
268 * Flush all dirty buffers associated with a vnode.
269 */
270loop:
271 s = splbio();
272 for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) {
273 nbp = bp->b_vnbufs.le_next;
274 if ((bp->b_flags & B_BUSY) || (pass == 0 && (bp->b_blkno < 0)))
275 continue;
276 if ((bp->b_flags & B_DELWRI) == 0)
277 panic("ffs_fsync: not dirty");
278
279 if (bp->b_vp != vp || ap->a_waitfor != MNT_NOWAIT) {
280
281 bremfree(bp);
282 bp->b_flags |= B_BUSY;
283 splx(s);
284 /*
285 * Wait for I/O associated with indirect blocks to complete,
286 * since there is no way to quickly wait for them below.
287 */
288 if (bp->b_vp == vp || ap->a_waitfor == MNT_NOWAIT)
289 (void) bawrite(bp);
290 else
291 (void) bwrite(bp);
292 } else {
293 vfs_bio_awrite(bp);
294 splx(s);
295 }
296 goto loop;
297 }
298 splx(s);
299
300 if (pass == 0) {
301 pass = 1;
302 goto loop;
303 }
304
305 if (ap->a_waitfor == MNT_WAIT) {
306 s = splbio();
307 while (vp->v_numoutput) {
308 vp->v_flag |= VBWAIT;
309 (void) tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "ffsfsn", 0);
310 }
311 splx(s);
312#ifdef DIAGNOSTIC
313 if (vp->v_dirtyblkhd.lh_first) {
314 vprint("ffs_fsync: dirty", vp);
315 goto loop;
316 }
317#endif
318 }
319
320 gettime(&tv);
321 return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
322}
323
225 { NULL, NULL }
226};
227static struct vnodeopv_desc ffs_fifoop_opv_desc =
228 { &ffs_fifoop_p, ffs_fifoop_entries };
229
230VNODEOP_SET(ffs_vnodeop_opv_desc);
231VNODEOP_SET(ffs_specop_opv_desc);
232VNODEOP_SET(ffs_fifoop_opv_desc);
233
234SYSCTL_NODE(_vfs, MOUNT_UFS, ffs, CTLFLAG_RW, 0, "FFS filesystem");
235
236#include <ufs/ufs/ufs_readwrite.c>
237
238/*
239 * Synch an open file.
240 */
241/* ARGSUSED */
242static int
243ffs_fsync(ap)
244 struct vop_fsync_args /* {
245 struct vnode *a_vp;
246 struct ucred *a_cred;
247 int a_waitfor;
248 struct proc *a_p;
249 } */ *ap;
250{
251 register struct vnode *vp = ap->a_vp;
252 register struct buf *bp;
253 struct timeval tv;
254 struct buf *nbp;
255 int pass;
256 int s;
257
258 pass = 0;
259 /*
260 * Flush all dirty buffers associated with a vnode.
261 */
262loop:
263 s = splbio();
264 for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) {
265 nbp = bp->b_vnbufs.le_next;
266 if ((bp->b_flags & B_BUSY) || (pass == 0 && (bp->b_blkno < 0)))
267 continue;
268 if ((bp->b_flags & B_DELWRI) == 0)
269 panic("ffs_fsync: not dirty");
270
271 if (bp->b_vp != vp || ap->a_waitfor != MNT_NOWAIT) {
272
273 bremfree(bp);
274 bp->b_flags |= B_BUSY;
275 splx(s);
276 /*
277 * Wait for I/O associated with indirect blocks to complete,
278 * since there is no way to quickly wait for them below.
279 */
280 if (bp->b_vp == vp || ap->a_waitfor == MNT_NOWAIT)
281 (void) bawrite(bp);
282 else
283 (void) bwrite(bp);
284 } else {
285 vfs_bio_awrite(bp);
286 splx(s);
287 }
288 goto loop;
289 }
290 splx(s);
291
292 if (pass == 0) {
293 pass = 1;
294 goto loop;
295 }
296
297 if (ap->a_waitfor == MNT_WAIT) {
298 s = splbio();
299 while (vp->v_numoutput) {
300 vp->v_flag |= VBWAIT;
301 (void) tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "ffsfsn", 0);
302 }
303 splx(s);
304#ifdef DIAGNOSTIC
305 if (vp->v_dirtyblkhd.lh_first) {
306 vprint("ffs_fsync: dirty", vp);
307 goto loop;
308 }
309#endif
310 }
311
312 gettime(&tv);
313 return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
314}
315