OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [xfs/] [linux/] [xfs_vfs.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
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
int
121
vfs_root(
122
        struct bhv_desc         *bdp,
123
        struct vnode            **vpp)
124
{
125
        struct bhv_desc         *next = bdp;
126
 
127
        ASSERT(next);
128
        while (! (bhvtovfsops(next))->vfs_root)
129
                next = BHV_NEXT(next);
130
        return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
131
}
132
 
133
int
134
vfs_statvfs(
135
        struct bhv_desc         *bdp,
136
        xfs_statfs_t            *sp,
137
        struct vnode            *vp)
138
{
139
        struct bhv_desc         *next = bdp;
140
 
141
        ASSERT(next);
142
        while (! (bhvtovfsops(next))->vfs_statvfs)
143
                next = BHV_NEXT(next);
144
        return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp));
145
}
146
 
147
int
148
vfs_sync(
149
        struct bhv_desc         *bdp,
150
        int                     fl,
151
        struct cred             *cr)
152
{
153
        struct bhv_desc         *next = bdp;
154
 
155
        ASSERT(next);
156
        while (! (bhvtovfsops(next))->vfs_sync)
157
                next = BHV_NEXT(next);
158
        return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
159
}
160
 
161
int
162
vfs_vget(
163
        struct bhv_desc         *bdp,
164
        struct vnode            **vpp,
165
        struct fid              *fidp)
166
{
167
        struct bhv_desc         *next = bdp;
168
 
169
        ASSERT(next);
170
        while (! (bhvtovfsops(next))->vfs_vget)
171
                next = BHV_NEXT(next);
172
        return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
173
}
174
 
175
int
176
vfs_dmapiops(
177
        struct bhv_desc         *bdp,
178
        caddr_t                 addr)
179
{
180
        struct bhv_desc         *next = bdp;
181
 
182
        ASSERT(next);
183
        while (! (bhvtovfsops(next))->vfs_dmapiops)
184
                next = BHV_NEXT(next);
185
        return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
186
}
187
 
188
int
189
vfs_quotactl(
190
        struct bhv_desc         *bdp,
191
        int                     cmd,
192
        int                     id,
193
        caddr_t                 addr)
194
{
195
        struct bhv_desc         *next = bdp;
196
 
197
        ASSERT(next);
198
        while (! (bhvtovfsops(next))->vfs_quotactl)
199
                next = BHV_NEXT(next);
200
        return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
201
}
202
 
203
struct inode *
204
vfs_get_inode(
205
        struct bhv_desc         *bdp,
206
        xfs_ino_t               ino,
207
        int                     fl)
208
{
209
        struct bhv_desc         *next = bdp;
210
 
211
        while (! (bhvtovfsops(next))->vfs_get_inode)
212
                next = BHV_NEXTNULL(next);
213
        return ((*bhvtovfsops(next)->vfs_get_inode)(next, ino, fl));
214
}
215
 
216
void
217
vfs_init_vnode(
218
        struct bhv_desc         *bdp,
219
        struct vnode            *vp,
220
        struct bhv_desc         *bp,
221
        int                     unlock)
222
{
223
        struct bhv_desc         *next = bdp;
224
 
225
        ASSERT(next);
226
        while (! (bhvtovfsops(next))->vfs_init_vnode)
227
                next = BHV_NEXT(next);
228
        ((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
229
}
230
 
231
void
232
vfs_force_shutdown(
233
        struct bhv_desc         *bdp,
234
        int                     fl,
235
        char                    *file,
236
        int                     line)
237
{
238
        struct bhv_desc         *next = bdp;
239
 
240
        ASSERT(next);
241
        while (! (bhvtovfsops(next))->vfs_force_shutdown)
242
                next = BHV_NEXT(next);
243
        ((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
244
}
245
 
246
vfs_t *
247
vfs_allocate( void )
248
{
249
        struct vfs              *vfsp;
250
 
251
        vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
252
        bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
253
        init_waitqueue_head(&vfsp->vfs_wait_sync_task);
254
        return vfsp;
255
}
256
 
257
void
258
vfs_deallocate(
259
        struct vfs              *vfsp)
260
{
261
        bhv_head_destroy(VFS_BHVHEAD(vfsp));
262
        kmem_free(vfsp, sizeof(vfs_t));
263
}
264
 
265
void
266
vfs_insertops(
267
        struct vfs              *vfsp,
268
        struct bhv_vfsops       *vfsops)
269
{
270
        struct bhv_desc         *bdp;
271
 
272
        bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
273
        bhv_desc_init(bdp, NULL, vfsp, vfsops);
274
        bhv_insert(&vfsp->vfs_bh, bdp);
275
}
276
 
277
void
278
vfs_insertbhv(
279
        struct vfs              *vfsp,
280
        struct bhv_desc         *bdp,
281
        struct vfsops           *vfsops,
282
        void                    *mount)
283
{
284
        bhv_desc_init(bdp, mount, vfsp, vfsops);
285
        bhv_insert_initial(&vfsp->vfs_bh, bdp);
286
}
287
 
288
void
289
bhv_remove_vfsops(
290
        struct vfs              *vfsp,
291
        int                     pos)
292
{
293
        struct bhv_desc         *bhv;
294
 
295
        bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
296
        if (!bhv)
297
                return;
298
        bhv_remove(&vfsp->vfs_bh, bhv);
299
        kmem_free(bhv, sizeof(*bhv));
300
}
301
 
302
void
303
bhv_remove_all_vfsops(
304
        struct vfs              *vfsp,
305
        int                     freebase)
306
{
307
        struct xfs_mount        *mp;
308
 
309
        bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
310
        bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
311
        if (!freebase)
312
                return;
313
        mp = XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfsp), &xfs_vfsops));
314
        VFS_REMOVEBHV(vfsp, &mp->m_bhv);
315
        xfs_mount_free(mp, 0);
316
}
317
 
318
void
319
bhv_insert_all_vfsops(
320
        struct vfs              *vfsp)
321
{
322
        struct xfs_mount        *mp;
323
 
324
        mp = xfs_mount_init();
325
        vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
326
        vfs_insertdmapi(vfsp);
327
        vfs_insertquota(vfsp);
328
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.