Index: sys/kern/kern_mutex.c =================================================================== --- sys/kern/kern_mutex.c (wersja 226230) +++ sys/kern/kern_mutex.c (kopia robocza) @@ -85,14 +85,15 @@ #define mtx_owner(m) ((struct thread *)((m)->mtx_lock & ~MTX_FLAGMASK)) -static void assert_mtx(struct lock_object *lock, int what); +static void assert_mtx(const struct lock_object *lock, int what); #ifdef DDB -static void db_show_mtx(struct lock_object *lock); +static void db_show_mtx(const struct lock_object *lock); #endif static void lock_mtx(struct lock_object *lock, int how); static void lock_spin(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS -static int owner_mtx(struct lock_object *lock, struct thread **owner); +static int owner_mtx(const struct lock_object *lock, + struct thread **owner); #endif static int unlock_mtx(struct lock_object *lock); static int unlock_spin(struct lock_object *lock); @@ -134,10 +135,10 @@ struct mtx Giant; void -assert_mtx(struct lock_object *lock, int what) +assert_mtx(const struct lock_object *lock, int what) { - mtx_assert((struct mtx *)lock, what); + mtx_assert((const struct mtx *)lock, what); } void @@ -174,9 +175,9 @@ #ifdef KDTRACE_HOOKS int -owner_mtx(struct lock_object *lock, struct thread **owner) +owner_mtx(const struct lock_object *lock, struct thread **owner) { - struct mtx *m = (struct mtx *)lock; + const struct mtx *m = (const struct mtx *)lock; *owner = mtx_owner(m); return (mtx_unowned(m) == 0); @@ -693,7 +694,7 @@ */ #ifdef INVARIANT_SUPPORT void -_mtx_assert(struct mtx *m, int what, const char *file, int line) +_mtx_assert(const struct mtx *m, int what, const char *file, int line) { if (panicstr != NULL || dumping) @@ -871,12 +872,12 @@ #ifdef DDB void -db_show_mtx(struct lock_object *lock) +db_show_mtx(const struct lock_object *lock) { struct thread *td; - struct mtx *m; + const struct mtx *m; - m = (struct mtx *)lock; + m = (const struct mtx *)lock; db_printf(" flags: {"); if (LOCK_CLASS(lock) == &lock_class_mtx_spin) Index: sys/kern/kern_rwlock.c =================================================================== --- sys/kern/kern_rwlock.c (wersja 226230) +++ sys/kern/kern_rwlock.c (kopia robocza) @@ -66,12 +66,12 @@ #ifdef DDB #include -static void db_show_rwlock(struct lock_object *lock); +static void db_show_rwlock(const struct lock_object *lock); #endif -static void assert_rw(struct lock_object *lock, int what); +static void assert_rw(const struct lock_object *lock, int what); static void lock_rw(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS -static int owner_rw(struct lock_object *lock, struct thread **owner); +static int owner_rw(const struct lock_object *lock, struct thread **owner); #endif static int unlock_rw(struct lock_object *lock); @@ -120,10 +120,10 @@ #endif void -assert_rw(struct lock_object *lock, int what) +assert_rw(const struct lock_object *lock, int what) { - rw_assert((struct rwlock *)lock, what); + rw_assert((const struct rwlock *)lock, what); } void @@ -156,9 +156,9 @@ #ifdef KDTRACE_HOOKS int -owner_rw(struct lock_object *lock, struct thread **owner) +owner_rw(const struct lock_object *lock, struct thread **owner) { - struct rwlock *rw = (struct rwlock *)lock; + const struct rwlock *rw = (const struct rwlock *)lock; uintptr_t x = rw->rw_lock; *owner = rw_wowner(rw); @@ -222,7 +222,7 @@ } int -rw_wowned(struct rwlock *rw) +rw_wowned(const struct rwlock *rw) { return (rw_wowner(rw) == curthread); @@ -1010,7 +1010,7 @@ * thread owns an rlock. */ void -_rw_assert(struct rwlock *rw, int what, const char *file, int line) +_rw_assert(const struct rwlock *rw, int what, const char *file, int line) { if (panicstr != NULL) @@ -1083,12 +1083,12 @@ #ifdef DDB void -db_show_rwlock(struct lock_object *lock) +db_show_rwlock(const struct lock_object *lock) { - struct rwlock *rw; + const struct rwlock *rw; struct thread *td; - rw = (struct rwlock *)lock; + rw = (const struct rwlock *)lock; db_printf(" state: "); if (rw->rw_lock == RW_UNLOCKED) Index: sys/kern/kern_sx.c =================================================================== --- sys/kern/kern_sx.c (wersja 226230) +++ sys/kern/kern_sx.c (kopia robocza) @@ -105,13 +105,13 @@ #define sx_recurse lock_object.lo_data #define sx_recursed(sx) ((sx)->sx_recurse != 0) -static void assert_sx(struct lock_object *lock, int what); +static void assert_sx(const struct lock_object *lock, int what); #ifdef DDB -static void db_show_sx(struct lock_object *lock); +static void db_show_sx(const struct lock_object *lock); #endif static void lock_sx(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS -static int owner_sx(struct lock_object *lock, struct thread **owner); +static int owner_sx(const struct lock_object *lock, struct thread **owner); #endif static int unlock_sx(struct lock_object *lock); @@ -142,10 +142,10 @@ #endif void -assert_sx(struct lock_object *lock, int what) +assert_sx(const struct lock_object *lock, int what) { - sx_assert((struct sx *)lock, what); + sx_assert((const struct sx *)lock, what); } void @@ -178,9 +178,9 @@ #ifdef KDTRACE_HOOKS int -owner_sx(struct lock_object *lock, struct thread **owner) +owner_sx(const struct lock_object *lock, struct thread **owner) { - struct sx *sx = (struct sx *)lock; + const struct sx *sx = (const struct sx *)lock; uintptr_t x = sx->sx_lock; *owner = (struct thread *)SX_OWNER(x); @@ -1005,7 +1005,7 @@ * thread owns an slock. */ void -_sx_assert(struct sx *sx, int what, const char *file, int line) +_sx_assert(const struct sx *sx, int what, const char *file, int line) { #ifndef WITNESS int slocked = 0; @@ -1088,12 +1088,12 @@ #ifdef DDB static void -db_show_sx(struct lock_object *lock) +db_show_sx(const struct lock_object *lock) { struct thread *td; - struct sx *sx; + const struct sx *sx; - sx = (struct sx *)lock; + sx = (const struct sx *)lock; db_printf(" state: "); if (sx->sx_lock == SX_LOCK_UNLOCKED) Index: sys/kern/kern_lock.c =================================================================== --- sys/kern/kern_lock.c (wersja 226230) +++ sys/kern/kern_lock.c (kopia robocza) @@ -131,15 +131,16 @@ #define lockmgr_xlocked(lk) \ (((lk)->lk_lock & ~(LK_FLAGMASK & ~LK_SHARE)) == (uintptr_t)curthread) -static void assert_lockmgr(struct lock_object *lock, int how); +static void assert_lockmgr(const struct lock_object *lock, int how); #ifdef DDB -static void db_show_lockmgr(struct lock_object *lock); +static void db_show_lockmgr(const struct lock_object *lock); #endif -static void lock_lockmgr(struct lock_object *lock, int how); +static void lock_lockmgr(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS -static int owner_lockmgr(struct lock_object *lock, struct thread **owner); +static int owner_lockmgr(const struct lock_object *lock, + struct thread **owner); #endif -static int unlock_lockmgr(struct lock_object *lock); +static int unlock_lockmgr(struct lock_object *lock); struct lock_class lock_class_lockmgr = { .lc_name = "lockmgr", @@ -164,7 +165,7 @@ #endif static __inline struct thread * -lockmgr_xholder(struct lock *lk) +lockmgr_xholder(const struct lock *lk) { uintptr_t x; @@ -334,7 +335,7 @@ } static void -assert_lockmgr(struct lock_object *lock, int what) +assert_lockmgr(const struct lock_object *lock, int what) { panic("lockmgr locks do not support assertions"); @@ -356,7 +357,7 @@ #ifdef KDTRACE_HOOKS static int -owner_lockmgr(struct lock_object *lock, struct thread **owner) +owner_lockmgr(const struct lock_object *lock, struct thread **owner) { panic("lockmgr locks do not support owner inquiring"); @@ -1259,7 +1260,7 @@ } void -lockmgr_printinfo(struct lock *lk) +lockmgr_printinfo(const struct lock *lk) { struct thread *td; uintptr_t x; @@ -1288,7 +1289,7 @@ } int -lockstatus(struct lock *lk) +lockstatus(const struct lock *lk) { uintptr_t v, x; int ret; @@ -1318,7 +1319,7 @@ #endif void -_lockmgr_assert(struct lock *lk, int what, const char *file, int line) +_lockmgr_assert(const struct lock *lk, int what, const char *file, int line) { int slocked = 0; @@ -1411,12 +1412,12 @@ } static void -db_show_lockmgr(struct lock_object *lock) +db_show_lockmgr(const struct lock_object *lock) { struct thread *td; - struct lock *lk; + const struct lock *lk; - lk = (struct lock *)lock; + lk = (const struct lock *)lock; db_printf(" state: "); if (lk->lk_lock == LK_UNLOCKED) Index: sys/kern/kern_rmlock.c =================================================================== --- sys/kern/kern_rmlock.c (wersja 226230) +++ sys/kern/kern_rmlock.c (kopia robocza) @@ -69,10 +69,10 @@ __asm __volatile("":::"memory"); } -static void assert_rm(struct lock_object *lock, int what); +static void assert_rm(const struct lock_object *lock, int what); static void lock_rm(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS -static int owner_rm(struct lock_object *lock, struct thread **owner); +static int owner_rm(const struct lock_object *lock, struct thread **owner); #endif static int unlock_rm(struct lock_object *lock); @@ -93,7 +93,7 @@ }; static void -assert_rm(struct lock_object *lock, int what) +assert_rm(const struct lock_object *lock, int what) { panic("assert_rm called"); @@ -115,7 +115,7 @@ #ifdef KDTRACE_HOOKS static int -owner_rm(struct lock_object *lock, struct thread **owner) +owner_rm(const struct lock_object *lock, struct thread **owner) { panic("owner_rm called"); Index: sys/kern/subr_witness.c =================================================================== --- sys/kern/subr_witness.c (wersja 226230) +++ sys/kern/subr_witness.c (kopia robocza) @@ -332,7 +332,7 @@ static struct witness *enroll(const char *description, struct lock_class *lock_class); static struct lock_instance *find_instance(struct lock_list_entry *list, - struct lock_object *lock); + const struct lock_object *lock); static int isitmychild(struct witness *parent, struct witness *child); static int isitmydescendant(struct witness *parent, struct witness *child); static void itismychild(struct witness *parent, struct witness *child); @@ -2047,7 +2047,7 @@ } static struct lock_instance * -find_instance(struct lock_list_entry *list, struct lock_object *lock) +find_instance(struct lock_list_entry *list, const struct lock_object *lock) { struct lock_list_entry *lle; struct lock_instance *instance; @@ -2194,7 +2194,8 @@ } void -witness_assert(struct lock_object *lock, int flags, const char *file, int line) +witness_assert(const struct lock_object *lock, int flags, const char *file, + int line) { #ifdef INVARIANT_SUPPORT struct lock_instance *instance; Index: sys/sys/sx.h =================================================================== --- sys/sys/sx.h (wersja 226179) +++ sys/sys/sx.h (kopia robocza) @@ -109,7 +109,7 @@ line); void _sx_sunlock_hard(struct sx *sx, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) -void _sx_assert(struct sx *sx, int what, const char *file, int line); +void _sx_assert(const struct sx *sx, int what, const char *file, int line); #endif #ifdef DDB int sx_chain(struct thread *td, struct thread **ownerp); Index: sys/sys/rwlock.h =================================================================== --- sys/sys/rwlock.h (wersja 226179) +++ sys/sys/rwlock.h (kopia robocza) @@ -127,7 +127,7 @@ void rw_destroy(struct rwlock *rw); void rw_sysinit(void *arg); void rw_sysinit_flags(void *arg); -int rw_wowned(struct rwlock *rw); +int rw_wowned(const struct rwlock *rw); void _rw_wlock(struct rwlock *rw, const char *file, int line); int _rw_try_wlock(struct rwlock *rw, const char *file, int line); void _rw_wunlock(struct rwlock *rw, const char *file, int line); @@ -141,7 +141,7 @@ int _rw_try_upgrade(struct rwlock *rw, const char *file, int line); void _rw_downgrade(struct rwlock *rw, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) -void _rw_assert(struct rwlock *rw, int what, const char *file, int line); +void _rw_assert(const struct rwlock *rw, int what, const char *file, int line); #endif /* Index: sys/sys/lock.h =================================================================== --- sys/sys/lock.h (wersja 226179) +++ sys/sys/lock.h (kopia robocza) @@ -58,10 +58,10 @@ struct lock_class { const char *lc_name; u_int lc_flags; - void (*lc_assert)(struct lock_object *lock, int what); - void (*lc_ddb_show)(struct lock_object *lock); + void (*lc_assert)(const struct lock_object *lock, int what); + void (*lc_ddb_show)(const struct lock_object *lock); void (*lc_lock)(struct lock_object *lock, int how); - int (*lc_owner)(struct lock_object *lock, struct thread **owner); + int (*lc_owner)(const struct lock_object *lock, struct thread **owner); int (*lc_unlock)(struct lock_object *lock); }; @@ -215,7 +215,7 @@ int witness_list_locks(struct lock_list_entry **, int (*)(const char *, ...)); int witness_warn(int, struct lock_object *, const char *, ...); -void witness_assert(struct lock_object *, int, const char *, int); +void witness_assert(const struct lock_object *, int, const char *, int); void witness_display_spinlock(struct lock_object *, struct thread *, int (*)(const char *, ...)); int witness_line(struct lock_object *); Index: sys/sys/lockmgr.h =================================================================== --- sys/sys/lockmgr.h (wersja 226179) +++ sys/sys/lockmgr.h (kopia robocza) @@ -69,7 +69,7 @@ int __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, const char *wmesg, int prio, int timo, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) -void _lockmgr_assert(struct lock *lk, int what, const char *file, int line); +void _lockmgr_assert(const struct lock *lk, int what, const char *file, int line); #endif void _lockmgr_disown(struct lock *lk, const char *file, int line); @@ -82,8 +82,8 @@ #ifdef DDB int lockmgr_chain(struct thread *td, struct thread **ownerp); #endif -void lockmgr_printinfo(struct lock *lk); -int lockstatus(struct lock *lk); +void lockmgr_printinfo(const struct lock *lk); +int lockstatus(const struct lock *lk); /* * As far as the ilk can be a static NULL pointer these functions need a Index: sys/sys/mutex.h =================================================================== --- sys/sys/mutex.h (wersja 226179) +++ sys/sys/mutex.h (kopia robocza) @@ -105,7 +105,7 @@ void _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line); #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) -void _mtx_assert(struct mtx *m, int what, const char *file, int line); +void _mtx_assert(const struct mtx *m, int what, const char *file, int line); #endif void _thread_lock_flags(struct thread *, int, const char *, int);