# HG changeset patch # User Josef 'Jeff' Sipek # Date 1564071702 14400 # Node ID 81a940d03dcdc63891df9ed5bf71984dae536af9 # Parent 607f480900f2c59140d7e90ea41266e30d249066 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 diff -r 607f480900f2 -r 81a940d03dcd synch.c --- 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)