Deleted Added
full compact
null_vfsops.c (12595) null_vfsops.c (12769)
1/*
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software donated to Berkeley by
6 * Jan-Simon Pendry.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)null_vfsops.c 8.2 (Berkeley) 1/21/94
37 *
38 * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92
1/*
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software donated to Berkeley by
6 * Jan-Simon Pendry.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)null_vfsops.c 8.2 (Berkeley) 1/21/94
37 *
38 * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92
39 * $Id: null_vfsops.c,v 1.7 1995/05/30 08:07:01 rgrimes Exp $
39 * $Id: null_vfsops.c,v 1.8 1995/12/03 14:54:23 bde Exp $
40 */
41
42/*
43 * Null Layer
44 * (See null_vnops.c for a description of what this does.)
45 */
46
47#include <sys/param.h>

--- 4 unchanged lines hidden (view full) ---

52#include <sys/vnode.h>
53#include <sys/mount.h>
54#include <sys/namei.h>
55#include <sys/malloc.h>
56#include <miscfs/nullfs/null.h>
57
58extern int nullfs_init __P((void));
59
40 */
41
42/*
43 * Null Layer
44 * (See null_vnops.c for a description of what this does.)
45 */
46
47#include <sys/param.h>

--- 4 unchanged lines hidden (view full) ---

