Mon Dec 25 09:13:40 2017 UTC ()
Apply C99-style struct initialization to lockops_t


(ozaki-r)
diff -r1.39 -r1.40 src/sys/kern/kern_condvar.c
diff -r1.160 -r1.161 src/sys/kern/kern_lock.c
diff -r1.67 -r1.68 src/sys/kern/kern_mutex.c
diff -r1.47 -r1.48 src/sys/kern/kern_rwlock.c
diff -r1.75 -r1.76 src/sys/rump/librump/rumpkern/locks.c

cvs diff -r1.39 -r1.40 src/sys/kern/kern_condvar.c (expand / switch to unified diff)

--- 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
69static void cv_unsleep(lwp_t *, bool); 69static void cv_unsleep(lwp_t *, bool);
70static inline void cv_wakeup_one(kcondvar_t *); 70static inline void cv_wakeup_one(kcondvar_t *);
71static inline void cv_wakeup_all(kcondvar_t *); 71static inline void cv_wakeup_all(kcondvar_t *);
72 72
73static syncobj_t cv_syncobj = { 73static 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
81lockops_t cv_lockops = { 81lockops_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
87static const char deadcv[] = "deadcv"; 87static const char deadcv[] = "deadcv";
88#ifdef LOCKDEBUG 88#ifdef LOCKDEBUG
89static const char nodebug[] = "nodebug"; 89static 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
94static inline void 94static inline void
95cv_lockdebug_handoff(lwp_t *l, kcondvar_t *cv) 95cv_lockdebug_handoff(lwp_t *l, kcondvar_t *cv)
96{ 96{
97 97

cvs diff -r1.160 -r1.161 src/sys/kern/kern_lock.c (expand / switch to unified diff)

--- 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) \
112do { \ 112do { \
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
120void _kernel_lock_dump(const volatile void *); 120void _kernel_lock_dump(const volatile void *);
121 121
122lockops_t _kernel_lock_ops = { 122lockops_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 */
131void 131void
132kernel_lock_init(void) 132kernel_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}

cvs diff -r1.67 -r1.68 src/sys/kern/kern_mutex.c (expand / switch to unified diff)

--- 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
267static void mutex_abort(const char *, size_t, const kmutex_t *, 267static void mutex_abort(const char *, size_t, const kmutex_t *,
268 const char *); 268 const char *);
269static void mutex_dump(const volatile void *); 269static void mutex_dump(const volatile void *);
270 270
271lockops_t mutex_spin_lockops = { 271lockops_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
277lockops_t mutex_adaptive_lockops = { 277lockops_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
283syncobj_t mutex_syncobj = { 283syncobj_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 *

cvs diff -r1.47 -r1.48 src/sys/kern/kern_rwlock.c (expand / switch to unified diff)

--- 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
150lockops_t rwlock_lockops = { 150lockops_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
156syncobj_t rw_syncobj = { 156syncobj_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 *

cvs diff -r1.75 -r1.76 src/sys/rump/librump/rumpkern/locks.c (expand / switch to unified diff)

--- 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
41const int rump_lockdebug = 1; 41const int rump_lockdebug = 1;
42#else 42#else
43const int rump_lockdebug = 0; 43const 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
53static lockops_t mutex_lockops = { 53static 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};
58static lockops_t rw_lockops = { 58static 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)