~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/xfs/linux/xfs_vfs.c

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
  3  *
  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.
  7  *
  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.
 11  *
 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.
 18  *
 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.
 22  *
 23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 24  * Mountain View, CA  94043, or:
 25  *
 26  * http://www.sgi.com
 27  *
 28  * For further information regarding this notice, see:
 29  *
 30  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 31  */
 32 
 33 #include "xfs.h"
 34 #include "xfs_fs.h"
 35 #include "xfs_macros.h"
 36 #include "xfs_inum.h"
 37 #include "xfs_log.h"
 38 #include "xfs_clnt.h"
 39 #include "xfs_trans.h"
 40 #include "xfs_sb.h"
 41 #include "xfs_ag.h"
 42 #include "xfs_dir.h"
 43 #include "xfs_dir2.h"
 44 #include "xfs_imap.h"
 45 #include "xfs_alloc.h"
 46 #include "xfs_dmapi.h"
 47 #include "xfs_mount.h"
 48 #include "xfs_quota.h"
 49 
 50 int
 51 vfs_mount(
 52         struct bhv_desc         *bdp,
 53         struct xfs_mount_args   *args,
 54         struct cred             *cr)
 55 {
 56         struct bhv_desc         *next = bdp;
 57 
 58         ASSERT(next);
 59         while (! (bhvtovfsops(next))->vfs_mount)
 60                 next = BHV_NEXT(next);
 61         return ((*bhvtovfsops(next)->vfs_mount)(next, args, cr));
 62 }
 63 
 64 int
 65 vfs_parseargs(
 66         struct bhv_desc         *bdp,
 67         char                    *s,
 68         struct xfs_mount_args   *args,
 69         int                     f)
 70 {
 71         struct bhv_desc         *next = bdp;
 72 
 73         ASSERT(next);
 74         while (! (bhvtovfsops(next))->vfs_parseargs)
 75                 next = BHV_NEXT(next);
 76         return ((*bhvtovfsops(next)->vfs_parseargs)(next, s, args, f));
 77 }
 78 
 79 int
 80 vfs_showargs(
 81         struct bhv_desc         *bdp,
 82         struct seq_file         *m)
 83 {
 84         struct bhv_desc         *next = bdp;
 85 
 86         ASSERT(next);
 87         while (! (bhvtovfsops(next))->vfs_showargs)
 88                 next = BHV_NEXT(next);
 89         return ((*bhvtovfsops(next)->vfs_showargs)(next, m));
 90 }
 91 
 92 int
 93 vfs_unmount(
 94         struct bhv_desc         *bdp,
 95         int                     fl,
 96         struct cred             *cr)
 97 {
 98         struct bhv_desc         *next = bdp;
 99 
100         ASSERT(next);
101         while (! (bhvtovfsops(next))->vfs_unmount)
102                 next = BHV_NEXT(next);
103         return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
104 }
105 
106 int
107 vfs_mntupdate(
108         struct bhv_desc         *bdp,
109         int                     *fl,
110         struct xfs_mount_args   *args)
111 {
112         struct bhv_desc         *next = bdp;
113 
114         ASSERT(next);
115         while (! (bhvtovfsops(next))->vfs_mntupdate)
116                 next = BHV_NEXT(next);
117         return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args));
118 }
119 
120 
121 int
122 vfs_root(
123         struct bhv_desc         *bdp,
124         struct vnode            **vpp)
125 {
126         struct bhv_desc         *next = bdp;
127 
128         ASSERT(next);
129         while (! (bhvtovfsops(next))->vfs_root)
130                 next = BHV_NEXT(next);
131         return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
132 }
133 
134 int
135 vfs_statvfs(
136         struct bhv_desc         *bdp,
137         struct kstatfs          *sp,
138         struct vnode            *vp)
139 {
140         struct bhv_desc         *next = bdp;
141 
142         ASSERT(next);
143         while (! (bhvtovfsops(next))->vfs_statvfs)
144                 next = BHV_NEXT(next);
145         return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp));
146 }
147 
148 int
149 vfs_sync(
150         struct bhv_desc         *bdp,
151         int                     fl,
152         struct cred             *cr)
153 {
154         struct bhv_desc         *next = bdp;
155 
156         ASSERT(next);
157         while (! (bhvtovfsops(next))->vfs_sync)
158                 next = BHV_NEXT(next);
159         return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
160 }
161 
162 int
163 vfs_vget(
164         struct bhv_desc         *bdp,
165         struct vnode            **vpp,
166         struct fid              *fidp)
167 {
168         struct bhv_desc         *next = bdp;
169 
170         ASSERT(next);
171         while (! (bhvtovfsops(next))->vfs_vget)
172                 next = BHV_NEXT(next);
173         return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
174 }
175 
176 int
177 vfs_dmapiops(
178         struct bhv_desc         *bdp,
179         caddr_t                 addr)
180 {
181         struct bhv_desc         *next = bdp;
182 
183         ASSERT(next);
184         while (! (bhvtovfsops(next))->vfs_dmapiops)
185                 next = BHV_NEXT(next);
186         return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
187 }
188 
189 int
190 vfs_quotactl(
191         struct bhv_desc         *bdp,
192         int                     cmd,
193         int                     id,
194         caddr_t                 addr)
195 {
196         struct bhv_desc         *next = bdp;
197 
198         ASSERT(next);
199         while (! (bhvtovfsops(next))->vfs_quotactl)
200                 next = BHV_NEXT(next);
201         return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
202 }
203 
204 void
205 vfs_init_vnode(
206         struct bhv_desc         *bdp,
207         struct vnode            *vp,
208         struct bhv_desc         *bp,
209         int                     unlock)
210 {
211         struct bhv_desc         *next = bdp;
212 
213         ASSERT(next);
214         while (! (bhvtovfsops(next))->vfs_init_vnode)
215                 next = BHV_NEXT(next);
216         ((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
217 }
218 
219 void
220 vfs_force_shutdown(
221         struct bhv_desc         *bdp,
222         int                     fl,
223         char                    *file,
224         int                     line)
225 {
226         struct bhv_desc         *next = bdp;
227 
228         ASSERT(next);
229         while (! (bhvtovfsops(next))->vfs_force_shutdown)
230                 next = BHV_NEXT(next);
231         ((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
232 }
233 
234 vfs_t *
235 vfs_allocate( void )
236 {
237         struct vfs              *vfsp;
238 
239         vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
240         bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
241         init_waitqueue_head(&vfsp->vfs_wait_sync_task);
242         return vfsp;
243 }
244 
245 void
246 vfs_deallocate(
247         struct vfs              *vfsp)
248 {
249         bhv_head_destroy(VFS_BHVHEAD(vfsp));
250         kmem_free(vfsp, sizeof(vfs_t));
251 }
252 
253 void
254 vfs_insertops(
255         struct vfs              *vfsp,
256         struct bhv_vfsops       *vfsops)
257 {
258         struct bhv_desc         *bdp;
259 
260         bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
261         bhv_desc_init(bdp, NULL, vfsp, vfsops);
262         bhv_insert(&vfsp->vfs_bh, bdp);
263 }
264 
265 void
266 vfs_insertbhv(
267         struct vfs              *vfsp,
268         struct bhv_desc         *bdp,
269         struct vfsops           *vfsops,
270         void                    *mount)
271 {
272         bhv_desc_init(bdp, mount, vfsp, vfsops);
273         bhv_insert_initial(&vfsp->vfs_bh, bdp);
274 }
275 
276 void
277 bhv_remove_vfsops(
278         struct vfs              *vfsp,
279         int                     pos)
280 {
281         struct bhv_desc         *bhv;
282 
283         bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
284         if (!bhv)
285                 return;
286         bhv_remove(&vfsp->vfs_bh, bhv);
287         kmem_free(bhv, sizeof(*bhv));
288 }
289 
290 void
291 bhv_remove_all_vfsops(
292         struct vfs              *vfsp,
293         int                     freebase)
294 {
295         struct xfs_mount        *mp;
296 
297         bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
298         bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
299         if (!freebase)
300                 return;
301         mp = XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfsp), &xfs_vfsops));
302         VFS_REMOVEBHV(vfsp, &mp->m_bhv);
303         xfs_mount_free(mp, 0);
304 }
305 
306 void
307 bhv_insert_all_vfsops(
308         struct vfs              *vfsp)
309 {
310         struct xfs_mount        *mp;
311 
312         mp = xfs_mount_init();
313         vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
314         vfs_insertdmapi(vfsp);
315         vfs_insertquota(vfsp);
316 }
317 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp