Deleted Added
full compact
null_vnops.c (65464) null_vnops.c (65467)
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 * $FreeBSD: head/sys/fs/nullfs/null_vnops.c 65464 2000-09-05 07:54:39Z bp $
41 * ...and...
42 * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
43 *
40 * ...and...
41 * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
42 *
44 * $FreeBSD: head/sys/fs/nullfs/null_vnops.c 65464 2000-09-05 07:54:39Z bp $
43 * $FreeBSD: head/sys/fs/nullfs/null_vnops.c 65467 2000-09-05 09:02:07Z bp $
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

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

188SYSCTL_INT(_debug, OID_AUTO, nullfs_bug_bypass, CTLFLAG_RW,
189 &null_bug_bypass, 0, "");
190
191static int null_access(struct vop_access_args *ap);
192static int null_getattr(struct vop_getattr_args *ap);
193static int null_inactive(struct vop_inactive_args *ap);
194static int null_lock(struct vop_lock_args *ap);
195static int null_lookup(struct vop_lookup_args *ap);
44 */
45
46/*
47 * Null Layer
48 *
49 * (See mount_null(8) for more information.)
50 *
51 * The null layer duplicates a portion of the file system

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

187SYSCTL_INT(_debug, OID_AUTO, nullfs_bug_bypass, CTLFLAG_RW,
188 &null_bug_bypass, 0, "");
189
190static int null_access(struct vop_access_args *ap);
191static int null_getattr(struct vop_getattr_args *ap);
192static int null_inactive(struct vop_inactive_args *ap);
193static int null_lock(struct vop_lock_args *ap);
194static int null_lookup(struct vop_lookup_args *ap);
195static int null_open(struct vop_open_args *ap);
196static int null_print(struct vop_print_args *ap);
197static int null_reclaim(struct vop_reclaim_args *ap);
196static int null_print(struct vop_print_args *ap);
197static int null_reclaim(struct vop_reclaim_args *ap);
198static int null_rename(struct vop_rename_args *ap);
198static int null_setattr(struct vop_setattr_args *ap);
199static int null_unlock(struct vop_unlock_args *ap);
200
201/*
202 * This is the 10-Apr-92 bypass routine.
203 * This version has been optimized for speed, throwing away some
204 * safety checks. It should still always work, but it's not as
205 * robust to programmer errors.

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

443 struct ucred *a_cred;
444 struct proc *a_p;
445 } */ *ap;
446{
447 int error;
448
449 if ((error = null_bypass((struct vop_generic_args *)ap)) != 0)
450 return (error);
199static int null_setattr(struct vop_setattr_args *ap);
200static int null_unlock(struct vop_unlock_args *ap);
201
202/*
203 * This is the 10-Apr-92 bypass routine.
204 * This version has been optimized for speed, throwing away some
205 * safety checks. It should still always work, but it's not as
206 * robust to programmer errors.

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

444 struct ucred *a_cred;
445 struct proc *a_p;
446 } */ *ap;
447{
448 int error;
449
450 if ((error = null_bypass((struct vop_generic_args *)ap)) != 0)
451 return (error);
452
453 ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
451 return (0);
452}
453
454static int
455null_access(ap)
456 struct vop_access_args /* {
457 struct vnode *a_vp;
458 int a_mode;

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

479 default:
480 break;
481 }
482 }
483 return (null_bypass((struct vop_generic_args *)ap));
484}
485
486/*
454 return (0);
455}
456
457static int
458null_access(ap)
459 struct vop_access_args /* {
460 struct vnode *a_vp;
461 int a_mode;

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

482 default:
483 break;
484 }
485 }
486 return (null_bypass((struct vop_generic_args *)ap));
487}
488
489/*
490 * We must handle open to be able to catch MNT_NODEV and friends.
491 */
492static int
493null_open(ap)
494 struct vop_open_args /* {
495 struct vnode *a_vp;
496 int a_mode;
497 struct ucred *a_cred;
498 struct proc *a_p;
499 } */ *ap;
500{
501 struct vnode *vp = ap->a_vp;
502 struct vnode *lvp = NULLVPTOLOWERVP(ap->a_vp);
503
504 if ((vp->v_mount->mnt_flag & MNT_NODEV) &&
505 (lvp->v_type == VBLK || lvp->v_type == VCHR))
506 return ENXIO;
507
508 return (null_bypass((struct vop_generic_args *)ap));
509}
510
511/*
512 * We handle this to eliminate null FS to lower FS
513 * file moving. Don't know why we don't allow this,
514 * possibly we should.
515 */
516static int
517null_rename(ap)
518 struct vop_rename_args /* {
519 struct vnode *a_fdvp;
520 struct vnode *a_fvp;
521 struct componentname *a_fcnp;
522 struct vnode *a_tdvp;
523 struct vnode *a_tvp;
524 struct componentname *a_tcnp;
525 } */ *ap;
526{
527 struct vnode *tdvp = ap->a_tdvp;
528 struct vnode *fvp = ap->a_fvp;
529 struct vnode *fdvp = ap->a_fdvp;
530 struct vnode *tvp = ap->a_tvp;
531
532 /* Check for cross-device rename. */
533 if ((fvp->v_mount != tdvp->v_mount) ||
534 (tvp && (fvp->v_mount != tvp->v_mount))) {
535 if (tdvp == tvp)
536 vrele(tdvp);
537 else
538 vput(tdvp);
539 if (tvp)
540 vput(tvp);
541 vrele(fdvp);
542 vrele(fvp);
543 return (EXDEV);
544 }
545
546 return (null_bypass((struct vop_generic_args *)ap));
547}
548
549/*
487 * We need to process our own vnode lock and then clear the
488 * interlock flag as it applies only to our vnode, not the
489 * vnodes below us on the stack.
490 */
491static int
492null_lock(ap)
493 struct vop_lock_args /* {
494 struct vnode *a_vp;

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

563 struct vnode *lowervp = xp->null_lowervp;
564
565 /*
566 * Note: in vop_reclaim, vp->v_op == dead_vnodeop_p,
567 * so we can't call VOPs on ourself.
568 */
569 /* After this assignment, this node will not be re-used. */
570 xp->null_lowervp = NULLVP;
550 * We need to process our own vnode lock and then clear the
551 * interlock flag as it applies only to our vnode, not the
552 * vnodes below us on the stack.
553 */
554static int
555null_lock(ap)
556 struct vop_lock_args /* {
557 struct vnode *a_vp;

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

626 struct vnode *lowervp = xp->null_lowervp;
627
628 /*
629 * Note: in vop_reclaim, vp->v_op == dead_vnodeop_p,
630 * so we can't call VOPs on ourself.
631 */
632 /* After this assignment, this node will not be re-used. */
633 xp->null_lowervp = NULLVP;
634 lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, ap->a_p);
571 LIST_REMOVE(xp, null_hash);
635 LIST_REMOVE(xp, null_hash);
636 lockmgr(&null_hashlock, LK_RELEASE, NULL, ap->a_p);
572 FREE(vp->v_data, M_TEMP);
573 vp->v_data = NULL;
574 vrele (lowervp);
575 return (0);
576}
577
578static int
579null_print(ap)

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

