changeset 756:81a940d03dcd

synch: redefine magic to be a pointer to the info struct This will eventually allow lockdep to treat all lock-like synchronization primitives the same by simply operating on the info structs. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 25 Jul 2019 12:21:42 -0400
parents 607f480900f2
children ac902673ea0a
files synch.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/synch.c	Thu Jul 25 10:59:16 2019 -0400
+++ b/synch.c	Thu Jul 25 12:21:42 2019 -0400
@@ -104,11 +104,11 @@
 }
 
 #define GENERATE_LOCK_MASK_ARGS(l)						\
-	((l)->info.magic != (uintptr_t) (l)) ? 'M' : '.'
+	((l)->info.magic != (uintptr_t) &(l)->info) ? 'M' : '.'
 #define GENERATE_RW_MASK_ARGS(l)						\
-	((l)->info.magic != (uintptr_t) (l)) ? 'M' : '.'
+	((l)->info.magic != (uintptr_t) &(l)->info) ? 'M' : '.'
 #define GENERATE_COND_MASK_ARGS(c)						\
-	((c)->info.magic != (uintptr_t) (c)) ? 'M' : '.'
+	((c)->info.magic != (uintptr_t) &(c)->info) ? 'M' : '.'
 
 static void print_lock(struct lock *lock, const struct lock_context *where)
 {
@@ -387,7 +387,7 @@
 static void check_lock_magic(struct lock *lock, const char *op,
 			     const struct lock_context *where)
 {
-	if (lock->info.magic == (uintptr_t) lock)
+	if (lock->info.magic == (uintptr_t) &lock->info)
 		return;
 
 	cmn_err(CE_CRIT, "lockdep: thread trying to %s lock with bad magic", op);
@@ -402,7 +402,7 @@
 static void check_rw_magic(struct rwlock *lock, const char *op,
 			   const struct lock_context *where)
 {
-	if (lock->info.magic == (uintptr_t) lock)
+	if (lock->info.magic == (uintptr_t) &lock->info)
 		return;
 
 	cmn_err(CE_CRIT, "lockdep: thread trying to %s rwlock with bad magic", op);
@@ -413,7 +413,7 @@
 static void check_cond_magic(struct cond *cond, const char *op,
 			     const struct lock_context *where)
 {
-	if (cond->info.magic == (uintptr_t) cond)
+	if (cond->info.magic == (uintptr_t) &cond->info)
 		return;
 
 	cmn_err(CE_CRIT, "lockdep: thread trying to %s cond with bad magic", op);
@@ -427,7 +427,7 @@
 	if (!l || !lc)
 		print_invalid_call("MXINIT", where);
 
-	l->info.magic = (uintptr_t) l;
+	l->info.magic = (uintptr_t) &l->info;
 
 #ifdef JEFFPC_LOCK_TRACKING
 	l->lc = lc;
@@ -531,7 +531,7 @@
 	if (!l)
 		print_invalid_call("RWINIT", where);
 
-	l->info.magic = (uintptr_t) l;
+	l->info.magic = (uintptr_t) &l->info;
 }
 
 static void verify_rw_destroy(const struct lock_context *where, struct rwlock *l)
@@ -566,7 +566,7 @@
 	if (!c)
 		print_invalid_call("CONDINIT", where);
 
-	c->info.magic = (uintptr_t) c;
+	c->info.magic = (uintptr_t) &c->info;
 }
 
 static void verify_cond_destroy(const struct lock_context *where, struct cond *c)