* Variants of the above set. * * Differences are: * - shared locking disablement is not supported * - v_vnlock pointer is not honored */
(ap)
| 564 | * - v_vnlock pointer is not honored |
| 565 | */ |
| 566 | int |
| 567 | vop_lock(ap) |
| 568 | struct vop_lock1_args /* { |
| 569 | struct vnode *a_vp; |
| 570 | int a_flags; |
| 571 | char *file; |
| 572 | int line; |
| 573 | } */ *ap; |
| 574 | { |
| 575 | struct vnode *vp = ap->a_vp; |
| 576 | int flags = ap->a_flags; |
| 577 | struct mtx *ilk; |
| 578 | |
| 579 | MPASS(vp->v_vnlock == &vp->v_lock); |
| 580 | |
| 581 | if (__predict_false((flags & ~(LK_TYPE_MASK | LK_NODDLKTREAT | LK_RETRY)) != 0)) |
| 582 | goto other; |
| 583 | |
| 584 | switch (flags & LK_TYPE_MASK) { |
| 585 | case LK_SHARED: |
| 586 | return (lockmgr_slock(&vp->v_lock, flags, ap->a_file, ap->a_line)); |
| 587 | case LK_EXCLUSIVE: |
| 588 | return (lockmgr_xlock(&vp->v_lock, flags, ap->a_file, ap->a_line)); |
| 589 | } |
| 590 | other: |
| 591 | ilk = VI_MTX(vp); |
| 592 | return (lockmgr_lock_flags(&vp->v_lock, flags, |
| 593 | &ilk->lock_object, ap->a_file, ap->a_line)); |
| 594 | } |
| 595 | |
| 596 | int |
| 597 | vop_unlock(ap) |
nothing calls this directly
no test coverage detected