summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>2001-05-14 07:16:12 +0000
committerangelos <angelos@openbsd.org>2001-05-14 07:16:12 +0000
commita250c09a35832999d90359b4336065fb9ac8eb0b (patch)
treef860828864039132c89469bca3a74f19b7c32050 /sys/kern/subr_disk.c
parenttty stats sysctl, deraadt@ok (diff)
downloadwireguard-openbsd-a250c09a35832999d90359b4336065fb9ac8eb0b.tar.xz
wireguard-openbsd-a250c09a35832999d90359b4336065fb9ac8eb0b.zip
Set a flag whenever a disk is added/removed, so sysctl knows when to
update settings.
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 746da1e3117..bb5c6070d65 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.19 2000/11/07 16:58:01 art Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.20 2001/05/14 07:16:12 angelos Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -67,6 +67,10 @@
*/
struct disklist_head disklist; /* TAILQ_HEAD */
int disk_count; /* number of drives in global disklist */
+int disk_change; /* set if a disk has been attached/detached
+ * since last we looked at this variable. This
+ * is reset by hw_sysctl()
+ */
/*
* Seek sort for disks. We depend on the driver which calls us using b_resid
@@ -244,7 +248,7 @@ disk_init()
{
TAILQ_INIT(&disklist);
- disk_count = 0;
+ disk_count = disk_change = 0;
}
/*
@@ -319,6 +323,7 @@ disk_attach(diskp)
*/
TAILQ_INSERT_TAIL(&disklist, diskp, dk_link);
++disk_count;
+ disk_change = 1;
}
/*
@@ -339,6 +344,7 @@ disk_detach(diskp)
* Remove from the disklist.
*/
TAILQ_REMOVE(&disklist, diskp, dk_link);
+ disk_change = 1;
if (--disk_count < 0)
panic("disk_detach: disk_count < 0");
}