Apply C99-style struct initialization to lockops_tdiff -r1.39 -r1.40 src/sys/kern/kern_condvar.c
(ozaki-r)
--- src/sys/kern/kern_condvar.c 2017/11/12 20:04:51 1.39
+++ src/sys/kern/kern_condvar.c 2017/12/25 09:13:40 1.40
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kern_condvar.c,v 1.39 2017/11/12 20:04:51 riastradh Exp $ */ | 1 | /* $NetBSD: kern_condvar.c,v 1.40 2017/12/25 09:13:40 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Andrew Doran. | 8 | * by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Kernel condition variable implementation. | 33 | * Kernel condition variable implementation. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.39 2017/11/12 20:04:51 riastradh Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.40 2017/12/25 09:13:40 ozaki-r Exp $"); | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/lwp.h> | 41 | #include <sys/lwp.h> | |
42 | #include <sys/condvar.h> | 42 | #include <sys/condvar.h> | |
43 | #include <sys/sleepq.h> | 43 | #include <sys/sleepq.h> | |
44 | #include <sys/lockdebug.h> | 44 | #include <sys/lockdebug.h> | |
45 | #include <sys/cpu.h> | 45 | #include <sys/cpu.h> | |
46 | #include <sys/kernel.h> | 46 | #include <sys/kernel.h> | |
47 | 47 | |||
48 | /* | 48 | /* | |
49 | * Accessors for the private contents of the kcondvar_t data type. | 49 | * Accessors for the private contents of the kcondvar_t data type. | |
50 | * | 50 | * | |
@@ -69,29 +69,29 @@ __KERNEL_RCSID(0, "$NetBSD: kern_condvar | @@ -69,29 +69,29 @@ __KERNEL_RCSID(0, "$NetBSD: kern_condvar | |||
69 | static void cv_unsleep(lwp_t *, bool); | 69 | static void cv_unsleep(lwp_t *, bool); | |
70 | static inline void cv_wakeup_one(kcondvar_t *); | 70 | static inline void cv_wakeup_one(kcondvar_t *); | |
71 | static inline void cv_wakeup_all(kcondvar_t *); | 71 | static inline void cv_wakeup_all(kcondvar_t *); | |
72 | 72 | |||
73 | static syncobj_t cv_syncobj = { | 73 | static syncobj_t cv_syncobj = { | |
74 | SOBJ_SLEEPQ_SORTED, | 74 | SOBJ_SLEEPQ_SORTED, | |
75 | cv_unsleep, | 75 | cv_unsleep, | |
76 | sleepq_changepri, | 76 | sleepq_changepri, | |
77 | sleepq_lendpri, | 77 | sleepq_lendpri, | |
78 | syncobj_noowner, | 78 | syncobj_noowner, | |
79 | }; | 79 | }; | |
80 | 80 | |||
81 | lockops_t cv_lockops = { | 81 | lockops_t cv_lockops = { | |
82 | "Condition variable", | 82 | .lo_name = "Condition variable", | |
83 | LOCKOPS_CV, | 83 | .lo_type = LOCKOPS_CV, | |
84 | NULL | 84 | .lo_dump = NULL, | |
85 | }; | 85 | }; | |
86 | 86 | |||
87 | static const char deadcv[] = "deadcv"; | 87 | static const char deadcv[] = "deadcv"; | |
88 | #ifdef LOCKDEBUG | 88 | #ifdef LOCKDEBUG | |
89 | static const char nodebug[] = "nodebug"; | 89 | static const char nodebug[] = "nodebug"; | |
90 | 90 | |||
91 | #define CV_LOCKDEBUG_HANDOFF(l, cv) cv_lockdebug_handoff(l, cv) | 91 | #define CV_LOCKDEBUG_HANDOFF(l, cv) cv_lockdebug_handoff(l, cv) | |
92 | #define CV_LOCKDEBUG_PROCESS(l, cv) cv_lockdebug_process(l, cv) | 92 | #define CV_LOCKDEBUG_PROCESS(l, cv) cv_lockdebug_process(l, cv) | |
93 | 93 | |||
94 | static inline void | 94 | static inline void | |
95 | cv_lockdebug_handoff(lwp_t *l, kcondvar_t *cv) | 95 | cv_lockdebug_handoff(lwp_t *l, kcondvar_t *cv) | |
96 | { | 96 | { | |
97 | 97 |
--- src/sys/kern/kern_lock.c 2017/11/21 08:49:14 1.160
+++ src/sys/kern/kern_lock.c 2017/12/25 09:13:40 1.161
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kern_lock.c,v 1.160 2017/11/21 08:49:14 ozaki-r Exp $ */ | 1 | /* $NetBSD: kern_lock.c,v 1.161 2017/12/25 09:13:40 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center, and by Andrew Doran. | 9 | * NASA Ames Research Center, and by Andrew Doran. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.160 2017/11/21 08:49:14 ozaki-r Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.161 2017/12/25 09:13:40 ozaki-r Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/proc.h> | 37 | #include <sys/proc.h> | |
38 | #include <sys/lock.h> | 38 | #include <sys/lock.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/kernel.h> | 40 | #include <sys/kernel.h> | |
41 | #include <sys/lockdebug.h> | 41 | #include <sys/lockdebug.h> | |
42 | #include <sys/cpu.h> | 42 | #include <sys/cpu.h> | |
43 | #include <sys/syslog.h> | 43 | #include <sys/syslog.h> | |
44 | #include <sys/atomic.h> | 44 | #include <sys/atomic.h> | |
45 | #include <sys/lwp.h> | 45 | #include <sys/lwp.h> | |
46 | #include <sys/pserialize.h> | 46 | #include <sys/pserialize.h> | |
47 | 47 | |||
@@ -110,29 +110,29 @@ assert_sleepable(void) | @@ -110,29 +110,29 @@ assert_sleepable(void) | |||
110 | #ifdef LOCKDEBUG | 110 | #ifdef LOCKDEBUG | |
111 | #define _KERNEL_LOCK_ASSERT(cond) \ | 111 | #define _KERNEL_LOCK_ASSERT(cond) \ | |
112 | do { \ | 112 | do { \ | |
113 | if (!(cond)) \ | 113 | if (!(cond)) \ | |
114 | _KERNEL_LOCK_ABORT("assertion failed: " #cond); \ | 114 | _KERNEL_LOCK_ABORT("assertion failed: " #cond); \ | |
115 | } while (/* CONSTCOND */ 0) | 115 | } while (/* CONSTCOND */ 0) | |
116 | #else | 116 | #else | |
117 | #define _KERNEL_LOCK_ASSERT(cond) /* nothing */ | 117 | #define _KERNEL_LOCK_ASSERT(cond) /* nothing */ | |
118 | #endif | 118 | #endif | |
119 | 119 | |||
120 | void _kernel_lock_dump(const volatile void *); | 120 | void _kernel_lock_dump(const volatile void *); | |
121 | 121 | |||
122 | lockops_t _kernel_lock_ops = { | 122 | lockops_t _kernel_lock_ops = { | |
123 | "Kernel lock", | 123 | .lo_name = "Kernel lock", | |
124 | LOCKOPS_SPIN, | 124 | .lo_type = LOCKOPS_SPIN, | |
125 | _kernel_lock_dump | 125 | .lo_dump = _kernel_lock_dump, | |
126 | }; | 126 | }; | |
127 | 127 | |||
128 | /* | 128 | /* | |
129 | * Initialize the kernel lock. | 129 | * Initialize the kernel lock. | |
130 | */ | 130 | */ | |
131 | void | 131 | void | |
132 | kernel_lock_init(void) | 132 | kernel_lock_init(void) | |
133 | { | 133 | { | |
134 | 134 | |||
135 | __cpu_simple_lock_init(kernel_lock); | 135 | __cpu_simple_lock_init(kernel_lock); | |
136 | kernel_lock_dodebug = LOCKDEBUG_ALLOC(kernel_lock, &_kernel_lock_ops, | 136 | kernel_lock_dodebug = LOCKDEBUG_ALLOC(kernel_lock, &_kernel_lock_ops, | |
137 | RETURN_ADDRESS); | 137 | RETURN_ADDRESS); | |
138 | } | 138 | } |
--- src/sys/kern/kern_mutex.c 2017/09/16 23:55:33 1.67
+++ src/sys/kern/kern_mutex.c 2017/12/25 09:13:40 1.68
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kern_mutex.c,v 1.67 2017/09/16 23:55:33 christos Exp $ */ | 1 | /* $NetBSD: kern_mutex.c,v 1.68 2017/12/25 09:13:40 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe and Andrew Doran. | 8 | * by Jason R. Thorpe and Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -30,27 +30,27 @@ | @@ -30,27 +30,27 @@ | |||
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Kernel mutex implementation, modeled after those found in Solaris, | 33 | * Kernel mutex implementation, modeled after those found in Solaris, | |
34 | * a description of which can be found in: | 34 | * a description of which can be found in: | |
35 | * | 35 | * | |
36 | * Solaris Internals: Core Kernel Architecture, Jim Mauro and | 36 | * Solaris Internals: Core Kernel Architecture, Jim Mauro and | |
37 | * Richard McDougall. | 37 | * Richard McDougall. | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | #define __MUTEX_PRIVATE | 40 | #define __MUTEX_PRIVATE | |
41 | 41 | |||
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.67 2017/09/16 23:55:33 christos Exp $"); | 43 | __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.68 2017/12/25 09:13:40 ozaki-r Exp $"); | |
44 | 44 | |||
45 | #include <sys/param.h> | 45 | #include <sys/param.h> | |
46 | #include <sys/atomic.h> | 46 | #include <sys/atomic.h> | |
47 | #include <sys/proc.h> | 47 | #include <sys/proc.h> | |
48 | #include <sys/mutex.h> | 48 | #include <sys/mutex.h> | |
49 | #include <sys/sched.h> | 49 | #include <sys/sched.h> | |
50 | #include <sys/sleepq.h> | 50 | #include <sys/sleepq.h> | |
51 | #include <sys/systm.h> | 51 | #include <sys/systm.h> | |
52 | #include <sys/lockdebug.h> | 52 | #include <sys/lockdebug.h> | |
53 | #include <sys/kernel.h> | 53 | #include <sys/kernel.h> | |
54 | #include <sys/intr.h> | 54 | #include <sys/intr.h> | |
55 | #include <sys/lock.h> | 55 | #include <sys/lock.h> | |
56 | #include <sys/types.h> | 56 | #include <sys/types.h> | |
@@ -259,35 +259,35 @@ __strong_alias(mutex_enter,mutex_vector_ | @@ -259,35 +259,35 @@ __strong_alias(mutex_enter,mutex_vector_ | |||
259 | __strong_alias(mutex_exit,mutex_vector_exit); | 259 | __strong_alias(mutex_exit,mutex_vector_exit); | |
260 | #endif | 260 | #endif | |
261 | 261 | |||
262 | #ifndef __HAVE_SPIN_MUTEX_STUBS | 262 | #ifndef __HAVE_SPIN_MUTEX_STUBS | |
263 | __strong_alias(mutex_spin_enter,mutex_vector_enter); | 263 | __strong_alias(mutex_spin_enter,mutex_vector_enter); | |
264 | __strong_alias(mutex_spin_exit,mutex_vector_exit); | 264 | __strong_alias(mutex_spin_exit,mutex_vector_exit); | |
265 | #endif | 265 | #endif | |
266 | 266 | |||
267 | static void mutex_abort(const char *, size_t, const kmutex_t *, | 267 | static void mutex_abort(const char *, size_t, const kmutex_t *, | |
268 | const char *); | 268 | const char *); | |
269 | static void mutex_dump(const volatile void *); | 269 | static void mutex_dump(const volatile void *); | |
270 | 270 | |||
271 | lockops_t mutex_spin_lockops = { | 271 | lockops_t mutex_spin_lockops = { | |
272 | "Mutex", | 272 | .lo_name = "Mutex", | |
273 | LOCKOPS_SPIN, | 273 | .lo_type = LOCKOPS_SPIN, | |
274 | mutex_dump | 274 | .lo_dump = mutex_dump, | |
275 | }; | 275 | }; | |
276 | 276 | |||
277 | lockops_t mutex_adaptive_lockops = { | 277 | lockops_t mutex_adaptive_lockops = { | |
278 | "Mutex", | 278 | .lo_name = "Mutex", | |
279 | LOCKOPS_SLEEP, | 279 | .lo_type = LOCKOPS_SLEEP, | |
280 | mutex_dump | 280 | .lo_dump = mutex_dump, | |
281 | }; | 281 | }; | |
282 | 282 | |||
283 | syncobj_t mutex_syncobj = { | 283 | syncobj_t mutex_syncobj = { | |
284 | SOBJ_SLEEPQ_SORTED, | 284 | SOBJ_SLEEPQ_SORTED, | |
285 | turnstile_unsleep, | 285 | turnstile_unsleep, | |
286 | turnstile_changepri, | 286 | turnstile_changepri, | |
287 | sleepq_lendpri, | 287 | sleepq_lendpri, | |
288 | (void *)mutex_owner, | 288 | (void *)mutex_owner, | |
289 | }; | 289 | }; | |
290 | 290 | |||
291 | /* | 291 | /* | |
292 | * mutex_dump: | 292 | * mutex_dump: | |
293 | * | 293 | * |
--- src/sys/kern/kern_rwlock.c 2017/09/16 23:55:33 1.47
+++ src/sys/kern/kern_rwlock.c 2017/12/25 09:13:40 1.48
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kern_rwlock.c,v 1.47 2017/09/16 23:55:33 christos Exp $ */ | 1 | /* $NetBSD: kern_rwlock.c,v 1.48 2017/12/25 09:13:40 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe and Andrew Doran. | 8 | * by Jason R. Thorpe and Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -28,27 +28,27 @@ | @@ -28,27 +28,27 @@ | |||
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Kernel reader/writer lock implementation, modeled after those | 33 | * Kernel reader/writer lock implementation, modeled after those | |
34 | * found in Solaris, a description of which can be found in: | 34 | * found in Solaris, a description of which can be found in: | |
35 | * | 35 | * | |
36 | * Solaris Internals: Core Kernel Architecture, Jim Mauro and | 36 | * Solaris Internals: Core Kernel Architecture, Jim Mauro and | |
37 | * Richard McDougall. | 37 | * Richard McDougall. | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | #include <sys/cdefs.h> | 40 | #include <sys/cdefs.h> | |
41 | __KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.47 2017/09/16 23:55:33 christos Exp $"); | 41 | __KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.48 2017/12/25 09:13:40 ozaki-r Exp $"); | |
42 | 42 | |||
43 | #define __RWLOCK_PRIVATE | 43 | #define __RWLOCK_PRIVATE | |
44 | 44 | |||
45 | #include <sys/param.h> | 45 | #include <sys/param.h> | |
46 | #include <sys/proc.h> | 46 | #include <sys/proc.h> | |
47 | #include <sys/rwlock.h> | 47 | #include <sys/rwlock.h> | |
48 | #include <sys/sched.h> | 48 | #include <sys/sched.h> | |
49 | #include <sys/sleepq.h> | 49 | #include <sys/sleepq.h> | |
50 | #include <sys/systm.h> | 50 | #include <sys/systm.h> | |
51 | #include <sys/lockdebug.h> | 51 | #include <sys/lockdebug.h> | |
52 | #include <sys/cpu.h> | 52 | #include <sys/cpu.h> | |
53 | #include <sys/atomic.h> | 53 | #include <sys/atomic.h> | |
54 | #include <sys/lock.h> | 54 | #include <sys/lock.h> | |
@@ -138,29 +138,29 @@ rw_swap(krwlock_t *rw, uintptr_t o, uint | @@ -138,29 +138,29 @@ rw_swap(krwlock_t *rw, uintptr_t o, uint | |||
138 | * For platforms that do not provide stubs, or for the LOCKDEBUG case. | 138 | * For platforms that do not provide stubs, or for the LOCKDEBUG case. | |
139 | */ | 139 | */ | |
140 | #ifdef LOCKDEBUG | 140 | #ifdef LOCKDEBUG | |
141 | #undef __HAVE_RW_STUBS | 141 | #undef __HAVE_RW_STUBS | |
142 | #endif | 142 | #endif | |
143 | 143 | |||
144 | #ifndef __HAVE_RW_STUBS | 144 | #ifndef __HAVE_RW_STUBS | |
145 | __strong_alias(rw_enter,rw_vector_enter); | 145 | __strong_alias(rw_enter,rw_vector_enter); | |
146 | __strong_alias(rw_exit,rw_vector_exit); | 146 | __strong_alias(rw_exit,rw_vector_exit); | |
147 | __strong_alias(rw_tryenter,rw_vector_tryenter); | 147 | __strong_alias(rw_tryenter,rw_vector_tryenter); | |
148 | #endif | 148 | #endif | |
149 | 149 | |||
150 | lockops_t rwlock_lockops = { | 150 | lockops_t rwlock_lockops = { | |
151 | "Reader / writer lock", | 151 | .lo_name = "Reader / writer lock", | |
152 | LOCKOPS_SLEEP, | 152 | .lo_type = LOCKOPS_SLEEP, | |
153 | rw_dump | 153 | .lo_dump = rw_dump, | |
154 | }; | 154 | }; | |
155 | 155 | |||
156 | syncobj_t rw_syncobj = { | 156 | syncobj_t rw_syncobj = { | |
157 | SOBJ_SLEEPQ_SORTED, | 157 | SOBJ_SLEEPQ_SORTED, | |
158 | turnstile_unsleep, | 158 | turnstile_unsleep, | |
159 | turnstile_changepri, | 159 | turnstile_changepri, | |
160 | sleepq_lendpri, | 160 | sleepq_lendpri, | |
161 | rw_owner, | 161 | rw_owner, | |
162 | }; | 162 | }; | |
163 | 163 | |||
164 | /* | 164 | /* | |
165 | * rw_dump: | 165 | * rw_dump: | |
166 | * | 166 | * |
--- src/sys/rump/librump/rumpkern/locks.c 2017/09/17 05:47:19 1.75
+++ src/sys/rump/librump/rumpkern/locks.c 2017/12/25 09:13:40 1.76
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: locks.c,v 1.75 2017/09/17 05:47:19 kre Exp $ */ | 1 | /* $NetBSD: locks.c,v 1.76 2017/12/25 09:13:40 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -16,59 +16,59 @@ | @@ -16,59 +16,59 @@ | |||
16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
25 | * SUCH DAMAGE. | 25 | * SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | #include <sys/cdefs.h> | 28 | #include <sys/cdefs.h> | |
29 | __KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.75 2017/09/17 05:47:19 kre Exp $"); | 29 | __KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.76 2017/12/25 09:13:40 ozaki-r Exp $"); | |
30 | 30 | |||
31 | #include <sys/param.h> | 31 | #include <sys/param.h> | |
32 | #include <sys/kmem.h> | 32 | #include <sys/kmem.h> | |
33 | #include <sys/mutex.h> | 33 | #include <sys/mutex.h> | |
34 | #include <sys/rwlock.h> | 34 | #include <sys/rwlock.h> | |
35 | 35 | |||
36 | #include <rump-sys/kern.h> | 36 | #include <rump-sys/kern.h> | |
37 | 37 | |||
38 | #include <rump/rumpuser.h> | 38 | #include <rump/rumpuser.h> | |
39 | 39 | |||
40 | #ifdef LOCKDEBUG | 40 | #ifdef LOCKDEBUG | |
41 | const int rump_lockdebug = 1; | 41 | const int rump_lockdebug = 1; | |
42 | #else | 42 | #else | |
43 | const int rump_lockdebug = 0; | 43 | const int rump_lockdebug = 0; | |
44 | #endif | 44 | #endif | |
45 | 45 | |||
46 | /* | 46 | /* | |
47 | * Simple lockdebug. If it's compiled in, it's always active. | 47 | * Simple lockdebug. If it's compiled in, it's always active. | |
48 | * Currently available only for mtx/rwlock. | 48 | * Currently available only for mtx/rwlock. | |
49 | */ | 49 | */ | |
50 | #ifdef LOCKDEBUG | 50 | #ifdef LOCKDEBUG | |
51 | #include <sys/lockdebug.h> | 51 | #include <sys/lockdebug.h> | |
52 | 52 | |||
53 | static lockops_t mutex_lockops = { | 53 | static lockops_t mutex_lockops = { | |
54 | "mutex", | 54 | .lo_name = "mutex", | |
55 | LOCKOPS_SLEEP, | 55 | .lo_type = LOCKOPS_SLEEP, | |
56 | NULL | 56 | .lo_dump = NULL, | |
57 | }; | 57 | }; | |
58 | static lockops_t rw_lockops = { | 58 | static lockops_t rw_lockops = { | |
59 | "rwlock", | 59 | .lo_name = "rwlock", | |
60 | LOCKOPS_SLEEP, | 60 | .lo_type = LOCKOPS_SLEEP, | |
61 | NULL | 61 | .lo_dump = NULL, | |
62 | }; | 62 | }; | |
63 | 63 | |||
64 | #define ALLOCK(lock, ops) \ | 64 | #define ALLOCK(lock, ops) \ | |
65 | lockdebug_alloc(__func__, __LINE__, lock, ops, \ | 65 | lockdebug_alloc(__func__, __LINE__, lock, ops, \ | |
66 | (uintptr_t)__builtin_return_address(0)) | 66 | (uintptr_t)__builtin_return_address(0)) | |
67 | #define FREELOCK(lock) \ | 67 | #define FREELOCK(lock) \ | |
68 | lockdebug_free(__func__, __LINE__, lock) | 68 | lockdebug_free(__func__, __LINE__, lock) | |
69 | #define WANTLOCK(lock, shar) \ | 69 | #define WANTLOCK(lock, shar) \ | |
70 | lockdebug_wantlock(__func__, __LINE__, lock, \ | 70 | lockdebug_wantlock(__func__, __LINE__, lock, \ | |
71 | (uintptr_t)__builtin_return_address(0), shar) | 71 | (uintptr_t)__builtin_return_address(0), shar) | |
72 | #define LOCKED(lock, shar) \ | 72 | #define LOCKED(lock, shar) \ | |
73 | lockdebug_locked(__func__, __LINE__, lock, NULL, \ | 73 | lockdebug_locked(__func__, __LINE__, lock, NULL, \ | |
74 | (uintptr_t)__builtin_return_address(0), shar) | 74 | (uintptr_t)__builtin_return_address(0), shar) |