Index | Thread | Search

From:
Marcus Glocker <marcus@nazgul.ch>
Subject:
kstat_kv_unit_init() add 16-bit integers
To:
tech@openbsd.org
Cc:
David Gwynne <david@gwynne.id.au>
Date:
Sat, 18 Jan 2025 09:16:54 +0100

Download raw body.

Thread
kstat_kv_unit_init() is currently missing the 16-bit integers, which are
available in kstat.h.  This leads to a panic when a driver wants to
initialize a 16-bit integer with kstat_kv_unit_init().

Add them there.

OK?


Index: sys/dev/kstat.c
===================================================================
RCS file: /cvs/src/sys/dev/kstat.c,v
diff -u -p -u -p -r1.4 kstat.c
--- sys/dev/kstat.c	4 Sep 2024 07:54:52 -0000	1.4
+++ sys/dev/kstat.c	18 Jan 2025 08:09:07 -0000
@@ -685,10 +685,13 @@ kstat_kv_unit_init(struct kstat_kv *kv, 
 	switch (type) {
 	case KSTAT_KV_T_COUNTER64:
 	case KSTAT_KV_T_COUNTER32:
+	case KSTAT_KV_T_COUNTER16:
 	case KSTAT_KV_T_UINT64:
 	case KSTAT_KV_T_INT64:
 	case KSTAT_KV_T_UINT32:
 	case KSTAT_KV_T_INT32:
+	case KSTAT_KV_T_UINT16:
+	case KSTAT_KV_T_INT16:
 		break;
 	default:
 		panic("kv unit init %s: unit for non-integer type", name);