MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vop_lock

Function vop_lock

freebsd/kern/vfs_default.c:566–594  ·  view source on GitHub ↗

* Variants of the above set. * * Differences are: * - shared locking disablement is not supported * - v_vnlock pointer is not honored */

(ap)

Source from the content-addressed store, hash-verified

564 * - v_vnlock pointer is not honored
565 */
566int
567vop_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 }
590other:
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
596int
597vop_unlock(ap)

Callers

nothing calls this directly

Calls 3

lockmgr_slockFunction · 0.85
lockmgr_xlockFunction · 0.85
lockmgr_lock_flagsFunction · 0.85

Tested by

no test coverage detected