Copyright (c) 1996 Doug Rabson All rights reserved. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in...
NAMEVOP_LOCK VOP_UNLOCK VOP_ISLOCKED vn_lock - serialize access to a vnode
SYNOPSISIn sys/param.h In sys/lock.h In sys/vnode.h Ft int Fn VOP_LOCK struct vnode *vp int flags Ft int Fn VOP_UNLOCK struct vnode *vp int flags Ft int Fn VOP_ISLOCKED struct vnode *vp Ft int Fn vn_lock struct vnode *vp int flags
DESCRIPTIONThese calls are used to serialize access to the file system, such as to prevent two writes to the same file from happening at the same time.
The arguments are:
- Fa vp
- The vnode being locked or unlocked.
- Fa flags
One of the lock request types:
- Shared lock.
- Exclusive lock.
- Shared-to-exclusive upgrade.
- Exclusive-to-shared downgrade.
- Release any type of lock.
- Wait for all lock activity to end.
The lock type may be or 'ed with these lock flags:
- Do not sleep to wait for lock.
- Sleep, then return failure.
- Allow recursive exclusive lock.
- Instruct witness(4) to ignore this instance.
The lock type may be or 'ed with these control flags:
- Specify when the caller already has a simple lock Po Fn VOP_LOCK will unlock the simple lock after getting the lock Pc .
- Retry until locked.
Kernel code should use Fn vn_lock to lock a vnode rather than calling Fn VOP_LOCK directly. Fn vn_lock also does not want a thread specified as argument but it assumes curthread to be used.