diff options
author | 2004-07-21 12:10:20 +0000 | |
---|---|---|
committer | 2004-07-21 12:10:20 +0000 | |
commit | df5b7002e635ca682ea00fa8cc62a77a6b77a04a (patch) | |
tree | 46b3864a967d0645b3ec372922f3c66b1f8e1df9 /sys | |
parent | bz#902: cache remote port so we don't fatal() in auth_log when remote (diff) | |
download | wireguard-openbsd-df5b7002e635ca682ea00fa8cc62a77a6b77a04a.tar.xz wireguard-openbsd-df5b7002e635ca682ea00fa8cc62a77a6b77a04a.zip |
I was wrong. The assymetry created by the proc argument to rw_enter_write
is horrible and doesn't add anything.
Remove it.
XXX - the fdplock macro will need a separate cleanup.
niklas@ markus@ ok
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_rwlock.c | 8 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 6 | ||||
-rw-r--r-- | sys/sys/filedesc.h | 5 | ||||
-rw-r--r-- | sys/sys/rwlock.h | 6 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_dirhash.c | 6 |
5 files changed, 17 insertions, 14 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 994e1dd5e54..833d879d98c 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_rwlock.c,v 1.2 2003/11/18 18:12:14 tedu Exp $ */ +/* $OpenBSD: kern_rwlock.c,v 1.3 2004/07/21 12:10:20 art Exp $ */ /* * Copyright (c) 2002, 2003 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -49,8 +49,10 @@ rw_enter_read(struct rwlock *rwl) } void -rw_enter_write(struct rwlock *rwl, struct proc *p) +rw_enter_write(struct rwlock *rwl) { + struct proc *p = curproc; + while (__predict_false(rwl->rwl_owner != 0)) { /* * Not the simple case, go to slow path. @@ -208,7 +210,7 @@ rwlock_testp3(void *a) printf("rwlock test3 start\n"); tsleep(&local, PWAIT, "rw3", 2); printf("rwlock test3 exited waiting\n"); - rw_enter_write(&rw_test, curproc); + rw_enter_write(&rw_test); printf("rwlock test3 obtained\n"); tsleep(&local, PWAIT, "rw3/2", 4); rw_exit_write(&rw_test); diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 3581bf1d5c8..4cd585841c4 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.23 2004/07/09 08:55:41 niklas Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.24 2004/07/21 12:10:20 art Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -167,7 +167,7 @@ check_pty(int minor) { struct pt_softc *pti; - rw_enter_write(&pt_softc_lock, curproc); + rw_enter_write(&pt_softc_lock); if (minor >= npty) { struct pt_softc **newpt; int newnpty; @@ -975,7 +975,7 @@ sysctl_pty(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, err = sysctl_int(oldp, oldlenp, newp, newlen, &newmax); if (err) return (err); - rw_enter_write(&pt_softc_lock, curproc); + rw_enter_write(&pt_softc_lock); /* * We can't set the max lower than the current * active value or to a value bigger than a dev_t minor diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index d9471e74c56..d00043c4141 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: filedesc.h,v 1.17 2004/01/06 04:18:18 tedu Exp $ */ +/* $OpenBSD: filedesc.h,v 1.18 2004/07/21 12:10:20 art Exp $ */ /* $NetBSD: filedesc.h,v 1.14 1996/04/09 20:55:28 cgd Exp $ */ /* @@ -128,6 +128,7 @@ struct file *fd_getfile(struct filedesc *, int fd); int closef(struct file *, struct proc *); int getsock(struct filedesc *, int, struct file **); -#define fdplock(fdp, p) rw_enter_write(&(fdp)->fd_lock, p) +/* XXX - remove the p param. */ +#define fdplock(fdp, p) rw_enter_write(&(fdp)->fd_lock) #define fdpunlock(fdp) rw_exit_write(&(fdp)->fd_lock) #endif diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h index 53417ca67e4..9d24f95176f 100644 --- a/sys/sys/rwlock.h +++ b/sys/sys/rwlock.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rwlock.h,v 1.3 2004/01/11 00:42:03 tedu Exp $ */ +/* $OpenBSD: rwlock.h,v 1.4 2004/07/21 12:10:20 art Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -48,7 +48,7 @@ * atomically test for RWLOCK_WRLOCK and if not set, increment the lock * by RWLOCK_READ_INCR. While RWLOCK_WRLOCK is set, loop into rw_enter_wait. * - * void rw_enter_write(struct rwlock *, struct proc *); + * void rw_enter_write(struct rwlock *); * atomically test for the lock being 0 (it's not possible to have * owner/read count unset and waiter bits set) and if 0 set the owner to * the proc and RWLOCK_WRLOCK. While not zero, loop into rw_enter_wait. @@ -90,7 +90,7 @@ struct rwlock { void rw_init(struct rwlock *); void rw_enter_read(struct rwlock *); -void rw_enter_write(struct rwlock *, struct proc *); +void rw_enter_write(struct rwlock *); void rw_exit_read(struct rwlock *); void rw_exit_write(struct rwlock *); diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index dabcad89ace..e9ca2d557c4 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_dirhash.c,v 1.7 2004/03/16 06:28:27 tedu Exp $ */ +/* $OpenBSD: ufs_dirhash.c,v 1.8 2004/07/21 12:10:20 art Exp $ */ /* * Copyright (c) 2001, 2002 Ian Dowse. All rights reserved. * @@ -75,9 +75,9 @@ int ufsdirhash_recycle(int wanted); struct pool ufsdirhash_pool; -#define DIRHASHLIST_LOCK() rw_enter_write(&ufsdirhash_mtx, curproc) +#define DIRHASHLIST_LOCK() rw_enter_write(&ufsdirhash_mtx) #define DIRHASHLIST_UNLOCK() rw_exit_write(&ufsdirhash_mtx) -#define DIRHASH_LOCK(dh) rw_enter_write(&(dh)->dh_mtx, curproc) +#define DIRHASH_LOCK(dh) rw_enter_write(&(dh)->dh_mtx) #define DIRHASH_UNLOCK(dh) rw_exit_write(&(dh)->dh_mtx) #define DIRHASH_BLKALLOC_WAITOK() pool_get(&ufsdirhash_pool, PR_WAITOK) #define DIRHASH_BLKFREE(v) pool_put(&ufsdirhash_pool, v) |