diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-21 07:44:37 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-09-21 07:44:37 +0000 |
commit | 3c6fe614cea673f8f95d27a4c9bd69e38c83a3e8 (patch) | |
tree | 400aced3d2faa6a2c26722c4c75a2177fb302a61 | |
parent | 6d5fce2f1331e897db7deefdf67b4f74e8ab74e2 (diff) |
Sprinkle some #ifdef _KERNEL, autumn is here.
ok dlg@
-rw-r--r-- | sys/sys/rwlock.h | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h index 10db90ae94f..e7862f0cf97 100644 --- a/sys/sys/rwlock.h +++ b/sys/sys/rwlock.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rwlock.h,v 1.18 2015/02/11 00:14:11 dlg Exp $ */ +/* $OpenBSD: rwlock.h,v 1.19 2016/09/21 07:44:36 mpi Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * @@ -51,8 +51,8 @@ * set, call rw_exit_waiters with the old contents of the lock. */ -#ifndef SYS_RWLOCK_H -#define SYS_RWLOCK_H +#ifndef _SYS_RWLOCK_H +#define _SYS_RWLOCK_H struct proc; @@ -73,27 +73,6 @@ struct rwlock { #define RWLOCK_READER_SHIFT 3UL #define RWLOCK_READ_INCR (1UL << RWLOCK_READER_SHIFT) -void rw_init(struct rwlock *, const char *); - -void rw_enter_read(struct rwlock *); -void rw_enter_write(struct rwlock *); -void rw_exit_read(struct rwlock *); -void rw_exit_write(struct rwlock *); - -#ifdef DIAGNOSTIC -void rw_assert_wrlock(struct rwlock *); -void rw_assert_rdlock(struct rwlock *); -void rw_assert_unlocked(struct rwlock *); -#else -#define rw_assert_wrlock(rwl) ((void)0) -#define rw_assert_rdlock(rwl) ((void)0) -#define rw_assert_unlocked(rwl) ((void)0) -#endif - -int rw_enter(struct rwlock *, int); -void rw_exit(struct rwlock *); -int rw_status(struct rwlock *); - #define RW_WRITE 0x0001UL /* exclusive lock */ #define RW_READ 0x0002UL /* shared lock */ #define RW_DOWNGRADE 0x0004UL /* downgrade exclusive to shared */ @@ -116,9 +95,34 @@ struct rrwlock { uint32_t rrwl_wcnt; /* # writers. */ }; +#ifdef _KERNEL + +void rw_init(struct rwlock *, const char *); + +void rw_enter_read(struct rwlock *); +void rw_enter_write(struct rwlock *); +void rw_exit_read(struct rwlock *); +void rw_exit_write(struct rwlock *); + +#ifdef DIAGNOSTIC +void rw_assert_wrlock(struct rwlock *); +void rw_assert_rdlock(struct rwlock *); +void rw_assert_unlocked(struct rwlock *); +#else +#define rw_assert_wrlock(rwl) ((void)0) +#define rw_assert_rdlock(rwl) ((void)0) +#define rw_assert_unlocked(rwl) ((void)0) +#endif + +int rw_enter(struct rwlock *, int); +void rw_exit(struct rwlock *); +int rw_status(struct rwlock *); + void rrw_init(struct rrwlock *, char *); int rrw_enter(struct rrwlock *, int); void rrw_exit(struct rrwlock *); int rrw_status(struct rrwlock *); -#endif +#endif /* _KERNEL */ + +#endif /* _SYS_RWLOCK_H */ |