diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/alpha/machdep.c | 4 | ||||
-rw-r--r-- | sys/alpha/alpha/synch_machdep.c | 20 | ||||
-rw-r--r-- | sys/alpha/include/mutex.h | 48 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 4 | ||||
-rw-r--r-- | sys/amd64/include/mutex.h | 48 | ||||
-rw-r--r-- | sys/dev/random/yarrow.c | 4 | ||||
-rw-r--r-- | sys/dev/randomdev/yarrow.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/synch_machdep.c | 20 | ||||
-rw-r--r-- | sys/i386/include/mutex.h | 48 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_mutex.c | 121 | ||||
-rw-r--r-- | sys/kern/kern_synch.c | 2 | ||||
-rw-r--r-- | sys/kern/subr_turnstile.c | 121 | ||||
-rw-r--r-- | sys/kern/subr_witness.c | 121 | ||||
-rw-r--r-- | sys/pc98/i386/machdep.c | 4 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 4 | ||||
-rw-r--r-- | sys/powerpc/include/mutex.h | 48 |
18 files changed, 311 insertions, 316 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 3a2d20b..ea64265 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -153,8 +153,8 @@ struct bootinfo_kernel bootinfo; struct cpuhead cpuhead; -mtx_t sched_lock; -mtx_t Giant; +struct mtx sched_lock; +struct mtx Giant; struct user *proc0paddr; diff --git a/sys/alpha/alpha/synch_machdep.c b/sys/alpha/alpha/synch_machdep.c index f87c2f7..d3eecb0 100644 --- a/sys/alpha/alpha/synch_machdep.c +++ b/sys/alpha/alpha/synch_machdep.c @@ -45,7 +45,7 @@ #include <machine/mutex.h> /* All mutexes in system (used for debug/panic) */ -mtx_t all_mtx = { MTX_UNOWNED, 0, 0, "All mutexes queue head", +struct mtx all_mtx = { MTX_UNOWNED, 0, 0, "All mutexes queue head", TAILQ_HEAD_INITIALIZER(all_mtx.mtx_blocked), { NULL, NULL }, &all_mtx, &all_mtx #ifdef SMP_DEBUG @@ -90,7 +90,7 @@ static void propagate_priority(struct proc *p) { int pri = p->p_priority; - mtx_t *m = p->p_blocked; + struct mtx *m = p->p_blocked; for (;;) { struct proc *p1; @@ -170,7 +170,7 @@ propagate_priority(struct proc *p) } void -mtx_enter_hard(mtx_t *m, int type, int ipl) +mtx_enter_hard(struct mtx *m, int type, int ipl) { struct proc *p = CURPROC; @@ -327,10 +327,10 @@ mtx_enter_hard(mtx_t *m, int type, int ipl) } void -mtx_exit_hard(mtx_t *m, int type) +mtx_exit_hard(struct mtx *m, int type) { struct proc *p, *p1; - mtx_t *m1; + struct mtx *m1; int pri; switch (type) { @@ -428,12 +428,12 @@ mtx_exit_hard(mtx_t *m, int type) #ifdef SMP_DEBUG -int mtx_validate __P((mtx_t *, int)); +int mtx_validate __P((struct mtx *, int)); int -mtx_validate(mtx_t *m, int when) +mtx_validate(struct mtx *m, int when) { - mtx_t *mp; + struct mtx *mp; int i; int retval = 0; @@ -486,7 +486,7 @@ mtx_validate(mtx_t *m, int when) #endif void -mtx_init(mtx_t *m, char *t, int flag) +mtx_init(struct mtx *m, char *t, int flag) { CTR2(KTR_LOCK, "mtx_init 0x%p (%s)", m, t); @@ -511,7 +511,7 @@ mtx_init(mtx_t *m, char *t, int flag) } void -mtx_destroy(mtx_t *m) +mtx_destroy(struct mtx *m) { CTR2(KTR_LOCK, "mtx_destroy 0x%p (%s)", m, m->mtx_description); diff --git a/sys/alpha/include/mutex.h b/sys/alpha/include/mutex.h index ae4b5bb..99f9b7c 100644 --- a/sys/alpha/include/mutex.h +++ b/sys/alpha/include/mutex.h @@ -99,8 +99,6 @@ struct mtx { #endif /* SMP_DEBUG */ }; -typedef struct mtx mtx_t; - /* * Filler for structs which need to remain the same size * whether or not SMP_DEBUG is turned on. @@ -120,19 +118,19 @@ typedef struct mtxf { #define CURTHD ((u_int64_t)CURPROC) /* Current thread ID */ /* Prototypes */ -void mtx_init(mtx_t *m, char *description, int flag); -void mtx_enter_hard(mtx_t *, int type, int ipl); -void mtx_exit_hard(mtx_t *, int type); -void mtx_destroy(mtx_t *m); +void mtx_init(struct mtx *m, char *description, int flag); +void mtx_enter_hard(struct mtx *, int type, int ipl); +void mtx_exit_hard(struct mtx *, int type); +void mtx_destroy(struct mtx *m); /* * Wrap the following functions with cpp macros so that filenames and line * numbers are embedded in the code correctly. */ #if (defined(KLD_MODULE) || defined(_KERN_MUTEX_C_)) -void _mtx_enter(mtx_t *mtxp, int type, const char *file, int line); -int _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line); -void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); +void _mtx_enter(struct mtx *mtxp, int type, const char *file, int line); +int _mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line); +void _mtx_exit(struct mtx *mtxp, int type, const char *file, int line); #endif #define mtx_enter(mtxp, type) \ @@ -145,8 +143,8 @@ void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); _mtx_exit((mtxp), (type), __FILE__, __LINE__) /* Global locks */ -extern mtx_t sched_lock; -extern mtx_t Giant; +extern struct mtx sched_lock; +extern struct mtx Giant; /* * Used to replace return with an exit Giant and return. @@ -267,16 +265,16 @@ do { \ witness_restore(m, __CONCAT(n, __wf), __CONCAT(n, __wl)); \ } while (0) -void witness_init(mtx_t *, int flag); -void witness_destroy(mtx_t *); -void witness_enter(mtx_t *, int, const char *, int); -void witness_try_enter(mtx_t *, int, const char *, int); -void witness_exit(mtx_t *, int, const char *, int); +void witness_init(struct mtx *, int flag); +void witness_destroy(struct mtx *); +void witness_enter(struct mtx *, int, const char *, int); +void witness_try_enter(struct mtx *, int, const char *, int); +void witness_exit(struct mtx *, int, const char *, int); void witness_display(void(*)(const char *fmt, ...)); void witness_list(struct proc *); -int witness_sleep(int, mtx_t *, const char *, int); -void witness_save(mtx_t *, const char **, int *); -void witness_restore(mtx_t *, const char *, int); +int witness_sleep(int, struct mtx *, const char *, int); +void witness_save(struct mtx *, const char **, int *); +void witness_restore(struct mtx *, const char *, int); #else /* WITNESS */ #define WITNESS_ENTER(m, t, f, l) #define WITNESS_EXIT(m, t, f, l) @@ -424,9 +422,9 @@ extern char STR_mtx_try_enter_fmt[]; * Note: since type is usually a constant much of this code is optimized out */ _MTX_INLINE void -_mtx_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *mpp = mtxp; + struct mtx *mpp = mtxp; /* bits only valid on mtx_exit() */ MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0, @@ -480,9 +478,9 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line) * XXX DOES NOT HANDLE RECURSION */ _MTX_INLINE int -_mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; int rval; rval = atomic_cmpset_64(&mpp->mtx_lock, MTX_UNOWNED, CURTHD); @@ -502,9 +500,9 @@ _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) * Release lock m */ _MTX_INLINE void -_mtx_exit(mtx_t *mtxp, int type, const char *file, int line) +_mtx_exit(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; MPASS2(mtx_owned(mpp), STR_mtx_owned); WITNESS_EXIT(mpp, type, file, line); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0e5b0e1..8b1b08b 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -253,8 +253,8 @@ static struct trapframe proc0_tf; struct cpuhead cpuhead; -mtx_t sched_lock; -mtx_t Giant; +struct mtx sched_lock; +struct mtx Giant; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) diff --git a/sys/amd64/include/mutex.h b/sys/amd64/include/mutex.h index b19bfa9..11e752d 100644 --- a/sys/amd64/include/mutex.h +++ b/sys/amd64/include/mutex.h @@ -98,8 +98,6 @@ struct mtx { #endif /* SMP_DEBUG */ }; -typedef struct mtx mtx_t; - /* * Filler for structs which need to remain the same size * whether or not SMP_DEBUG is turned on. @@ -119,19 +117,19 @@ typedef struct mtxf { #define CURTHD ((u_int)CURPROC) /* Current thread ID */ /* Prototypes */ -void mtx_init(mtx_t *m, char *description, int flag); -void mtx_enter_hard(mtx_t *, int type, int flags); -void mtx_exit_hard(mtx_t *, int type); -void mtx_destroy(mtx_t *m); +void mtx_init(struct mtx *m, char *description, int flag); +void mtx_enter_hard(struct mtx *, int type, int flags); +void mtx_exit_hard(struct mtx *, int type); +void mtx_destroy(struct mtx *m); /* * Wrap the following functions with cpp macros so that filenames and line * numbers are embedded in the code correctly. */ #if (defined(KLD_MODULE) || defined(_KERN_MUTEX_C_)) -void _mtx_enter(mtx_t *mtxp, int type, const char *file, int line); -int _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line); -void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); +void _mtx_enter(struct mtx *mtxp, int type, const char *file, int line); +int _mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line); +void _mtx_exit(struct mtx *mtxp, int type, const char *file, int line); #endif #define mtx_enter(mtxp, type) \ @@ -144,8 +142,8 @@ void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); _mtx_exit((mtxp), (type), __FILE__, __LINE__) /* Global locks */ -extern mtx_t sched_lock; -extern mtx_t Giant; +extern struct mtx sched_lock; +extern struct mtx Giant; /* * Used to replace return with an exit Giant and return. @@ -264,16 +262,16 @@ do { \ witness_restore(m, __CONCAT(n, __wf), __CONCAT(n, __wl)); \ } while (0) -void witness_init(mtx_t *, int flag); -void witness_destroy(mtx_t *); -void witness_enter(mtx_t *, int, const char *, int); -void witness_try_enter(mtx_t *, int, const char *, int); -void witness_exit(mtx_t *, int, const char *, int); +void witness_init(struct mtx *, int flag); +void witness_destroy(struct mtx *); +void witness_enter(struct mtx *, int, const char *, int); +void witness_try_enter(struct mtx *, int, const char *, int); +void witness_exit(struct mtx *, int, const char *, int); void witness_display(void(*)(const char *fmt, ...)); void witness_list(struct proc *); -int witness_sleep(int, mtx_t *, const char *, int); -void witness_save(mtx_t *, const char **, int *); -void witness_restore(mtx_t *, const char *, int); +int witness_sleep(int, struct mtx *, const char *, int); +void witness_save(struct mtx *, const char **, int *); +void witness_restore(struct mtx *, const char *, int); #else /* WITNESS */ #define WITNESS_ENTER(m, t, f, l) #define WITNESS_EXIT(m, t, f, l) @@ -602,9 +600,9 @@ extern char STR_mtx_try_enter_fmt[]; * Note: since type is usually a constant much of this code is optimized out. */ _MTX_INLINE void -_mtx_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *mpp = mtxp; + struct mtx *mpp = mtxp; /* bits only valid on mtx_exit() */ MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0, @@ -666,9 +664,9 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line) * XXX DOES NOT HANDLE RECURSION */ _MTX_INLINE int -_mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; int rval; rval = atomic_cmpset_int(&mpp->mtx_lock, MTX_UNOWNED, CURTHD); @@ -690,9 +688,9 @@ _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) * Release lock m. */ _MTX_INLINE void -_mtx_exit(mtx_t *mtxp, int type, const char *file, int line) +_mtx_exit(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; MPASS2(mtx_owned(mpp), STR_mtx_owned); WITNESS_EXIT(mpp, type, file, line); diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c index 76ae515..fe839ee 100644 --- a/sys/dev/random/yarrow.c +++ b/sys/dev/random/yarrow.c @@ -79,10 +79,10 @@ struct harvest { }; /* The reseed thread mutex */ -static mtx_t random_reseed_mtx; +static struct mtx random_reseed_mtx; /* The entropy harvest mutex */ -static mtx_t random_harvest_mtx; +static struct mtx random_harvest_mtx; /* <0 until the kthread starts, 0 for running */ static int random_kthread_status = -1; diff --git a/sys/dev/randomdev/yarrow.c b/sys/dev/randomdev/yarrow.c index 76ae515..fe839ee 100644 --- a/sys/dev/randomdev/yarrow.c +++ b/sys/dev/randomdev/yarrow.c @@ -79,10 +79,10 @@ struct harvest { }; /* The reseed thread mutex */ -static mtx_t random_reseed_mtx; +static struct mtx random_reseed_mtx; /* The entropy harvest mutex */ -static mtx_t random_harvest_mtx; +static struct mtx random_harvest_mtx; /* <0 until the kthread starts, 0 for running */ static int random_kthread_status = -1; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 0e5b0e1..8b1b08b 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -253,8 +253,8 @@ static struct trapframe proc0_tf; struct cpuhead cpuhead; -mtx_t sched_lock; -mtx_t Giant; +struct mtx sched_lock; +struct mtx Giant; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) diff --git a/sys/i386/i386/synch_machdep.c b/sys/i386/i386/synch_machdep.c index 12c7e14..5b847a4 100644 --- a/sys/i386/i386/synch_machdep.c +++ b/sys/i386/i386/synch_machdep.c @@ -45,7 +45,7 @@ #include <machine/mutex.h> /* All mutexes in system (used for debug/panic) */ -mtx_t all_mtx = { MTX_UNOWNED, 0, 0, "All mutexes queue head", +struct mtx all_mtx = { MTX_UNOWNED, 0, 0, "All mutexes queue head", TAILQ_HEAD_INITIALIZER(all_mtx.mtx_blocked), { NULL, NULL }, &all_mtx, &all_mtx #ifdef SMP_DEBUG @@ -90,7 +90,7 @@ static void propagate_priority(struct proc *p) { int pri = p->p_priority; - mtx_t *m = p->p_blocked; + struct mtx *m = p->p_blocked; for (;;) { struct proc *p1; @@ -182,7 +182,7 @@ propagate_priority(struct proc *p) } void -mtx_enter_hard(mtx_t *m, int type, int flags) +mtx_enter_hard(struct mtx *m, int type, int flags) { struct proc *p = CURPROC; @@ -335,10 +335,10 @@ mtx_enter_hard(mtx_t *m, int type, int flags) } void -mtx_exit_hard(mtx_t *m, int type) +mtx_exit_hard(struct mtx *m, int type) { struct proc *p, *p1; - mtx_t *m1; + struct mtx *m1; int pri; switch (type) { @@ -434,12 +434,12 @@ mtx_exit_hard(mtx_t *m, int type) #ifdef SMP_DEBUG -int mtx_validate __P((mtx_t *, int)); +int mtx_validate __P((struct mtx *, int)); int -mtx_validate(mtx_t *m, int when) +mtx_validate(struct mtx *m, int when) { - mtx_t *mp; + struct mtx *mp; int i; int retval = 0; @@ -492,7 +492,7 @@ mtx_validate(mtx_t *m, int when) #endif void -mtx_init(mtx_t *m, char *t, int flag) +mtx_init(struct mtx *m, char *t, int flag) { CTR2(KTR_LOCK, "mtx_init 0x%p (%s)", m, t); @@ -517,7 +517,7 @@ mtx_init(mtx_t *m, char *t, int flag) } void -mtx_destroy(mtx_t *m) +mtx_destroy(struct mtx *m) { CTR2(KTR_LOCK, "mtx_destroy 0x%p (%s)", m, m->mtx_description); diff --git a/sys/i386/include/mutex.h b/sys/i386/include/mutex.h index b19bfa9..11e752d 100644 --- a/sys/i386/include/mutex.h +++ b/sys/i386/include/mutex.h @@ -98,8 +98,6 @@ struct mtx { #endif /* SMP_DEBUG */ }; -typedef struct mtx mtx_t; - /* * Filler for structs which need to remain the same size * whether or not SMP_DEBUG is turned on. @@ -119,19 +117,19 @@ typedef struct mtxf { #define CURTHD ((u_int)CURPROC) /* Current thread ID */ /* Prototypes */ -void mtx_init(mtx_t *m, char *description, int flag); -void mtx_enter_hard(mtx_t *, int type, int flags); -void mtx_exit_hard(mtx_t *, int type); -void mtx_destroy(mtx_t *m); +void mtx_init(struct mtx *m, char *description, int flag); +void mtx_enter_hard(struct mtx *, int type, int flags); +void mtx_exit_hard(struct mtx *, int type); +void mtx_destroy(struct mtx *m); /* * Wrap the following functions with cpp macros so that filenames and line * numbers are embedded in the code correctly. */ #if (defined(KLD_MODULE) || defined(_KERN_MUTEX_C_)) -void _mtx_enter(mtx_t *mtxp, int type, const char *file, int line); -int _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line); -void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); +void _mtx_enter(struct mtx *mtxp, int type, const char *file, int line); +int _mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line); +void _mtx_exit(struct mtx *mtxp, int type, const char *file, int line); #endif #define mtx_enter(mtxp, type) \ @@ -144,8 +142,8 @@ void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); _mtx_exit((mtxp), (type), __FILE__, __LINE__) /* Global locks */ -extern mtx_t sched_lock; -extern mtx_t Giant; +extern struct mtx sched_lock; +extern struct mtx Giant; /* * Used to replace return with an exit Giant and return. @@ -264,16 +262,16 @@ do { \ witness_restore(m, __CONCAT(n, __wf), __CONCAT(n, __wl)); \ } while (0) -void witness_init(mtx_t *, int flag); -void witness_destroy(mtx_t *); -void witness_enter(mtx_t *, int, const char *, int); -void witness_try_enter(mtx_t *, int, const char *, int); -void witness_exit(mtx_t *, int, const char *, int); +void witness_init(struct mtx *, int flag); +void witness_destroy(struct mtx *); +void witness_enter(struct mtx *, int, const char *, int); +void witness_try_enter(struct mtx *, int, const char *, int); +void witness_exit(struct mtx *, int, const char *, int); void witness_display(void(*)(const char *fmt, ...)); void witness_list(struct proc *); -int witness_sleep(int, mtx_t *, const char *, int); -void witness_save(mtx_t *, const char **, int *); -void witness_restore(mtx_t *, const char *, int); +int witness_sleep(int, struct mtx *, const char *, int); +void witness_save(struct mtx *, const char **, int *); +void witness_restore(struct mtx *, const char *, int); #else /* WITNESS */ #define WITNESS_ENTER(m, t, f, l) #define WITNESS_EXIT(m, t, f, l) @@ -602,9 +600,9 @@ extern char STR_mtx_try_enter_fmt[]; * Note: since type is usually a constant much of this code is optimized out. */ _MTX_INLINE void -_mtx_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *mpp = mtxp; + struct mtx *mpp = mtxp; /* bits only valid on mtx_exit() */ MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0, @@ -666,9 +664,9 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line) * XXX DOES NOT HANDLE RECURSION */ _MTX_INLINE int -_mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; int rval; rval = atomic_cmpset_int(&mpp->mtx_lock, MTX_UNOWNED, CURTHD); @@ -690,9 +688,9 @@ _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) * Release lock m. */ _MTX_INLINE void -_mtx_exit(mtx_t *mtxp, int type, const char *file, int line) +_mtx_exit(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; MPASS2(mtx_owned(mpp), STR_mtx_owned); WITNESS_EXIT(mpp, type, file, line); diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 6279e01..96a14c6 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -75,7 +75,7 @@ static struct kmemusage *kmemusage; static char *kmembase; static char *kmemlimit; -mtx_t malloc_mtx; +struct mtx malloc_mtx; u_int vm_kmem_size; diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index b0346c2..96bbdf9 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -78,7 +78,7 @@ extern int witness_spin_check; int witness_watch; -typedef struct witness { +struct witness { struct witness *w_next; char *w_description; const char *w_file; @@ -92,12 +92,12 @@ typedef struct witness { u_char w_spin:1; /* this is a spin mutex */ u_int w_level; struct witness *w_children[WITNESS_NCHILDREN]; -} witness_t; +}; -typedef struct witness_blessed { +struct witness_blessed { char *b_lock1; char *b_lock2; -} witness_blessed_t; +}; #ifdef KDEBUG /* @@ -118,27 +118,27 @@ int witness_kdebug = WITNESS_KDEBUG; int witness_skipspin = WITNESS_SKIPSPIN; -static mtx_t w_mtx; -static witness_t *w_free; -static witness_t *w_all; -static int w_inited; -static int witness_dead; /* fatal error, probably no memory */ +static struct mtx w_mtx; +static struct witness *w_free; +static struct witness *w_all; +static int w_inited; +static int witness_dead; /* fatal error, probably no memory */ -static witness_t w_data[WITNESS_COUNT]; +static struct witness w_data[WITNESS_COUNT]; -static witness_t *enroll __P((char *description, int flag)); -static int itismychild __P((witness_t *parent, witness_t *child)); -static void removechild __P((witness_t *parent, witness_t *child)); -static int isitmychild __P((witness_t *parent, witness_t *child)); -static int isitmydescendant __P((witness_t *parent, witness_t *child)); -static int dup_ok __P((witness_t *)); -static int blessed __P((witness_t *, witness_t *)); +static struct witness *enroll __P((char *description, int flag)); +static int itismychild __P((struct witness *parent, struct witness *child)); +static void removechild __P((struct witness *parent, struct witness *child)); +static int isitmychild __P((struct witness *parent, struct witness *child)); +static int isitmydescendant __P((struct witness *parent, struct witness *child)); +static int dup_ok __P((struct witness *)); +static int blessed __P((struct witness *, struct witness *)); static void witness_displaydescendants - __P((void(*)(const char *fmt, ...), witness_t *)); -static void witness_leveldescendents __P((witness_t *parent, int level)); + __P((void(*)(const char *fmt, ...), struct witness *)); +static void witness_leveldescendents __P((struct witness *parent, int level)); static void witness_levelall __P((void)); -static witness_t * witness_get __P((void)); -static void witness_free __P((witness_t *m)); +static struct witness * witness_get __P((void)); +static void witness_free __P((struct witness *m)); static char *ignore_list[] = { @@ -198,20 +198,20 @@ static char *sleep_list[] = { * Pairs of locks which have been blessed * Don't complain about order problems with blessed locks */ -static witness_blessed_t blessed_list[] = { +static struct witness_blessed blessed_list[] = { }; -static int blessed_count = sizeof (blessed_list) / sizeof (witness_blessed_t); +static int blessed_count = sizeof(blessed_list) / sizeof(struct witness_blessed); void -witness_init(mtx_t *m, int flag) +witness_init(struct mtx *m, int flag) { m->mtx_witness = enroll(m->mtx_description, flag); } void -witness_destroy(mtx_t *m) +witness_destroy(struct mtx *m) { - mtx_t *m1; + struct mtx *m1; struct proc *p; p = CURPROC; for ((m1 = LIST_FIRST(&p->p_heldmtx)); m1 != NULL; @@ -226,10 +226,10 @@ witness_destroy(mtx_t *m) } void -witness_enter(mtx_t *m, int flags, const char *file, int line) +witness_enter(struct mtx *m, int flags, const char *file, int line) { - witness_t *w, *w1; - mtx_t *m1; + struct witness *w, *w1; + struct mtx *m1; struct proc *p; int i; #ifdef KDEBUG @@ -360,9 +360,9 @@ out: } void -witness_exit(mtx_t *m, int flags, const char *file, int line) +witness_exit(struct mtx *m, int flags, const char *file, int line) { - witness_t *w; + struct witness *w; w = m->mtx_witness; @@ -392,10 +392,10 @@ witness_exit(mtx_t *m, int flags, const char *file, int line) } void -witness_try_enter(mtx_t *m, int flags, const char *file, int line) +witness_try_enter(struct mtx *m, int flags, const char *file, int line) { struct proc *p; - witness_t *w = m->mtx_witness; + struct witness *w = m->mtx_witness; if (flags & MTX_SPIN) { if (!w->w_spin) @@ -429,7 +429,7 @@ witness_try_enter(mtx_t *m, int flags, const char *file, int line) void witness_display(void(*prnt)(const char *fmt, ...)) { - witness_t *w, *w1; + struct witness *w, *w1; witness_levelall(); @@ -456,9 +456,9 @@ witness_display(void(*prnt)(const char *fmt, ...)) } int -witness_sleep(int check_only, mtx_t *mtx, const char *file, int line) +witness_sleep(int check_only, struct mtx *mtx, const char *file, int line) { - mtx_t *m; + struct mtx *m; struct proc *p; char **sleep; int n = 0; @@ -485,11 +485,11 @@ witness_sleep(int check_only, mtx_t *mtx, const char *file, int line) return (n); } -static witness_t * +static struct witness * enroll(char *description, int flag) { int i; - witness_t *w, *w1; + struct witness *w, *w1; char **ignore; char **order; @@ -549,7 +549,7 @@ enroll(char *description, int flag) } static int -itismychild(witness_t *parent, witness_t *child) +itismychild(struct witness *parent, struct witness *child) { static int recursed; @@ -589,9 +589,9 @@ itismychild(witness_t *parent, witness_t *child) } static void -removechild(witness_t *parent, witness_t *child) +removechild(struct witness *parent, struct witness *child) { - witness_t *w, *w1; + struct witness *w, *w1; int i; for (w = parent; w != NULL; w = w->w_morechildren) @@ -617,9 +617,9 @@ found: } static int -isitmychild(witness_t *parent, witness_t *child) +isitmychild(struct witness *parent, struct witness *child) { - witness_t *w; + struct witness *w; int i; for (w = parent; w != NULL; w = w->w_morechildren) { @@ -632,9 +632,9 @@ isitmychild(witness_t *parent, witness_t *child) } static int -isitmydescendant(witness_t *parent, witness_t *child) +isitmydescendant(struct witness *parent, struct witness *child) { - witness_t *w; + struct witness *w; int i; int j; @@ -655,7 +655,7 @@ isitmydescendant(witness_t *parent, witness_t *child) void witness_levelall (void) { - witness_t *w, *w1; + struct witness *w, *w1; for (w = w_all; w; w = w->w_next) if (!w->w_spin) @@ -674,10 +674,10 @@ witness_levelall (void) } static void -witness_leveldescendents(witness_t *parent, int level) +witness_leveldescendents(struct witness *parent, int level) { int i; - witness_t *w; + struct witness *w; if (parent->w_level < level) parent->w_level = level; @@ -688,9 +688,10 @@ witness_leveldescendents(witness_t *parent, int level) } static void -witness_displaydescendants(void(*prnt)(const char *fmt, ...), witness_t *parent) +witness_displaydescendants(void(*prnt)(const char *fmt, ...), + struct witness *parent) { - witness_t *w; + struct witness *w; int i; int level = parent->w_level; @@ -714,7 +715,7 @@ witness_displaydescendants(void(*prnt)(const char *fmt, ...), witness_t *parent) } static int -dup_ok(witness_t *w) +dup_ok(struct witness *w) { char **dup; @@ -725,10 +726,10 @@ dup_ok(witness_t *w) } static int -blessed(witness_t *w1, witness_t *w2) +blessed(struct witness *w1, struct witness *w2) { int i; - witness_blessed_t *b; + struct witness_blessed *b; for (i = 0; i < blessed_count; i++) { b = &blessed_list[i]; @@ -744,10 +745,10 @@ blessed(witness_t *w1, witness_t *w2) return (0); } -static witness_t * +static struct witness * witness_get() { - witness_t *w; + struct witness *w; if ((w = w_free) == NULL) { witness_dead = 1; @@ -756,12 +757,12 @@ witness_get() return (NULL); } w_free = w->w_next; - bzero(w, sizeof (*w)); + bzero(w, sizeof(*w)); return (w); } static void -witness_free(witness_t *w) +witness_free(struct witness *w) { w->w_next = w_free; w_free = w; @@ -770,7 +771,7 @@ witness_free(witness_t *w) void witness_list(struct proc *p) { - mtx_t *m; + struct mtx *m; for ((m = LIST_FIRST(&p->p_heldmtx)); m != NULL; m = LIST_NEXT(m, mtx_held)) { @@ -781,14 +782,14 @@ witness_list(struct proc *p) } void -witness_save(mtx_t *m, const char **filep, int *linep) +witness_save(struct mtx *m, const char **filep, int *linep) { *filep = m->mtx_witness->w_file; *linep = m->mtx_witness->w_line; } void -witness_restore(mtx_t *m, const char *file, int line) +witness_restore(struct mtx *m, const char *file, int line) { m->mtx_witness->w_file = file; m->mtx_witness->w_line = line; diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index cd41140..a3f1998 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -416,7 +416,7 @@ sleepinit(void) int msleep(ident, mtx, priority, wmesg, timo) void *ident; - mtx_t *mtx; + struct mtx *mtx; int priority, timo; const char *wmesg; { diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index b0346c2..96bbdf9 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -78,7 +78,7 @@ extern int witness_spin_check; int witness_watch; -typedef struct witness { +struct witness { struct witness *w_next; char *w_description; const char *w_file; @@ -92,12 +92,12 @@ typedef struct witness { u_char w_spin:1; /* this is a spin mutex */ u_int w_level; struct witness *w_children[WITNESS_NCHILDREN]; -} witness_t; +}; -typedef struct witness_blessed { +struct witness_blessed { char *b_lock1; char *b_lock2; -} witness_blessed_t; +}; #ifdef KDEBUG /* @@ -118,27 +118,27 @@ int witness_kdebug = WITNESS_KDEBUG; int witness_skipspin = WITNESS_SKIPSPIN; -static mtx_t w_mtx; -static witness_t *w_free; -static witness_t *w_all; -static int w_inited; -static int witness_dead; /* fatal error, probably no memory */ +static struct mtx w_mtx; +static struct witness *w_free; +static struct witness *w_all; +static int w_inited; +static int witness_dead; /* fatal error, probably no memory */ -static witness_t w_data[WITNESS_COUNT]; +static struct witness w_data[WITNESS_COUNT]; -static witness_t *enroll __P((char *description, int flag)); -static int itismychild __P((witness_t *parent, witness_t *child)); -static void removechild __P((witness_t *parent, witness_t *child)); -static int isitmychild __P((witness_t *parent, witness_t *child)); -static int isitmydescendant __P((witness_t *parent, witness_t *child)); -static int dup_ok __P((witness_t *)); -static int blessed __P((witness_t *, witness_t *)); +static struct witness *enroll __P((char *description, int flag)); +static int itismychild __P((struct witness *parent, struct witness *child)); +static void removechild __P((struct witness *parent, struct witness *child)); +static int isitmychild __P((struct witness *parent, struct witness *child)); +static int isitmydescendant __P((struct witness *parent, struct witness *child)); +static int dup_ok __P((struct witness *)); +static int blessed __P((struct witness *, struct witness *)); static void witness_displaydescendants - __P((void(*)(const char *fmt, ...), witness_t *)); -static void witness_leveldescendents __P((witness_t *parent, int level)); + __P((void(*)(const char *fmt, ...), struct witness *)); +static void witness_leveldescendents __P((struct witness *parent, int level)); static void witness_levelall __P((void)); -static witness_t * witness_get __P((void)); -static void witness_free __P((witness_t *m)); +static struct witness * witness_get __P((void)); +static void witness_free __P((struct witness *m)); static char *ignore_list[] = { @@ -198,20 +198,20 @@ static char *sleep_list[] = { * Pairs of locks which have been blessed * Don't complain about order problems with blessed locks */ -static witness_blessed_t blessed_list[] = { +static struct witness_blessed blessed_list[] = { }; -static int blessed_count = sizeof (blessed_list) / sizeof (witness_blessed_t); +static int blessed_count = sizeof(blessed_list) / sizeof(struct witness_blessed); void -witness_init(mtx_t *m, int flag) +witness_init(struct mtx *m, int flag) { m->mtx_witness = enroll(m->mtx_description, flag); } void -witness_destroy(mtx_t *m) +witness_destroy(struct mtx *m) { - mtx_t *m1; + struct mtx *m1; struct proc *p; p = CURPROC; for ((m1 = LIST_FIRST(&p->p_heldmtx)); m1 != NULL; @@ -226,10 +226,10 @@ witness_destroy(mtx_t *m) } void -witness_enter(mtx_t *m, int flags, const char *file, int line) +witness_enter(struct mtx *m, int flags, const char *file, int line) { - witness_t *w, *w1; - mtx_t *m1; + struct witness *w, *w1; + struct mtx *m1; struct proc *p; int i; #ifdef KDEBUG @@ -360,9 +360,9 @@ out: } void -witness_exit(mtx_t *m, int flags, const char *file, int line) +witness_exit(struct mtx *m, int flags, const char *file, int line) { - witness_t *w; + struct witness *w; w = m->mtx_witness; @@ -392,10 +392,10 @@ witness_exit(mtx_t *m, int flags, const char *file, int line) } void -witness_try_enter(mtx_t *m, int flags, const char *file, int line) +witness_try_enter(struct mtx *m, int flags, const char *file, int line) { struct proc *p; - witness_t *w = m->mtx_witness; + struct witness *w = m->mtx_witness; if (flags & MTX_SPIN) { if (!w->w_spin) @@ -429,7 +429,7 @@ witness_try_enter(mtx_t *m, int flags, const char *file, int line) void witness_display(void(*prnt)(const char *fmt, ...)) { - witness_t *w, *w1; + struct witness *w, *w1; witness_levelall(); @@ -456,9 +456,9 @@ witness_display(void(*prnt)(const char *fmt, ...)) } int -witness_sleep(int check_only, mtx_t *mtx, const char *file, int line) +witness_sleep(int check_only, struct mtx *mtx, const char *file, int line) { - mtx_t *m; + struct mtx *m; struct proc *p; char **sleep; int n = 0; @@ -485,11 +485,11 @@ witness_sleep(int check_only, mtx_t *mtx, const char *file, int line) return (n); } -static witness_t * +static struct witness * enroll(char *description, int flag) { int i; - witness_t *w, *w1; + struct witness *w, *w1; char **ignore; char **order; @@ -549,7 +549,7 @@ enroll(char *description, int flag) } static int -itismychild(witness_t *parent, witness_t *child) +itismychild(struct witness *parent, struct witness *child) { static int recursed; @@ -589,9 +589,9 @@ itismychild(witness_t *parent, witness_t *child) } static void -removechild(witness_t *parent, witness_t *child) +removechild(struct witness *parent, struct witness *child) { - witness_t *w, *w1; + struct witness *w, *w1; int i; for (w = parent; w != NULL; w = w->w_morechildren) @@ -617,9 +617,9 @@ found: } static int -isitmychild(witness_t *parent, witness_t *child) +isitmychild(struct witness *parent, struct witness *child) { - witness_t *w; + struct witness *w; int i; for (w = parent; w != NULL; w = w->w_morechildren) { @@ -632,9 +632,9 @@ isitmychild(witness_t *parent, witness_t *child) } static int -isitmydescendant(witness_t *parent, witness_t *child) +isitmydescendant(struct witness *parent, struct witness *child) { - witness_t *w; + struct witness *w; int i; int j; @@ -655,7 +655,7 @@ isitmydescendant(witness_t *parent, witness_t *child) void witness_levelall (void) { - witness_t *w, *w1; + struct witness *w, *w1; for (w = w_all; w; w = w->w_next) if (!w->w_spin) @@ -674,10 +674,10 @@ witness_levelall (void) } static void -witness_leveldescendents(witness_t *parent, int level) +witness_leveldescendents(struct witness *parent, int level) { int i; - witness_t *w; + struct witness *w; if (parent->w_level < level) parent->w_level = level; @@ -688,9 +688,10 @@ witness_leveldescendents(witness_t *parent, int level) } static void -witness_displaydescendants(void(*prnt)(const char *fmt, ...), witness_t *parent) +witness_displaydescendants(void(*prnt)(const char *fmt, ...), + struct witness *parent) { - witness_t *w; + struct witness *w; int i; int level = parent->w_level; @@ -714,7 +715,7 @@ witness_displaydescendants(void(*prnt)(const char *fmt, ...), witness_t *parent) } static int -dup_ok(witness_t *w) +dup_ok(struct witness *w) { char **dup; @@ -725,10 +726,10 @@ dup_ok(witness_t *w) } static int -blessed(witness_t *w1, witness_t *w2) +blessed(struct witness *w1, struct witness *w2) { int i; - witness_blessed_t *b; + struct witness_blessed *b; for (i = 0; i < blessed_count; i++) { b = &blessed_list[i]; @@ -744,10 +745,10 @@ blessed(witness_t *w1, witness_t *w2) return (0); } -static witness_t * +static struct witness * witness_get() { - witness_t *w; + struct witness *w; if ((w = w_free) == NULL) { witness_dead = 1; @@ -756,12 +757,12 @@ witness_get() return (NULL); } w_free = w->w_next; - bzero(w, sizeof (*w)); + bzero(w, sizeof(*w)); return (w); } static void -witness_free(witness_t *w) +witness_free(struct witness *w) { w->w_next = w_free; w_free = w; @@ -770,7 +771,7 @@ witness_free(witness_t *w) void witness_list(struct proc *p) { - mtx_t *m; + struct mtx *m; for ((m = LIST_FIRST(&p->p_heldmtx)); m != NULL; m = LIST_NEXT(m, mtx_held)) { @@ -781,14 +782,14 @@ witness_list(struct proc *p) } void -witness_save(mtx_t *m, const char **filep, int *linep) +witness_save(struct mtx *m, const char **filep, int *linep) { *filep = m->mtx_witness->w_file; *linep = m->mtx_witness->w_line; } void -witness_restore(mtx_t *m, const char *file, int line) +witness_restore(struct mtx *m, const char *file, int line) { m->mtx_witness->w_file = file; m->mtx_witness->w_line = line; diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index b0346c2..96bbdf9 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -78,7 +78,7 @@ extern int witness_spin_check; int witness_watch; -typedef struct witness { +struct witness { struct witness *w_next; char *w_description; const char *w_file; @@ -92,12 +92,12 @@ typedef struct witness { u_char w_spin:1; /* this is a spin mutex */ u_int w_level; struct witness *w_children[WITNESS_NCHILDREN]; -} witness_t; +}; -typedef struct witness_blessed { +struct witness_blessed { char *b_lock1; char *b_lock2; -} witness_blessed_t; +}; #ifdef KDEBUG /* @@ -118,27 +118,27 @@ int witness_kdebug = WITNESS_KDEBUG; int witness_skipspin = WITNESS_SKIPSPIN; -static mtx_t w_mtx; -static witness_t *w_free; -static witness_t *w_all; -static int w_inited; -static int witness_dead; /* fatal error, probably no memory */ +static struct mtx w_mtx; +static struct witness *w_free; +static struct witness *w_all; +static int w_inited; +static int witness_dead; /* fatal error, probably no memory */ -static witness_t w_data[WITNESS_COUNT]; +static struct witness w_data[WITNESS_COUNT]; -static witness_t *enroll __P((char *description, int flag)); -static int itismychild __P((witness_t *parent, witness_t *child)); -static void removechild __P((witness_t *parent, witness_t *child)); -static int isitmychild __P((witness_t *parent, witness_t *child)); -static int isitmydescendant __P((witness_t *parent, witness_t *child)); -static int dup_ok __P((witness_t *)); -static int blessed __P((witness_t *, witness_t *)); +static struct witness *enroll __P((char *description, int flag)); +static int itismychild __P((struct witness *parent, struct witness *child)); +static void removechild __P((struct witness *parent, struct witness *child)); +static int isitmychild __P((struct witness *parent, struct witness *child)); +static int isitmydescendant __P((struct witness *parent, struct witness *child)); +static int dup_ok __P((struct witness *)); +static int blessed __P((struct witness *, struct witness *)); static void witness_displaydescendants - __P((void(*)(const char *fmt, ...), witness_t *)); -static void witness_leveldescendents __P((witness_t *parent, int level)); + __P((void(*)(const char *fmt, ...), struct witness *)); +static void witness_leveldescendents __P((struct witness *parent, int level)); static void witness_levelall __P((void)); -static witness_t * witness_get __P((void)); -static void witness_free __P((witness_t *m)); +static struct witness * witness_get __P((void)); +static void witness_free __P((struct witness *m)); static char *ignore_list[] = { @@ -198,20 +198,20 @@ static char *sleep_list[] = { * Pairs of locks which have been blessed * Don't complain about order problems with blessed locks */ -static witness_blessed_t blessed_list[] = { +static struct witness_blessed blessed_list[] = { }; -static int blessed_count = sizeof (blessed_list) / sizeof (witness_blessed_t); +static int blessed_count = sizeof(blessed_list) / sizeof(struct witness_blessed); void -witness_init(mtx_t *m, int flag) +witness_init(struct mtx *m, int flag) { m->mtx_witness = enroll(m->mtx_description, flag); } void -witness_destroy(mtx_t *m) +witness_destroy(struct mtx *m) { - mtx_t *m1; + struct mtx *m1; struct proc *p; p = CURPROC; for ((m1 = LIST_FIRST(&p->p_heldmtx)); m1 != NULL; @@ -226,10 +226,10 @@ witness_destroy(mtx_t *m) } void -witness_enter(mtx_t *m, int flags, const char *file, int line) +witness_enter(struct mtx *m, int flags, const char *file, int line) { - witness_t *w, *w1; - mtx_t *m1; + struct witness *w, *w1; + struct mtx *m1; struct proc *p; int i; #ifdef KDEBUG @@ -360,9 +360,9 @@ out: } void -witness_exit(mtx_t *m, int flags, const char *file, int line) +witness_exit(struct mtx *m, int flags, const char *file, int line) { - witness_t *w; + struct witness *w; w = m->mtx_witness; @@ -392,10 +392,10 @@ witness_exit(mtx_t *m, int flags, const char *file, int line) } void -witness_try_enter(mtx_t *m, int flags, const char *file, int line) +witness_try_enter(struct mtx *m, int flags, const char *file, int line) { struct proc *p; - witness_t *w = m->mtx_witness; + struct witness *w = m->mtx_witness; if (flags & MTX_SPIN) { if (!w->w_spin) @@ -429,7 +429,7 @@ witness_try_enter(mtx_t *m, int flags, const char *file, int line) void witness_display(void(*prnt)(const char *fmt, ...)) { - witness_t *w, *w1; + struct witness *w, *w1; witness_levelall(); @@ -456,9 +456,9 @@ witness_display(void(*prnt)(const char *fmt, ...)) } int -witness_sleep(int check_only, mtx_t *mtx, const char *file, int line) +witness_sleep(int check_only, struct mtx *mtx, const char *file, int line) { - mtx_t *m; + struct mtx *m; struct proc *p; char **sleep; int n = 0; @@ -485,11 +485,11 @@ witness_sleep(int check_only, mtx_t *mtx, const char *file, int line) return (n); } -static witness_t * +static struct witness * enroll(char *description, int flag) { int i; - witness_t *w, *w1; + struct witness *w, *w1; char **ignore; char **order; @@ -549,7 +549,7 @@ enroll(char *description, int flag) } static int -itismychild(witness_t *parent, witness_t *child) +itismychild(struct witness *parent, struct witness *child) { static int recursed; @@ -589,9 +589,9 @@ itismychild(witness_t *parent, witness_t *child) } static void -removechild(witness_t *parent, witness_t *child) +removechild(struct witness *parent, struct witness *child) { - witness_t *w, *w1; + struct witness *w, *w1; int i; for (w = parent; w != NULL; w = w->w_morechildren) @@ -617,9 +617,9 @@ found: } static int -isitmychild(witness_t *parent, witness_t *child) +isitmychild(struct witness *parent, struct witness *child) { - witness_t *w; + struct witness *w; int i; for (w = parent; w != NULL; w = w->w_morechildren) { @@ -632,9 +632,9 @@ isitmychild(witness_t *parent, witness_t *child) } static int -isitmydescendant(witness_t *parent, witness_t *child) +isitmydescendant(struct witness *parent, struct witness *child) { - witness_t *w; + struct witness *w; int i; int j; @@ -655,7 +655,7 @@ isitmydescendant(witness_t *parent, witness_t *child) void witness_levelall (void) { - witness_t *w, *w1; + struct witness *w, *w1; for (w = w_all; w; w = w->w_next) if (!w->w_spin) @@ -674,10 +674,10 @@ witness_levelall (void) } static void -witness_leveldescendents(witness_t *parent, int level) +witness_leveldescendents(struct witness *parent, int level) { int i; - witness_t *w; + struct witness *w; if (parent->w_level < level) parent->w_level = level; @@ -688,9 +688,10 @@ witness_leveldescendents(witness_t *parent, int level) } static void -witness_displaydescendants(void(*prnt)(const char *fmt, ...), witness_t *parent) +witness_displaydescendants(void(*prnt)(const char *fmt, ...), + struct witness *parent) { - witness_t *w; + struct witness *w; int i; int level = parent->w_level; @@ -714,7 +715,7 @@ witness_displaydescendants(void(*prnt)(const char *fmt, ...), witness_t *parent) } static int -dup_ok(witness_t *w) +dup_ok(struct witness *w) { char **dup; @@ -725,10 +726,10 @@ dup_ok(witness_t *w) } static int -blessed(witness_t *w1, witness_t *w2) +blessed(struct witness *w1, struct witness *w2) { int i; - witness_blessed_t *b; + struct witness_blessed *b; for (i = 0; i < blessed_count; i++) { b = &blessed_list[i]; @@ -744,10 +745,10 @@ blessed(witness_t *w1, witness_t *w2) return (0); } -static witness_t * +static struct witness * witness_get() { - witness_t *w; + struct witness *w; if ((w = w_free) == NULL) { witness_dead = 1; @@ -756,12 +757,12 @@ witness_get() return (NULL); } w_free = w->w_next; - bzero(w, sizeof (*w)); + bzero(w, sizeof(*w)); return (w); } static void -witness_free(witness_t *w) +witness_free(struct witness *w) { w->w_next = w_free; w_free = w; @@ -770,7 +771,7 @@ witness_free(witness_t *w) void witness_list(struct proc *p) { - mtx_t *m; + struct mtx *m; for ((m = LIST_FIRST(&p->p_heldmtx)); m != NULL; m = LIST_NEXT(m, mtx_held)) { @@ -781,14 +782,14 @@ witness_list(struct proc *p) } void -witness_save(mtx_t *m, const char **filep, int *linep) +witness_save(struct mtx *m, const char **filep, int *linep) { *filep = m->mtx_witness->w_file; *linep = m->mtx_witness->w_line; } void -witness_restore(mtx_t *m, const char *file, int line) +witness_restore(struct mtx *m, const char *file, int line) { m->mtx_witness->w_file = file; m->mtx_witness->w_line = line; diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index c8d8d7e..e785546 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -267,8 +267,8 @@ static struct trapframe proc0_tf; struct cpuhead cpuhead; -mtx_t sched_lock; -mtx_t Giant; +struct mtx sched_lock; +struct mtx Giant; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index c8d8d7e..e785546 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -267,8 +267,8 @@ static struct trapframe proc0_tf; struct cpuhead cpuhead; -mtx_t sched_lock; -mtx_t Giant; +struct mtx sched_lock; +struct mtx Giant; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) diff --git a/sys/powerpc/include/mutex.h b/sys/powerpc/include/mutex.h index ae4b5bb..99f9b7c 100644 --- a/sys/powerpc/include/mutex.h +++ b/sys/powerpc/include/mutex.h @@ -99,8 +99,6 @@ struct mtx { #endif /* SMP_DEBUG */ }; -typedef struct mtx mtx_t; - /* * Filler for structs which need to remain the same size * whether or not SMP_DEBUG is turned on. @@ -120,19 +118,19 @@ typedef struct mtxf { #define CURTHD ((u_int64_t)CURPROC) /* Current thread ID */ /* Prototypes */ -void mtx_init(mtx_t *m, char *description, int flag); -void mtx_enter_hard(mtx_t *, int type, int ipl); -void mtx_exit_hard(mtx_t *, int type); -void mtx_destroy(mtx_t *m); +void mtx_init(struct mtx *m, char *description, int flag); +void mtx_enter_hard(struct mtx *, int type, int ipl); +void mtx_exit_hard(struct mtx *, int type); +void mtx_destroy(struct mtx *m); /* * Wrap the following functions with cpp macros so that filenames and line * numbers are embedded in the code correctly. */ #if (defined(KLD_MODULE) || defined(_KERN_MUTEX_C_)) -void _mtx_enter(mtx_t *mtxp, int type, const char *file, int line); -int _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line); -void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); +void _mtx_enter(struct mtx *mtxp, int type, const char *file, int line); +int _mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line); +void _mtx_exit(struct mtx *mtxp, int type, const char *file, int line); #endif #define mtx_enter(mtxp, type) \ @@ -145,8 +143,8 @@ void _mtx_exit(mtx_t *mtxp, int type, const char *file, int line); _mtx_exit((mtxp), (type), __FILE__, __LINE__) /* Global locks */ -extern mtx_t sched_lock; -extern mtx_t Giant; +extern struct mtx sched_lock; +extern struct mtx Giant; /* * Used to replace return with an exit Giant and return. @@ -267,16 +265,16 @@ do { \ witness_restore(m, __CONCAT(n, __wf), __CONCAT(n, __wl)); \ } while (0) -void witness_init(mtx_t *, int flag); -void witness_destroy(mtx_t *); -void witness_enter(mtx_t *, int, const char *, int); -void witness_try_enter(mtx_t *, int, const char *, int); -void witness_exit(mtx_t *, int, const char *, int); +void witness_init(struct mtx *, int flag); +void witness_destroy(struct mtx *); +void witness_enter(struct mtx *, int, const char *, int); +void witness_try_enter(struct mtx *, int, const char *, int); +void witness_exit(struct mtx *, int, const char *, int); void witness_display(void(*)(const char *fmt, ...)); void witness_list(struct proc *); -int witness_sleep(int, mtx_t *, const char *, int); -void witness_save(mtx_t *, const char **, int *); -void witness_restore(mtx_t *, const char *, int); +int witness_sleep(int, struct mtx *, const char *, int); +void witness_save(struct mtx *, const char **, int *); +void witness_restore(struct mtx *, const char *, int); #else /* WITNESS */ #define WITNESS_ENTER(m, t, f, l) #define WITNESS_EXIT(m, t, f, l) @@ -424,9 +422,9 @@ extern char STR_mtx_try_enter_fmt[]; * Note: since type is usually a constant much of this code is optimized out */ _MTX_INLINE void -_mtx_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *mpp = mtxp; + struct mtx *mpp = mtxp; /* bits only valid on mtx_exit() */ MPASS2(((type) & (MTX_NORECURSE | MTX_NOSWITCH)) == 0, @@ -480,9 +478,9 @@ _mtx_enter(mtx_t *mtxp, int type, const char *file, int line) * XXX DOES NOT HANDLE RECURSION */ _MTX_INLINE int -_mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) +_mtx_try_enter(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; int rval; rval = atomic_cmpset_64(&mpp->mtx_lock, MTX_UNOWNED, CURTHD); @@ -502,9 +500,9 @@ _mtx_try_enter(mtx_t *mtxp, int type, const char *file, int line) * Release lock m */ _MTX_INLINE void -_mtx_exit(mtx_t *mtxp, int type, const char *file, int line) +_mtx_exit(struct mtx *mtxp, int type, const char *file, int line) { - mtx_t *const mpp = mtxp; + struct mtx *const mpp = mtxp; MPASS2(mtx_owned(mpp), STR_mtx_owned); WITNESS_EXIT(mpp, type, file, line); |