summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2018-06-08 15:38:15 +0000
committerguenther <guenther@openbsd.org>2018-06-08 15:38:15 +0000
commite0c5510e7ddba29f5e83400a0ff636d5ba7c972c (patch)
tree9050ef44f49d5b4ff4332cbc5d5b3d0b31cd5b49 /sys/kern
parentThe udp control option processing was implemented three times. (diff)
downloadwireguard-openbsd-e0c5510e7ddba29f5e83400a0ff636d5ba7c972c.tar.xz
wireguard-openbsd-e0c5510e7ddba29f5e83400a0ff636d5ba7c972c.zip
Constipate all the struct lock_type's so they go into .rodata
ok visa@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_lock.c6
-rw-r--r--sys/kern/kern_rwlock.c8
-rw-r--r--sys/kern/subr_pool.c10
-rw-r--r--sys/kern/subr_witness.c17
4 files changed, 21 insertions, 20 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 657e028d4c5..0c3e40e721d 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_lock.c,v 1.64 2018/05/14 12:31:21 mpi Exp $ */
+/* $OpenBSD: kern_lock.c,v 1.65 2018/06/08 15:38:15 guenther Exp $ */
/*
* Copyright (c) 2017 Visa Hankala
@@ -91,7 +91,7 @@ _kernel_lock_held(void)
#include <machine/cpu.h>
void
-___mp_lock_init(struct __mp_lock *mpl, struct lock_type *type)
+___mp_lock_init(struct __mp_lock *mpl, const struct lock_type *type)
{
memset(mpl->mpl_cpus, 0, sizeof(mpl->mpl_cpus));
mpl->mpl_users = 0;
@@ -374,7 +374,7 @@ __mtx_leave(struct mutex *mtx)
#ifdef WITNESS
void
_mtx_init_flags(struct mutex *m, int ipl, const char *name, int flags,
- struct lock_type *type)
+ const struct lock_type *type)
{
struct lock_object *lo = MUTEX_LOCK_OBJECT(m);
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index 97e22a5e966..eff5f167235 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_rwlock.c,v 1.36 2018/06/04 04:46:07 guenther Exp $ */
+/* $OpenBSD: kern_rwlock.c,v 1.37 2018/06/08 15:38:15 guenther Exp $ */
/*
* Copyright (c) 2002, 2003 Artur Grabowski <art@openbsd.org>
@@ -187,7 +187,7 @@ rw_enter_diag(struct rwlock *rwl, int flags)
static void
_rw_init_flags_witness(struct rwlock *rwl, const char *name, int lo_flags,
- struct lock_type *type)
+ const struct lock_type *type)
{
rwl->rwl_owner = 0;
rwl->rwl_name = name;
@@ -205,7 +205,7 @@ _rw_init_flags_witness(struct rwlock *rwl, const char *name, int lo_flags,
void
_rw_init_flags(struct rwlock *rwl, const char *name, int flags,
- struct lock_type *type)
+ const struct lock_type *type)
{
_rw_init_flags_witness(rwl, name, RWLOCK_LO_FLAGS(flags), type);
}
@@ -383,7 +383,7 @@ rw_assert_unlocked(struct rwlock *rwl)
/* recursive rwlocks; */
void
_rrw_init_flags(struct rrwlock *rrwl, char *name, int flags,
- struct lock_type *type)
+ const struct lock_type *type)
{
memset(rrwl, 0, sizeof(struct rrwlock));
_rw_init_flags_witness(&rrwl->rrwl_lock, name, RRWLOCK_LO_FLAGS(flags),
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index f1c08735591..4837ba927fc 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.222 2018/02/06 22:35:32 dlg Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.223 2018/06/08 15:38:15 guenther Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -77,7 +77,7 @@ struct pool phpool;
struct pool_lock_ops {
void (*pl_init)(struct pool *, union pool_lock *,
- struct lock_type *);
+ const struct lock_type *);
void (*pl_enter)(union pool_lock * LOCK_FL_VARS);
int (*pl_enter_try)(union pool_lock * LOCK_FL_VARS);
void (*pl_leave)(union pool_lock * LOCK_FL_VARS);
@@ -91,7 +91,7 @@ static const struct pool_lock_ops pool_lock_ops_rw;
#ifdef WITNESS
#define pl_init(pp, pl) do { \
- static struct lock_type __lock_type = { .lt_name = #pl }; \
+ static const struct lock_type __lock_type = { .lt_name = #pl }; \
(pp)->pr_lock_ops->pl_init(pp, pl, &__lock_type); \
} while (0)
#else /* WITNESS */
@@ -2190,7 +2190,7 @@ pool_cache_cpus_info(struct pool *pp, void *oldp, size_t *oldlenp)
void
pool_lock_mtx_init(struct pool *pp, union pool_lock *lock,
- struct lock_type *type)
+ const struct lock_type *type)
{
_mtx_init_flags(&lock->prl_mtx, pp->pr_ipl, pp->pr_wchan, 0, type);
}
@@ -2244,7 +2244,7 @@ static const struct pool_lock_ops pool_lock_ops_mtx = {
void
pool_lock_rw_init(struct pool *pp, union pool_lock *lock,
- struct lock_type *type)
+ const struct lock_type *type)
{
_rw_init_flags(&lock->prl_rwlock, pp->pr_wchan, 0, type);
}
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 2470ac13055..2f785d3a3d0 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_witness.c,v 1.18 2018/06/01 15:48:19 visa Exp $ */
+/* $OpenBSD: subr_witness.c,v 1.19 2018/06/08 15:38:15 guenther Exp $ */
/*-
* Copyright (c) 2008 Isilon Systems, Inc.
@@ -226,7 +226,7 @@ struct lock_list_entry {
* (for example, "vnode interlock").
*/
struct witness {
- struct lock_type *w_type;
+ const struct lock_type *w_type;
const char *w_subtype;
uint32_t w_index; /* Index in the relationship matrix */
struct lock_class *w_class;
@@ -282,7 +282,7 @@ struct witness_lock_order_hash {
};
struct witness_pendhelp {
- struct lock_type *wh_type;
+ const struct lock_type *wh_type;
struct lock_object *wh_lock;
};
@@ -315,7 +315,7 @@ witness_lock_order_key_equal(const struct witness_lock_order_key *a,
static int _isitmyx(struct witness *w1, struct witness *w2, int rmask,
const char *fname);
static void adopt(struct witness *parent, struct witness *child);
-static struct witness *enroll(struct lock_type *, const char *,
+static struct witness *enroll(const struct lock_type *, const char *,
struct lock_class *);
static struct lock_instance *find_instance(struct lock_list_entry *list,
const struct lock_object *lock);
@@ -337,7 +337,8 @@ static void witness_debugger(int dump);
static void witness_free(struct witness *m);
static struct witness *witness_get(void);
static uint32_t witness_hash_djb2(const uint8_t *key, uint32_t size);
-static struct witness *witness_hash_get(struct lock_type *, const char *);
+static struct witness *witness_hash_get(const struct lock_type *,
+ const char *);
static void witness_hash_put(struct witness *w);
static void witness_init_hash_tables(void);
static void witness_increment_graph_generation(void);
@@ -528,7 +529,7 @@ witness_initialize(void)
}
void
-witness_init(struct lock_object *lock, struct lock_type *type)
+witness_init(struct lock_object *lock, const struct lock_type *type)
{
struct lock_class *class;
@@ -1475,7 +1476,7 @@ witness_line(struct lock_object *lock)
}
static struct witness *
-enroll(struct lock_type *type, const char *subtype,
+enroll(const struct lock_type *type, const char *subtype,
struct lock_class *lock_class)
{
struct witness *w;
@@ -2369,7 +2370,7 @@ witness_init_hash_tables(void)
}
static struct witness *
-witness_hash_get(struct lock_type *type, const char *subtype)
+witness_hash_get(const struct lock_type *type, const char *subtype)
{
struct witness *w;
uint32_t hash;