diff options
author | jhb <jhb@FreeBSD.org> | 2001-09-17 21:21:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-09-17 21:21:02 +0000 |
commit | db1c30ff3df0786cba40522c4f80e2b9bb4cb0cd (patch) | |
tree | b487cc728ac365c5ef9758c9ee37a34b17223d86 /sys | |
parent | 6a8e913ec2bde9891ed126a0c8966db4bca8a0cc (diff) | |
download | FreeBSD-src-db1c30ff3df0786cba40522c4f80e2b9bb4cb0cd.zip FreeBSD-src-db1c30ff3df0786cba40522c4f80e2b9bb4cb0cd.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/lock.h | 12 | ||||
-rw-r--r-- | sys/sys/mutex.h | 24 | ||||
-rw-r--r-- | sys/sys/sema.h | 8 | ||||
-rw-r--r-- | sys/sys/sx.h | 22 |
4 files changed, 39 insertions, 27 deletions
diff --git a/sys/sys/lock.h b/sys/sys/lock.h index 86c6fbb..f773959 100644 --- a/sys/sys/lock.h +++ b/sys/sys/lock.h @@ -137,6 +137,18 @@ struct lock_list_entry { #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. * * opname - name of this operation (LOCK/UNLOCK/SLOCK, etc.) diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index 9dbc21d..be8115c 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -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) diff --git a/sys/sys/sema.h b/sys/sys/sema.h index 6a2ef14..91f0fc2b 100644 --- a/sys/sys/sema.h +++ b/sys/sys/sema.h @@ -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_ */ diff --git a/sys/sys/sx.h b/sys/sys/sx.h index f6fef05..e27366c 100644 --- a/sys/sys/sx.h +++ b/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) |