2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 #include "xfs_macros.h"
39 #include "xfs_trans.h"
45 #include "xfs_alloc.h"
46 #include "xfs_dmapi.h"
47 #include "xfs_mount.h"
48 #include "xfs_quota.h"
53 struct xfs_mount_args *args,
56 struct bhv_desc *next = bdp;
59 while (! (bhvtovfsops(next))->vfs_mount)
60 next = BHV_NEXT(next);
61 return ((*bhvtovfsops(next)->vfs_mount)(next, args, cr));
68 struct xfs_mount_args *args,
71 struct bhv_desc *next = bdp;
74 while (! (bhvtovfsops(next))->vfs_parseargs)
75 next = BHV_NEXT(next);
76 return ((*bhvtovfsops(next)->vfs_parseargs)(next, s, args, f));
84 struct bhv_desc *next = bdp;
87 while (! (bhvtovfsops(next))->vfs_showargs)
88 next = BHV_NEXT(next);
89 return ((*bhvtovfsops(next)->vfs_showargs)(next, m));
98 struct bhv_desc *next = bdp;
101 while (! (bhvtovfsops(next))->vfs_unmount)
102 next = BHV_NEXT(next);
103 return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
108 struct bhv_desc *bdp,
110 struct xfs_mount_args *args)
112 struct bhv_desc *next = bdp;
115 while (! (bhvtovfsops(next))->vfs_mntupdate)
116 next = BHV_NEXT(next);
117 return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args));
122 struct bhv_desc *bdp,
125 struct bhv_desc *next = bdp;
128 while (! (bhvtovfsops(next))->vfs_root)
129 next = BHV_NEXT(next);
130 return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
135 struct bhv_desc *bdp,
139 struct bhv_desc *next = bdp;
142 while (! (bhvtovfsops(next))->vfs_statvfs)
143 next = BHV_NEXT(next);
144 return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp));
149 struct bhv_desc *bdp,
153 struct bhv_desc *next = bdp;
156 while (! (bhvtovfsops(next))->vfs_sync)
157 next = BHV_NEXT(next);
158 return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
163 struct bhv_desc *bdp,
167 struct bhv_desc *next = bdp;
170 while (! (bhvtovfsops(next))->vfs_vget)
171 next = BHV_NEXT(next);
172 return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
177 struct bhv_desc *bdp,
180 struct bhv_desc *next = bdp;
183 while (! (bhvtovfsops(next))->vfs_dmapiops)
184 next = BHV_NEXT(next);
185 return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
190 struct bhv_desc *bdp,
195 struct bhv_desc *next = bdp;
198 while (! (bhvtovfsops(next))->vfs_quotactl)
199 next = BHV_NEXT(next);
200 return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
205 struct bhv_desc *bdp,
210 struct bhv_desc *next = bdp;
213 while (! (bhvtovfsops(next))->vfs_init_vnode)
214 next = BHV_NEXT(next);
215 ((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
220 struct bhv_desc *bdp,
225 struct bhv_desc *next = bdp;
228 while (! (bhvtovfsops(next))->vfs_force_shutdown)
229 next = BHV_NEXT(next);
230 ((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
235 struct bhv_desc *bdp)
237 struct bhv_desc *next = bdp;
240 while (! (bhvtovfsops(next))->vfs_freeze)
241 next = BHV_NEXT(next);
242 ((*bhvtovfsops(next)->vfs_freeze)(next));
250 vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
251 bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
252 INIT_LIST_HEAD(&vfsp->vfs_sync_list);
253 spin_lock_init(&vfsp->vfs_sync_lock);
254 init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
262 bhv_head_destroy(VFS_BHVHEAD(vfsp));
263 kmem_free(vfsp, sizeof(vfs_t));
269 struct bhv_vfsops *vfsops)
271 struct bhv_desc *bdp;
273 bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
274 bhv_desc_init(bdp, NULL, vfsp, vfsops);
275 bhv_insert(&vfsp->vfs_bh, bdp);
281 struct bhv_desc *bdp,
282 struct vfsops *vfsops,
285 bhv_desc_init(bdp, mount, vfsp, vfsops);
286 bhv_insert_initial(&vfsp->vfs_bh, bdp);
294 struct bhv_desc *bhv;
296 bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
299 bhv_remove(&vfsp->vfs_bh, bhv);
300 kmem_free(bhv, sizeof(*bhv));
304 bhv_remove_all_vfsops(
308 struct xfs_mount *mp;
310 bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
311 bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
314 mp = XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfsp), &xfs_vfsops));
315 VFS_REMOVEBHV(vfsp, &mp->m_bhv);
316 xfs_mount_free(mp, 0);
320 bhv_insert_all_vfsops(
323 struct xfs_mount *mp;
325 mp = xfs_mount_init();
326 vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
327 vfs_insertdmapi(vfsp);
328 vfs_insertquota(vfsp);