Add appropriate const poisoning to the assert_*locked() family so that I can
call ASSERT_VOP_LOCKED(vp, __func__) without a diagnostic. Inspired by: the evil and rude OpenAFS cache manager code
This commit is contained in:
parent
9f9ccd206d
commit
06cb76bde3
@ -257,7 +257,7 @@ int vfs_badlock_panic = 1;
|
||||
int vfs_badlock_mutex = 1;
|
||||
|
||||
static void
|
||||
vfs_badlock(char *msg, char *str, struct vnode *vp)
|
||||
vfs_badlock(const char *msg, const char *str, struct vnode *vp)
|
||||
{
|
||||
if (vfs_badlock_print)
|
||||
printf("%s: %p %s\n", str, vp, msg);
|
||||
@ -266,28 +266,28 @@ vfs_badlock(char *msg, char *str, struct vnode *vp)
|
||||
}
|
||||
|
||||
void
|
||||
assert_vi_unlocked(struct vnode *vp, char *str)
|
||||
assert_vi_unlocked(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vfs_badlock_mutex && mtx_owned(VI_MTX(vp)))
|
||||
vfs_badlock("interlock is locked but should not be", str, vp);
|
||||
}
|
||||
|
||||
void
|
||||
assert_vi_locked(struct vnode *vp, char *str)
|
||||
assert_vi_locked(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vfs_badlock_mutex && !mtx_owned(VI_MTX(vp)))
|
||||
vfs_badlock("interlock is not locked but should be", str, vp);
|
||||
}
|
||||
|
||||
void
|
||||
assert_vop_locked(struct vnode *vp, char *str)
|
||||
assert_vop_locked(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vp && !IGNORE_LOCK(vp) && !VOP_ISLOCKED(vp, NULL))
|
||||
vfs_badlock("is not locked but should be", str, vp);
|
||||
}
|
||||
|
||||
void
|
||||
assert_vop_unlocked(struct vnode *vp, char *str)
|
||||
assert_vop_unlocked(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vp && !IGNORE_LOCK(vp) &&
|
||||
VOP_ISLOCKED(vp, curthread) == LK_EXCLUSIVE)
|
||||
@ -295,7 +295,7 @@ assert_vop_unlocked(struct vnode *vp, char *str)
|
||||
}
|
||||
|
||||
void
|
||||
assert_vop_elocked(struct vnode *vp, char *str)
|
||||
assert_vop_elocked(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vp && !IGNORE_LOCK(vp) &&
|
||||
VOP_ISLOCKED(vp, curthread) != LK_EXCLUSIVE)
|
||||
@ -303,7 +303,7 @@ assert_vop_elocked(struct vnode *vp, char *str)
|
||||
}
|
||||
|
||||
void
|
||||
assert_vop_elocked_other(struct vnode *vp, char *str)
|
||||
assert_vop_elocked_other(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vp && !IGNORE_LOCK(vp) &&
|
||||
VOP_ISLOCKED(vp, curthread) != LK_EXCLOTHER)
|
||||
@ -312,7 +312,7 @@ assert_vop_elocked_other(struct vnode *vp, char *str)
|
||||
}
|
||||
|
||||
void
|
||||
assert_vop_slocked(struct vnode *vp, char *str)
|
||||
assert_vop_slocked(struct vnode *vp, const char *str)
|
||||
{
|
||||
if (vp && !IGNORE_LOCK(vp) &&
|
||||
VOP_ISLOCKED(vp, curthread) != LK_SHARED)
|
||||
|
@ -502,13 +502,13 @@ struct vop_generic_args {
|
||||
* change the state. They are good enough for debugging a single
|
||||
* filesystem using a single-threaded test.
|
||||
*/
|
||||
void assert_vi_locked(struct vnode *vp, char *str);
|
||||
void assert_vi_unlocked(struct vnode *vp, char *str);
|
||||
void assert_vop_unlocked(struct vnode *vp, char *str);
|
||||
void assert_vop_locked(struct vnode *vp, char *str);
|
||||
void assert_vop_slocked(struct vnode *vp, char *str);
|
||||
void assert_vop_elocked(struct vnode *vp, char *str);
|
||||
void assert_vop_elocked_other(struct vnode *vp, char *str);
|
||||
void assert_vi_locked(struct vnode *vp, const char *str);
|
||||
void assert_vi_unlocked(struct vnode *vp, const char *str);
|
||||
void assert_vop_unlocked(struct vnode *vp, const char *str);
|
||||
void assert_vop_locked(struct vnode *vp, const char *str);
|
||||
void assert_vop_slocked(struct vnode *vp, const char *str);
|
||||
void assert_vop_elocked(struct vnode *vp, const char *str);
|
||||
void assert_vop_elocked_other(struct vnode *vp, const char *str);
|
||||
|
||||
/* These are called from within the actuall VOPS */
|
||||
void vop_rename_pre(void *a);
|
||||
|
Loading…
Reference in New Issue
Block a user