diff options
Diffstat (limited to 'sys/i386')
-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 |
3 files changed, 35 insertions, 37 deletions
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); |