summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/kstat.c14
-rw-r--r--sys/sys/kstat.h3
2 files changed, 15 insertions, 2 deletions
diff --git a/sys/dev/kstat.c b/sys/dev/kstat.c
index 11e3ed8dd0d..073f61a2c34 100644
--- a/sys/dev/kstat.c
+++ b/sys/dev/kstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kstat.c,v 1.1 2020/07/06 03:56:51 dlg Exp $ */
+/* $OpenBSD: kstat.c,v 1.2 2022/01/31 05:09:17 dlg Exp $ */
/*
* Copyright (c) 2020 David Gwynne <dlg@openbsd.org>
@@ -627,6 +627,18 @@ kstat_install(struct kstat *ks)
}
void
+kstat_remove(struct kstat *ks)
+{
+ rw_enter_write(&kstat_lock);
+ KASSERTMSG(ks->ks_state == KSTAT_S_INSTALLED,
+ "kstat %p %s:%u:%s:%u is not installed", ks,
+ ks->ks_provider, ks->ks_instance, ks->ks_name, ks->ks_unit);
+
+ ks->ks_state = KSTAT_S_CREATED;
+ rw_exit_write(&kstat_lock);
+}
+
+void
kstat_destroy(struct kstat *ks)
{
rw_enter_write(&kstat_lock);
diff --git a/sys/sys/kstat.h b/sys/sys/kstat.h
index 456481057c2..2827712577b 100644
--- a/sys/sys/kstat.h
+++ b/sys/sys/kstat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kstat.h,v 1.1 2020/07/06 03:56:51 dlg Exp $ */
+/* $OpenBSD: kstat.h,v 1.2 2022/01/31 05:09:17 dlg Exp $ */
/*
* Copyright (c) 2020 David Gwynne <dlg@openbsd.org>
@@ -169,6 +169,7 @@ void kstat_set_cpu(struct kstat *, struct cpu_info *);
int kstat_read_nop(struct kstat *);
void kstat_install(struct kstat *);
+void kstat_remove(struct kstat *);
void kstat_destroy(struct kstat *);
/*