52#include <sys/vnode.h>
53#include <sys/mount.h>
54#include <sys/namei.h>
55#include <sys/malloc.h>
56#include <miscfs/nullfs/null.h>
57
58extern int nullfs_init __P((void));
59
60extern int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp,
60static int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp,
61 struct mbuf *nam, struct vnode **vpp,
62 int *exflagsp, struct ucred **credanonp));
61 struct mbuf *nam, struct vnode **vpp,
62 int *exflagsp, struct ucred **credanonp));
63extern int nullfs_mount __P((struct mount *mp, char *path, caddr_t data,
63static int nullfs_mount __P((struct mount *mp, char *path, caddr_t data,
64 struct nameidata *ndp, struct proc *p));
64 struct nameidata *ndp, struct proc *p));
65extern int nullfs_quotactl __P((struct mount *mp, int cmd, uid_t uid,
65static int nullfs_quotactl __P((struct mount *mp, int cmd, uid_t uid,
66 caddr_t arg, struct proc *p));
66 caddr_t arg, struct proc *p));
67extern int nullfs_root __P((struct mount *mp, struct vnode **vpp));
68extern int nullfs_start __P((struct mount *mp, int flags, struct proc *p));
69extern int nullfs_statfs __P((struct mount *mp, struct statfs *sbp,
67static int nullfs_root __P((struct mount *mp, struct vnode **vpp));
68static int nullfs_start __P((struct mount *mp, int flags, struct proc *p));
69static int nullfs_statfs __P((struct mount *mp, struct statfs *sbp,
70 struct proc *p));
70 struct proc *p));
71extern int nullfs_sync __P((struct mount *mp, int waitfor,
71static int nullfs_sync __P((struct mount *mp, int waitfor,
72 struct ucred *cred, struct proc *p));
72 struct ucred *cred, struct proc *p));
73extern int nullfs_unmount __P((struct mount *mp, int mntflags,
73static int nullfs_unmount __P((struct mount *mp, int mntflags,
74 struct proc *p));
74 struct proc *p));
75extern int nullfs_vget __P((struct mount *mp, ino_t ino,
75static int nullfs_vget __P((struct mount *mp, ino_t ino,
76 struct vnode **vpp));
76 struct vnode **vpp));
77extern int nullfs_vptofh __P((struct vnode *vp, struct fid *fhp));
77static int nullfs_vptofh __P((struct vnode *vp, struct fid *fhp));
78
79/*
80 * Mount null layer
81 */
78
79/*
80 * Mount null layer
81 */
82int
82static int
83nullfs_mount(mp, path, data, ndp, p)
84 struct mount *mp;
85 char *path;
86 caddr_t data;
87 struct nameidata *ndp;
88 struct proc *p;
89{
90 int error = 0;

--- 89 unchanged lines hidden (view full) ---

180 return (0);
181}
182
183/*
184 * VFS start. Nothing needed here - the start routine
185 * on the underlying filesystem will have been called
186 * when that filesystem was mounted.
187 */
83nullfs_mount(mp, path, data, ndp, p)
84 struct mount *mp;
85 char *path;
86 caddr_t data;
87 struct nameidata *ndp;
88 struct proc *p;
89{
90 int error = 0;

--- 89 unchanged lines hidden (view full) ---

180 return (0);
181}
182
183/*
184 * VFS start. Nothing needed here - the start routine
185 * on the underlying filesystem will have been called
186 * when that filesystem was mounted.
187 */
188int
188static int
189nullfs_start(mp, flags, p)
190 struct mount *mp;
191 int flags;
192 struct proc *p;
193{
194 return (0);
195 /* return VFS_START(MOUNTTONULLMOUNT(mp)->nullm_vfs, flags, p); */
196}
197
198/*
199 * Free reference to null layer
200 */
189nullfs_start(mp, flags, p)
190 struct mount *mp;
191 int flags;
192 struct proc *p;
193{
194 return (0);
195 /* return VFS_START(MOUNTTONULLMOUNT(mp)->nullm_vfs, flags, p); */
196}
197
198/*
199 * Free reference to null layer
200 */
201int
201static int
202nullfs_unmount(mp, mntflags, p)
203 struct mount *mp;
204 int mntflags;
205 struct proc *p;
206{
207 struct vnode *nullm_rootvp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
208 int error;
209 int flags = 0;

--- 39 unchanged lines hidden (view full) ---

249 /*
250 * Finally, throw away the null_mount structure
251 */
252 free(mp->mnt_data, M_UFSMNT); /* XXX */
253 mp->mnt_data = 0;
254 return 0;
255}
256
202nullfs_unmount(mp, mntflags, p)
203 struct mount *mp;
204 int mntflags;
205 struct proc *p;
206{
207 struct vnode *nullm_rootvp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
208 int error;
209 int flags = 0;

--- 39 unchanged lines hidden (view full) ---

249 /*
250 * Finally, throw away the null_mount structure
251 */
252 free(mp->mnt_data, M_UFSMNT); /* XXX */
253 mp->mnt_data = 0;
254 return 0;
255}
256
257int
257static int
258nullfs_root(mp, vpp)
259 struct mount *mp;
260 struct vnode **vpp;
261{
262 struct vnode *vp;
263
264#ifdef NULLFS_DIAGNOSTIC
265 printf("nullfs_root(mp = %x, vp = %x->%x)\n", mp,

--- 7 unchanged lines hidden (view full) ---

273 */
274 vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
275 VREF(vp);
276 VOP_LOCK(vp);
277 *vpp = vp;
278 return 0;
279}
280
258nullfs_root(mp, vpp)
259 struct mount *mp;
260 struct vnode **vpp;
261{
262 struct vnode *vp;
263
264#ifdef NULLFS_DIAGNOSTIC
265 printf("nullfs_root(mp = %x, vp = %x->%x)\n", mp,

--- 7 unchanged lines hidden (view full) ---

273 */
274 vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
275 VREF(vp);
276 VOP_LOCK(vp);
277 *vpp = vp;
278 return 0;
279}
280
281int
281static int
282nullfs_quotactl(mp, cmd, uid, arg, p)
283 struct mount *mp;
284 int cmd;
285 uid_t uid;
286 caddr_t arg;
287 struct proc *p;
288{
289 return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg, p);
290}
291
282nullfs_quotactl(mp, cmd, uid, arg, p)
283 struct mount *mp;
284 int cmd;
285 uid_t uid;
286 caddr_t arg;
287 struct proc *p;
288{
289 return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg, p);
290}
291
292int
292static int
293nullfs_statfs(mp, sbp, p)
294 struct mount *mp;
295 struct statfs *sbp;
296 struct proc *p;
297{
298 int error;
299 struct statfs mstat;
300

--- 23 unchanged lines hidden (view full) ---

324 if (sbp != &mp->mnt_stat) {
325 bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid));
326 bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
327 bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
328 }
329 return (0);
330}
331
293nullfs_statfs(mp, sbp, p)
294 struct mount *mp;
295 struct statfs *sbp;
296 struct proc *p;
297{
298 int error;
299 struct statfs mstat;
300

--- 23 unchanged lines hidden (view full) ---

324 if (sbp != &mp->mnt_stat) {
325 bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid));
326 bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
327 bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
328 }
329 return (0);
330}
331
332int
332static int
333nullfs_sync(mp, waitfor, cred, p)
334 struct mount *mp;
335 int waitfor;
336 struct ucred *cred;
337 struct proc *p;
338{
339 /*
340 * XXX - Assumes no data cached at null layer.
341 */
342 return (0);
343}
344
333nullfs_sync(mp, waitfor, cred, p)
334 struct mount *mp;
335 int waitfor;
336 struct ucred *cred;
337 struct proc *p;
338{
339 /*
340 * XXX - Assumes no data cached at null layer.
341 */
342 return (0);
343}
344
345int
345static int
346nullfs_vget(mp, ino, vpp)
347 struct mount *mp;
348 ino_t ino;
349 struct vnode **vpp;
350{
351
352 return VFS_VGET(MOUNTTONULLMOUNT(mp)->nullm_vfs, ino, vpp);
353}
354
346nullfs_vget(mp, ino, vpp)
347 struct mount *mp;
348 ino_t ino;
349 struct vnode **vpp;
350{
351
352 return VFS_VGET(MOUNTTONULLMOUNT(mp)->nullm_vfs, ino, vpp);
353}
354
355int
355static int
356nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
357 struct mount *mp;
358 struct fid *fidp;
359 struct mbuf *nam;
360 struct vnode **vpp;
361 int *exflagsp;
362 struct ucred**credanonp;
363{
364
365 return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam, vpp, exflagsp,credanonp);
366}
367
356nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
357 struct mount *mp;
358 struct fid *fidp;
359 struct mbuf *nam;
360 struct vnode **vpp;
361 int *exflagsp;
362 struct ucred**credanonp;
363{
364
365 return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam, vpp, exflagsp,credanonp);
366}
367
368int
368static int
369nullfs_vptofh(vp, fhp)
370 struct vnode *vp;
371 struct fid *fhp;
372{
373 return VFS_VPTOFH(NULLVPTOLOWERVP(vp), fhp);
374}
375
369nullfs_vptofh(vp, fhp)
370 struct vnode *vp;
371 struct fid *fhp;
372{
373 return VFS_VPTOFH(NULLVPTOLOWERVP(vp), fhp);
374}
375
376struct vfsops null_vfsops = {
376static struct vfsops null_vfsops = {
377 nullfs_mount,
378 nullfs_start,
379 nullfs_unmount,
380 nullfs_root,
381 nullfs_quotactl,
382 nullfs_statfs,
383 nullfs_sync,
384 nullfs_vget,
385 nullfs_fhtovp,
386 nullfs_vptofh,
387 nullfs_init,
388};
389
390VFS_SET(null_vfsops, null, MOUNT_NULL, VFCF_LOOPBACK);
377 nullfs_mount,
378 nullfs_start,
379 nullfs_unmount,
380 nullfs_root,
381 nullfs_quotactl,
382 nullfs_statfs,
383 nullfs_sync,
384 nullfs_vget,
385 nullfs_fhtovp,
386 nullfs_vptofh,
387 nullfs_init,
388};
389
390VFS_SET(null_vfsops, null, MOUNT_NULL, VFCF_LOOPBACK);