summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2011-06-19 04:51:07 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2011-06-19 04:51:07 +0000
commit30d542e360185d6a6636b094086b49d79ae6ed7c (patch)
tree7b85b9e52864dcebec3f06e8b6fdc2a62b373d6d /sys
parent2405d5b1d140e655feb9dfc571e61d68b6e37ea6 (diff)
Add disk_lock_nointr() as a way to acquire the disk lock without being
interrupted by signals. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_disk.c8
-rw-r--r--sys/sys/disk.h3
2 files changed, 9 insertions, 2 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);
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index 41a1ca957d7..b4b02a50d9f 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disk.h,v 1.29 2011/06/19 04:11:48 matthew Exp $ */
+/* $OpenBSD: disk.h,v 1.30 2011/06/19 04:51:06 matthew Exp $ */
/* $NetBSD: disk.h,v 1.11 1996/04/28 20:22:50 thorpej Exp $ */
/*
@@ -158,6 +158,7 @@ void disk_busy(struct disk *);
void disk_unbusy(struct disk *, long, int);
int disk_lock(struct disk *);
+void disk_lock_nointr(struct disk *);
void disk_unlock(struct disk *);
struct device *disk_lookup(struct cfdriver *, int);