Use NULL instead of __FILE__ in the !LOCK_DEBUG case in the locking code
since the filenames are only used in the LOCK_DEBUG case and are just bloat in the !LOCK_DEBUG case.
This commit is contained in:
parent
e3c822c968
commit
52d4106b53
@ -136,6 +136,18 @@ struct lock_list_entry {
|
||||
#define LOCK_DEBUG
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In the LOCK_DEBUG case, use the filename and line numbers for debugging
|
||||
* operations. Otherwise, use default values to avoid the unneeded bloat.
|
||||
*/
|
||||
#ifdef LOCK_DEBUG
|
||||
#define LOCK_FILE __FILE__
|
||||
#define LOCK_LINE __LINE__
|
||||
#else
|
||||
#define LOCK_FILE NULL
|
||||
#define LOCK_LINE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for KTR_LOCK tracing.
|
||||
*
|
||||
|
@ -91,8 +91,8 @@
|
||||
* Prototypes
|
||||
*
|
||||
* NOTE: Functions prepended with `_' (underscore) are exported to other parts
|
||||
* of the kernel via macros, thus allowing us to use the cpp __FILE__
|
||||
* and __LINE__. These functions should not be called directly by any
|
||||
* of the kernel via macros, thus allowing us to use the cpp LOCK_FILE
|
||||
* and LOCK_LINE. These functions should not be called directly by any
|
||||
* code using the API. Their macros cover their functionality.
|
||||
*
|
||||
* [See below for descriptions]
|
||||
@ -240,22 +240,22 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
|
||||
|
||||
#ifdef LOCK_DEBUG
|
||||
#define mtx_lock_flags(m, opts) \
|
||||
_mtx_lock_flags((m), (opts), __FILE__, __LINE__)
|
||||
_mtx_lock_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_unlock_flags(m, opts) \
|
||||
_mtx_unlock_flags((m), (opts), __FILE__, __LINE__)
|
||||
_mtx_unlock_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_lock_spin_flags(m, opts) \
|
||||
_mtx_lock_spin_flags((m), (opts), __FILE__, __LINE__)
|
||||
_mtx_lock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_unlock_spin_flags(m, opts) \
|
||||
_mtx_unlock_spin_flags((m), (opts), __FILE__, __LINE__)
|
||||
_mtx_unlock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#else
|
||||
#define mtx_lock_flags(m, opts) \
|
||||
__mtx_lock_flags((m), (opts), __FILE__, __LINE__)
|
||||
__mtx_lock_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_unlock_flags(m, opts) \
|
||||
__mtx_unlock_flags((m), (opts), __FILE__, __LINE__)
|
||||
__mtx_unlock_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_lock_spin_flags(m, opts) \
|
||||
__mtx_lock_spin_flags((m), (opts), __FILE__, __LINE__)
|
||||
__mtx_lock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#define mtx_unlock_spin_flags(m, opts) \
|
||||
__mtx_unlock_spin_flags((m), (opts), __FILE__, __LINE__)
|
||||
__mtx_unlock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
#endif
|
||||
|
||||
#define __mtx_lock_flags(m, opts, file, line) do { \
|
||||
@ -299,7 +299,7 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
|
||||
} while (0)
|
||||
|
||||
#define mtx_trylock_flags(m, opts) \
|
||||
_mtx_trylock((m), (opts), __FILE__, __LINE__)
|
||||
_mtx_trylock((m), (opts), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
#define mtx_initialized(m) ((m)->mtx_object.lo_flags & LO_INITIALIZED)
|
||||
|
||||
@ -376,7 +376,7 @@ do { \
|
||||
|
||||
#ifdef INVARIANTS
|
||||
#define mtx_assert(m, what) \
|
||||
_mtx_assert((m), (what), __FILE__, __LINE__)
|
||||
_mtx_assert((m), (what), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
#define GIANT_REQUIRED mtx_assert(&Giant, MA_OWNED)
|
||||
|
||||
|
@ -50,11 +50,11 @@ int _sema_timedwait(struct sema *sema, int timo, const char *file, int
|
||||
int _sema_trywait(struct sema *sema, const char *file, int line);
|
||||
int sema_value(struct sema *sema);
|
||||
|
||||
#define sema_post(sema) _sema_post((sema), __FILE__, __LINE__)
|
||||
#define sema_wait(sema) _sema_wait((sema), __FILE__, __LINE__)
|
||||
#define sema_post(sema) _sema_post((sema), LOCK_FILE, LOCK_LINE)
|
||||
#define sema_wait(sema) _sema_wait((sema), LOCK_FILE, LOCK_LINE)
|
||||
#define sema_timedwait(sema, timo) \
|
||||
_sema_timedwait((sema), (timo), __FILE__, __LINE__)
|
||||
#define sema_trywait(sema) _sema_trywait((sema), __FILE__, __LINE__)
|
||||
_sema_timedwait((sema), (timo), LOCK_FILE, LOCK_LINE)
|
||||
#define sema_trywait(sema) _sema_trywait((sema), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _SYS_SEMA_H_ */
|
||||
|
22
sys/sys/sx.h
22
sys/sys/sx.h
@ -58,14 +58,14 @@ void _sx_xunlock(struct sx *sx, const char *file, int line);
|
||||
int _sx_try_upgrade(struct sx *sx, const char *file, int line);
|
||||
void _sx_downgrade(struct sx *sx, const char *file, int line);
|
||||
|
||||
#define sx_slock(sx) _sx_slock((sx), __FILE__, __LINE__)
|
||||
#define sx_xlock(sx) _sx_xlock((sx), __FILE__, __LINE__)
|
||||
#define sx_try_slock(sx) _sx_try_slock((sx), __FILE__, __LINE__)
|
||||
#define sx_try_xlock(sx) _sx_try_xlock((sx), __FILE__, __LINE__)
|
||||
#define sx_sunlock(sx) _sx_sunlock((sx), __FILE__, __LINE__)
|
||||
#define sx_xunlock(sx) _sx_xunlock((sx), __FILE__, __LINE__)
|
||||
#define sx_try_upgrade(sx) _sx_try_upgrade((sx), __FILE__, __LINE__)
|
||||
#define sx_downgrade(sx) _sx_downgrade((sx), __FILE__, __LINE__)
|
||||
#define sx_slock(sx) _sx_slock((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_xlock(sx) _sx_xlock((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_try_slock(sx) _sx_try_slock((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_try_xlock(sx) _sx_try_xlock((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_sunlock(sx) _sx_sunlock((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_xunlock(sx) _sx_xunlock((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_try_upgrade(sx) _sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define sx_downgrade(sx) _sx_downgrade((sx), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
#ifdef INVARIANTS
|
||||
/*
|
||||
@ -89,8 +89,8 @@ void _sx_downgrade(struct sx *sx, const char *file, int line);
|
||||
(sx)->sx_object.lo_name, file, line)); \
|
||||
} while (0)
|
||||
#endif
|
||||
#define SX_ASSERT_LOCKED(sx) _SX_ASSERT_LOCKED((sx), __FILE__, __LINE__)
|
||||
#define SX_ASSERT_SLOCKED(sx) _SX_ASSERT_SLOCKED((sx), __FILE__, __LINE__)
|
||||
#define SX_ASSERT_LOCKED(sx) _SX_ASSERT_LOCKED((sx), LOCK_FILE, LOCK_LINE)
|
||||
#define SX_ASSERT_SLOCKED(sx) _SX_ASSERT_SLOCKED((sx), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
/*
|
||||
* SX_ASSERT_XLOCKED() detects and guarantees that *we* own the xlock.
|
||||
@ -100,7 +100,7 @@ void _sx_downgrade(struct sx *sx, const char *file, int line);
|
||||
("Lock %s not exclusively locked @ %s:%d", \
|
||||
(sx)->sx_object.lo_name, file, line)); \
|
||||
} while (0)
|
||||
#define SX_ASSERT_XLOCKED(sx) _SX_ASSERT_XLOCKED((sx), __FILE__, __LINE__)
|
||||
#define SX_ASSERT_XLOCKED(sx) _SX_ASSERT_XLOCKED((sx), LOCK_FILE, LOCK_LINE)
|
||||
|
||||
#else /* INVARIANTS */
|
||||
#define SX_ASSERT_SLOCKED(sx)
|
||||
|
Loading…
Reference in New Issue
Block a user