diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2020-01-03 22:10:11 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2020-01-03 22:10:11 +0000 |
commit | 3d59b89c7a880c913c99df656246e1a9c82adf95 (patch) | |
tree | 944ad5abcf3131106e9f4a9831cbb4b662275455 /sys | |
parent | 36afd1d2cbec38529fd4a32516ca7e4718ce701f (diff) |
vfs: add VOP_UNLOCK_FLAGS
The flags argument from VOP_UNLOCK is about to be removed and some
filesystems unlock the interlock as a convienience with it.
Add a helper to retain the behavior for the few cases it is needed.
Notes
Notes:
svn path=/head/; revision=356335
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/vnode.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index db1be2b93778..1a00115a06aa 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -955,6 +955,21 @@ int vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, void vn_fsid(struct vnode *vp, struct vattr *va); +#define VOP_UNLOCK_FLAGS(vp, flags) ({ \ + struct vnode *_vp = (vp); \ + int _flags = (flags); \ + int _error; \ + \ + CTASSERT(__builtin_constant_p(flags) ? \ + (flags & ~(LK_INTERLOCK | LK_RELEASE)) == 0 : 1); \ + if ((_flags & ~(LK_INTERLOCK | LK_RELEASE)) != 0) \ + panic("%s: unsupported flags %x\n", __func__, flags); \ + _error = VOP_UNLOCK(_vp, 0); \ + if (_flags & LK_INTERLOCK) \ + VI_UNLOCK(_vp); \ + _error; \ +}) + #include <sys/kernel.h> #define VFS_VOP_VECTOR_REGISTER(vnodeops) \ |