summaryrefslogtreecommitdiffstats
path: root/sys/sys
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-11-16 21:51:17 +0000
committerpjd <pjd@FreeBSD.org>2011-11-16 21:51:17 +0000
commita3e664d830a8cf18b39de7e24de3b6945e09d802 (patch)
tree0f843eda4349e58b83edfddade168cfeeb527616 /sys/sys
parent8f7796960e5324d9006d05ab644c421a3428a863 (diff)
downloadFreeBSD-src-a3e664d830a8cf18b39de7e24de3b6945e09d802.zip
FreeBSD-src-a3e664d830a8cf18b39de7e24de3b6945e09d802.tar.gz
Constify arguments for locking KPIs where possible.
This enables locking consumers to pass their own structures around as const and be able to assert locks embedded into those structures. Reviewed by: ed, kib, jhb
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/lock.h8
-rw-r--r--sys/sys/lockmgr.h6
-rw-r--r--sys/sys/mutex.h2
-rw-r--r--sys/sys/rmlock.h2
-rw-r--r--sys/sys/rwlock.h4
-rw-r--r--sys/sys/sx.h2
6 files changed, 12 insertions, 12 deletions
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 7ad9c58..303717f 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -58,10 +58,10 @@ struct thread;
struct lock_class {
const char *lc_name;
u_int lc_flags;
- void (*lc_assert)(struct lock_object *lock, int what);
- void (*lc_ddb_show)(struct lock_object *lock);
+ void (*lc_assert)(const struct lock_object *lock, int what);
+ void (*lc_ddb_show)(const struct lock_object *lock);
void (*lc_lock)(struct lock_object *lock, int how);
- int (*lc_owner)(struct lock_object *lock, struct thread **owner);
+ int (*lc_owner)(const struct lock_object *lock, struct thread **owner);
int (*lc_unlock)(struct lock_object *lock);
};
@@ -215,7 +215,7 @@ void witness_restore(struct lock_object *, const char *, int);
int witness_list_locks(struct lock_list_entry **,
int (*)(const char *, ...));
int witness_warn(int, struct lock_object *, const char *, ...);
-void witness_assert(struct lock_object *, int, const char *, int);
+void witness_assert(const struct lock_object *, int, const char *, int);
void witness_display_spinlock(struct lock_object *, struct thread *,
int (*)(const char *, ...));
int witness_line(struct lock_object *);
diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h
index 4c3a272..1a2c92c 100644
--- a/sys/sys/lockmgr.h
+++ b/sys/sys/lockmgr.h
@@ -69,7 +69,7 @@ struct thread;
int __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
const char *wmesg, int prio, int timo, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _lockmgr_assert(struct lock *lk, int what, const char *file, int line);
+void _lockmgr_assert(const struct lock *lk, int what, const char *file, int line);
#endif
void _lockmgr_disown(struct lock *lk, const char *file, int line);
@@ -82,8 +82,8 @@ void lockinit(struct lock *lk, int prio, const char *wmesg, int timo,
#ifdef DDB
int lockmgr_chain(struct thread *td, struct thread **ownerp);
#endif
-void lockmgr_printinfo(struct lock *lk);
-int lockstatus(struct lock *lk);
+void lockmgr_printinfo(const struct lock *lk);
+int lockstatus(const struct lock *lk);
/*
* As far as the ilk can be a static NULL pointer these functions need a
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index e7e0b28..7a9d5d7 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -105,7 +105,7 @@ void _mtx_lock_spin_flags(struct mtx *m, int opts, const char *file,
void _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file,
int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _mtx_assert(struct mtx *m, int what, const char *file, int line);
+void _mtx_assert(const struct mtx *m, int what, const char *file, int line);
#endif
void _thread_lock_flags(struct thread *, int, const char *, int);
diff --git a/sys/sys/rmlock.h b/sys/sys/rmlock.h
index ef5776b..0ae2099 100644
--- a/sys/sys/rmlock.h
+++ b/sys/sys/rmlock.h
@@ -49,7 +49,7 @@
void rm_init(struct rmlock *rm, const char *name);
void rm_init_flags(struct rmlock *rm, const char *name, int opts);
void rm_destroy(struct rmlock *rm);
-int rm_wowned(struct rmlock *rm);
+int rm_wowned(const struct rmlock *rm);
void rm_sysinit(void *arg);
void rm_sysinit_flags(void *arg);
diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h
index ad17826..83bf57d 100644
--- a/sys/sys/rwlock.h
+++ b/sys/sys/rwlock.h
@@ -127,7 +127,7 @@ void rw_init_flags(struct rwlock *rw, const char *name, int opts);
void rw_destroy(struct rwlock *rw);
void rw_sysinit(void *arg);
void rw_sysinit_flags(void *arg);
-int rw_wowned(struct rwlock *rw);
+int rw_wowned(const struct rwlock *rw);
void _rw_wlock(struct rwlock *rw, const char *file, int line);
int _rw_try_wlock(struct rwlock *rw, const char *file, int line);
void _rw_wunlock(struct rwlock *rw, const char *file, int line);
@@ -141,7 +141,7 @@ void _rw_wunlock_hard(struct rwlock *rw, uintptr_t tid, const char *file,
int _rw_try_upgrade(struct rwlock *rw, const char *file, int line);
void _rw_downgrade(struct rwlock *rw, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _rw_assert(struct rwlock *rw, int what, const char *file, int line);
+void _rw_assert(const struct rwlock *rw, int what, const char *file, int line);
#endif
/*
diff --git a/sys/sys/sx.h b/sys/sys/sx.h
index da16b60..3bef1c5 100644
--- a/sys/sys/sx.h
+++ b/sys/sys/sx.h
@@ -109,7 +109,7 @@ void _sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int
line);
void _sx_sunlock_hard(struct sx *sx, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _sx_assert(struct sx *sx, int what, const char *file, int line);
+void _sx_assert(const struct sx *sx, int what, const char *file, int line);
#endif
#ifdef DDB
int sx_chain(struct thread *td, struct thread **ownerp);
OpenPOWER on IntegriCloud