588
589/*
590 * Global vfs data structures
591 */
592vop_t **null_vnodeop_p;
593static struct vnodeopv_entry_desc null_vnodeop_entries[] = {
594 { &vop_default_desc, (vop_t *) null_bypass },
595 { &vop_access_desc, (vop_t *) null_access },
637 FREE(vp->v_data, M_TEMP);
638 vp->v_data = NULL;
639 vrele (lowervp);
640 return (0);
641}
642
643static int
644null_print(ap)

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

653
654/*
655 * Global vfs data structures
656 */
657vop_t **null_vnodeop_p;
658static struct vnodeopv_entry_desc null_vnodeop_entries[] = {
659 { &vop_default_desc, (vop_t *) null_bypass },
660 { &vop_access_desc, (vop_t *) null_access },
661 { &vop_bmap_desc, (vop_t *) vop_eopnotsupp },
596 { &vop_getattr_desc, (vop_t *) null_getattr },
662 { &vop_getattr_desc, (vop_t *) null_getattr },
663 { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount},
597 { &vop_inactive_desc, (vop_t *) null_inactive },
598 { &vop_lock_desc, (vop_t *) null_lock },
599 { &vop_lookup_desc, (vop_t *) null_lookup },
664 { &vop_inactive_desc, (vop_t *) null_inactive },
665 { &vop_lock_desc, (vop_t *) null_lock },
666 { &vop_lookup_desc, (vop_t *) null_lookup },
667 { &vop_open_desc, (vop_t *) null_open },
600 { &vop_print_desc, (vop_t *) null_print },
601 { &vop_reclaim_desc, (vop_t *) null_reclaim },
668 { &vop_print_desc, (vop_t *) null_print },
669 { &vop_reclaim_desc, (vop_t *) null_reclaim },
670 { &vop_rename_desc, (vop_t *) null_rename },
602 { &vop_setattr_desc, (vop_t *) null_setattr },
671 { &vop_setattr_desc, (vop_t *) null_setattr },
672 { &vop_strategy_desc, (vop_t *) vop_eopnotsupp },
603 { &vop_unlock_desc, (vop_t *) null_unlock },
604 { NULL, NULL }
605};
606static struct vnodeopv_desc null_vnodeop_opv_desc =
607 { &null_vnodeop_p, null_vnodeop_entries };
608
609VNODEOP_SET(null_vnodeop_opv_desc);
673 { &vop_unlock_desc, (vop_t *) null_unlock },
674 { NULL, NULL }
675};
676static struct vnodeopv_desc null_vnodeop_opv_desc =
677 { &null_vnodeop_p, null_vnodeop_entries };
678
679VNODEOP_SET(null_vnodeop_opv_desc);