Deleted Added
full compact
27c27
< * $FreeBSD: head/sys/kern/kern_sx.c 73901 2001-03-06 23:13:15Z jhb $
---
> * $FreeBSD: head/sys/kern/kern_sx.c 74912 2001-03-28 09:03:24Z jhb $
48a49
> #include <sys/lock.h>
51a53,61
> /*
> * XXX: We don't implement the LO_RECURSED flag for this lock yet.
> * We could do this by walking p_sleeplocks if we really wanted to.
> */
> struct lock_class lock_class_sx = {
> "sx",
> LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE
> };
>
54a65
> struct lock_object *lock;
56c67,73
< mtx_init(&sx->sx_lock, description, MTX_DEF);
---
> bzero(sx, sizeof(*sx));
> lock = &sx->sx_object;
> lock->lo_class = &lock_class_sx;
> lock->lo_name = description;
> lock->lo_flags = LO_WITNESS | LO_SLEEPABLE;
> mtx_init(&sx->sx_lock, "sx backing lock",
> MTX_DEF | MTX_NOWITNESS | MTX_QUIET);
61d77
< sx->sx_descr = description;
63a80,83
>
> LOCK_LOG_INIT(lock, 0);
>
> WITNESS_INIT(lock);
69a90,91
> LOCK_LOG_DESTROY(&sx->sx_object, 0);
>
71c93,94
< 0), ("%s (%s): holders or waiters\n", __FUNCTION__, sx->sx_descr));
---
> 0), ("%s (%s): holders or waiters\n", __FUNCTION__,
> sx->sx_object.lo_name));
75a99,100
>
> WITNESS_DESTROY(&sx->sx_object);
79c104
< sx_slock(struct sx *sx)
---
> _sx_slock(struct sx *sx, const char *file, int line)
85c110
< sx->sx_descr));
---
> sx->sx_object.lo_name));
98a124,129
> #ifdef WITNESS
> sx->sx_object.lo_flags |= LO_LOCKED;
> #endif
> LOCK_LOG_LOCK("SLOCK", &sx->sx_object, 0, 0, file, line);
> WITNESS_LOCK(&sx->sx_object, 0, file, line);
>
103c134
< sx_xlock(struct sx *sx)
---
> _sx_xlock(struct sx *sx, const char *file, int line)
116c147,148
< ("%s (%s): xlock already held", __FUNCTION__, sx->sx_descr));
---
> ("%s (%s): xlock already held @ %s:%d", __FUNCTION__,
> sx->sx_object.lo_name, file, line));
130a163,168
> #ifdef WITNESS
> sx->sx_object.lo_flags |= LO_LOCKED;
> #endif
> LOCK_LOG_LOCK("XLOCK", &sx->sx_object, 0, 0, file, line);
> WITNESS_LOCK(&sx->sx_object, 0, file, line);
>
135c173
< sx_sunlock(struct sx *sx)
---
> _sx_sunlock(struct sx *sx, const char *file, int line)
140a179,184
> #ifdef WITNESS
> if (sx->sx_cnt == 0)
> sx->sx_object.lo_flags &= ~LO_LOCKED;
> #endif
> WITNESS_UNLOCK(&sx->sx_object, 0, file, line);
>
155a200,201
> LOCK_LOG_LOCK("SUNLOCK", &sx->sx_object, 0, 0, file, line);
>
160c206
< sx_xunlock(struct sx *sx)
---
> _sx_xunlock(struct sx *sx, const char *file, int line)
166a213,217
> #ifdef WITNESS
> sx->sx_object.lo_flags &= ~LO_LOCKED;
> #endif
> WITNESS_UNLOCK(&sx->sx_object, 0, file, line);
>
178a230,231
> LOCK_LOG_LOCK("XUNLOCK", &sx->sx_object, 0, 0, file, line);
>