summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2011-06-19 04:51:06 +0000
committermatthew <matthew@openbsd.org>2011-06-19 04:51:06 +0000
commit44b22497d3a14d40ff952ca57d1f187b221cdfec (patch)
treefd65f6d5029494aabc1e3e534ba9f5cd8d09a3d9 /sys/kern/subr_disk.c
parentUse disk_lock/disk_unlock directly and in the same way in these drivers, (diff)
downloadwireguard-openbsd-44b22497d3a14d40ff952ca57d1f187b221cdfec.tar.xz
wireguard-openbsd-44b22497d3a14d40ff952ca57d1f187b221cdfec.zip
Add disk_lock_nointr() as a way to acquire the disk lock without being
interrupted by signals. ok deraadt@
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 54d4d0e8189..f9f7c9e0a14 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.124 2011/06/19 04:11:48 matthew Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.125 2011/06/19 04:51:06 matthew Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -961,6 +961,12 @@ disk_lock(struct disk *dk)
}
void
+disk_lock_nointr(struct disk *dk)
+{
+ rw_enter_write(&dk->dk_lock);
+}
+
+void
disk_unlock(struct disk *dk)
{
rw_exit(&dk->dk_lock);