Deleted Added
full compact
null_vnops.c (22597) null_vnops.c (22607)
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 contributed to Berkeley by
6 * John Heidemann of the UCLA Ficus project.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

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_vnops.c 8.6 (Berkeley) 5/27/95
37 *
38 * Ancestors:
39 * @(#)lofs_vnops.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 contributed to Berkeley by
6 * John Heidemann of the UCLA Ficus project.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

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_vnops.c 8.6 (Berkeley) 5/27/95
37 *
38 * Ancestors:
39 * @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92
40 * $Id: null_vnops.c,v 1.13 1997/02/10 02:13:30 dyson Exp $
40 * $Id: null_vnops.c,v 1.14 1997/02/12 14:55:01 mpp Exp $
41 * ...and...
42 * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
43 *
41 * ...and...
42 * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
43 *
44 * $FreeBSD: head/sys/fs/nullfs/null_vnops.c 22597 1997-02-12 14:55:01Z mpp $
44 * $FreeBSD: head/sys/fs/nullfs/null_vnops.c 22607 1997-02-12 18:06:08Z mpp $
45 */
46
47/*
48 * Null Layer
49 *
50 * (See mount_null(8) for more information.)
51 *
52 * The null layer duplicates a portion of the file system

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

356 struct vop_lock_args lockargs;
357 struct vop_unlock_args unlockargs;
358 struct vnode *dvp, *vp;
359 int error;
360
361 if ((flags & ISLASTCN) && (ap->a_dvp->v_mount->mnt_flag & MNT_RDONLY) &&
362 (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
363 return (EROFS);
45 */
46
47/*
48 * Null Layer
49 *
50 * (See mount_null(8) for more information.)
51 *
52 * The null layer duplicates a portion of the file system

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

356 struct vop_lock_args lockargs;
357 struct vop_unlock_args unlockargs;
358 struct vnode *dvp, *vp;
359 int error;
360
361 if ((flags & ISLASTCN) && (ap->a_dvp->v_mount->mnt_flag & MNT_RDONLY) &&
362 (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
363 return (EROFS);
364 error = null_bypass(ap);
364 error = null_bypass((struct vop_generic_args *)ap);
365 if (error == EJUSTRETURN && (flags & ISLASTCN) &&
366 (ap->a_dvp->v_mount->mnt_flag & MNT_RDONLY) &&
367 (cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME))
368 error = EROFS;
369 /*
370 * We must do the same locking and unlocking at this layer as
371 * is done in the layers below us. We could figure this out
372 * based on the error return and the LASTCN, LOCKPARENT, and

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

429 /*
430 * Disallow write attempts if the filesystem is
431 * mounted read-only.
432 */
433 if (vp->v_mount->mnt_flag & MNT_RDONLY)
434 return (EROFS);
435 }
436 }
365 if (error == EJUSTRETURN && (flags & ISLASTCN) &&
366 (ap->a_dvp->v_mount->mnt_flag & MNT_RDONLY) &&
367 (cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME))
368 error = EROFS;
369 /*
370 * We must do the same locking and unlocking at this layer as
371 * is done in the layers below us. We could figure this out
372 * based on the error return and the LASTCN, LOCKPARENT, and

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

429 /*
430 * Disallow write attempts if the filesystem is
431 * mounted read-only.
432 */
433 if (vp->v_mount->mnt_flag & MNT_RDONLY)
434 return (EROFS);
435 }
436 }
437 return (null_bypass(ap));
437 return (null_bypass((struct vop_generic_args *)ap));
438}
439
440/*
441 * We handle getattr only to change the fsid.
442 */
443static int
444null_getattr(ap)
445 struct vop_getattr_args /* {
446 struct vnode *a_vp;
447 struct vattr *a_vap;
448 struct ucred *a_cred;
449 struct proc *a_p;
450 } */ *ap;
451{
452 int error;
453
438}
439
440/*
441 * We handle getattr only to change the fsid.
442 */
443static int
444null_getattr(ap)
445 struct vop_getattr_args /* {
446 struct vnode *a_vp;
447 struct vattr *a_vap;
448 struct ucred *a_cred;
449 struct proc *a_p;
450 } */ *ap;
451{
452 int error;
453
454 if (error = null_bypass(ap))
454 if (error = null_bypass((struct vop_generic_args *)ap))
455 return (error);
456 /* Requires that arguments be restored. */
457 ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
458 return (0);
459}
460
461static int
462null_access(ap)

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

480 case VDIR:
481 case VLNK:
482 case VREG:
483 if (vp->v_mount->mnt_flag & MNT_RDONLY)
484 return (EROFS);
485 break;
486 }
487 }
455 return (error);
456 /* Requires that arguments be restored. */
457 ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
458 return (0);
459}
460
461static int
462null_access(ap)

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

480 case VDIR:
481 case VLNK:
482 case VREG:
483 if (vp->v_mount->mnt_flag & MNT_RDONLY)
484 return (EROFS);
485 break;
486 }
487 }
488 return (null_bypass(ap));
488 return (null_bypass((struct vop_generic_args *)ap));
489}
490
491/*
492 * We need to process our own vnode lock and then clear the
493 * interlock flag as it applies only to our vnode, not the
494 * vnodes below us on the stack.
495 */
496static int

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

501 struct proc *a_p;
502 } */ *ap;
503{
504
505 vop_nolock(ap);
506 if ((ap->a_flags & LK_TYPE_MASK) == LK_DRAIN)
507 return (0);
508 ap->a_flags &= ~LK_INTERLOCK;
489}
490
491/*
492 * We need to process our own vnode lock and then clear the
493 * interlock flag as it applies only to our vnode, not the
494 * vnodes below us on the stack.
495 */
496static int

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

501 struct proc *a_p;
502 } */ *ap;
503{
504
505 vop_nolock(ap);
506 if ((ap->a_flags & LK_TYPE_MASK) == LK_DRAIN)
507 return (0);
508 ap->a_flags &= ~LK_INTERLOCK;
509 return (null_bypass(ap));
509 return (null_bypass((struct vop_generic_args *)ap));
510}
511
512/*
513 * We need to process our own vnode unlock and then clear the
514 * interlock flag as it applies only to our vnode, not the
515 * vnodes below us on the stack.
516 */
517static int
518null_unlock(ap)
519 struct vop_unlock_args /* {
520 struct vnode *a_vp;
521 int a_flags;
522 struct proc *a_p;
523 } */ *ap;
524{
525 struct vnode *vp = ap->a_vp;
526
527 vop_nounlock(ap);
528 ap->a_flags &= ~LK_INTERLOCK;
510}
511
512/*
513 * We need to process our own vnode unlock and then clear the
514 * interlock flag as it applies only to our vnode, not the
515 * vnodes below us on the stack.
516 */
517static int
518null_unlock(ap)
519 struct vop_unlock_args /* {
520 struct vnode *a_vp;
521 int a_flags;
522 struct proc *a_p;
523 } */ *ap;
524{
525 struct vnode *vp = ap->a_vp;
526
527 vop_nounlock(ap);
528 ap->a_flags &= ~LK_INTERLOCK;
529 return (null_bypass(ap));
529 return (null_bypass((struct vop_generic_args *)ap));
530}
531
532static int
533null_inactive(ap)
534 struct vop_inactive_args /* {
535 struct vnode *a_vp;
536 struct proc *a_p;
537 } */ *ap;

--- 128 unchanged lines hidden ---
530}
531
532static int
533null_inactive(ap)
534 struct vop_inactive_args /* {
535 struct vnode *a_vp;
536 struct proc *a_p;
537 } */ *ap;

--- 128 unchanged lines hidden ---