Download raw body.
kernel: more compile-time initializers
In the early years of <sys/queue.h>, there were no compile-time
initializer macros, so there had to be WHATEVER_INIT() calls at runtime.
The WHATEVER_INITIALIZER macros for compile-time initialization have
been introduced in 1996, but code which was written before had not
necessarily been updated.
The mostly mechanical diff below uses compile-time initializer for
global variables, allowing a few routines to be removed as a result.
Index: sys/arch/alpha/alpha/pmap.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/alpha/alpha/pmap.c,v
diff -u -p -r1.97 pmap.c
--- sys/arch/alpha/alpha/pmap.c 8 Mar 2026 23:00:43 -0000 1.97
+++ sys/arch/alpha/alpha/pmap.c 2 Nov 2026 16:23:14 -0000
@@ -239,7 +239,7 @@ int pmap_pv_lowat = PMAP_PV_LOWAT;
* page tables are allocated. This list is kept LRU-ordered by
* pmap_activate().
*/
-TAILQ_HEAD(, pmap) pmap_all_pmaps;
+TAILQ_HEAD(, pmap) pmap_all_pmaps = TAILQ_HEAD_INITIALIZER(pmap_all_pmaps);
/*
* The pools from which pmap structures and sub-structures are allocated.
@@ -819,8 +819,6 @@ pmap_bootstrap(paddr_t ptaddr, u_int max
"l1ptpl", &pmap_l1pt_allocator);
pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, IPL_VM, 0,
"pvpl", &pmap_pv_page_allocator);
-
- TAILQ_INIT(&pmap_all_pmaps);
/*
* Initialize the ASN logic.
Index: sys/arch/amd64/stand/efiboot/efiboot.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
diff -u -p -r1.44 efiboot.c
--- sys/arch/amd64/stand/efiboot/efiboot.c 16 Sep 2025 05:07:33 -0000 1.44
+++ sys/arch/amd64/stand/efiboot/efiboot.c 2 Nov 2026 16:23:14 -0000
@@ -172,7 +172,7 @@ efi_cleanup(void)
/***********************************************************************
* Disk
***********************************************************************/
-struct disklist_lh efi_disklist;
+struct disklist_lh efi_disklist = TAILQ_HEAD_INITIALIZER(efi_disklist);
void
efi_diskprobe(void)
@@ -185,8 +185,6 @@ efi_diskprobe(void)
EFI_BLOCK_IO_MEDIA *media;
struct diskinfo *di;
EFI_DEVICE_PATH *dp;
-
- TAILQ_INIT(&efi_disklist);
sz = 0;
status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, 0);
Index: sys/arch/amd64/stand/libsa/softraid_amd64.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/amd64/stand/libsa/softraid_amd64.c,v
diff -u -p -r1.11 softraid_amd64.c
--- sys/arch/amd64/stand/libsa/softraid_amd64.c 18 Nov 2025 15:24:09 -0000 1.11
+++ sys/arch/amd64/stand/libsa/softraid_amd64.c 2 Nov 2026 16:23:14 -0000
@@ -136,9 +136,6 @@ srprobe(void)
daddr_t off;
/* Probe for softraid volumes. */
- SLIST_INIT(&sr_volumes);
- SLIST_INIT(&sr_keydisks);
-
md = alloc(SR_META_SIZE * DEV_BSIZE);
TAILQ_FOREACH(dip, &disklist, list) {
Index: sys/arch/arm/arm/pmap7.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/arm/arm/pmap7.c,v
diff -u -p -r1.70 pmap7.c
--- sys/arch/arm/arm/pmap7.c 24 Sep 2026 17:57:24 -0000 1.70
+++ sys/arch/arm/arm/pmap7.c 2 Nov 2026 16:23:14 -0000
@@ -318,7 +318,7 @@ pd_entry_t l1_c_pxn;
/*
* A list of all L1 tables
*/
-TAILQ_HEAD(, l1_ttable) l1_list;
+TAILQ_HEAD(, l1_ttable) l1_list = TAILQ_HEAD_INITIALIZER(l1_list);
/*
* The l2_dtable tracks L2_BUCKET_SIZE worth of L1 slots.
@@ -2371,7 +2371,6 @@ pmap_bootstrap(pd_entry_t *kernel_l1pt,
/*
* We can now initialise the first L1's metadata.
*/
- TAILQ_INIT(&l1_list);
pmap_init_l1(l1, kernel_l1pt);
/*
Index: sys/arch/arm64/stand/efiboot/softraid_arm64.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/arm64/stand/efiboot/softraid_arm64.c,v
diff -u -p -r1.7 softraid_arm64.c
--- sys/arch/arm64/stand/efiboot/softraid_arm64.c 18 Nov 2025 15:24:09 -0000 1.7
+++ sys/arch/arm64/stand/efiboot/softraid_arm64.c 2 Nov 2026 16:23:14 -0000
@@ -138,9 +138,6 @@ srprobe(void)
daddr_t off;
/* Probe for softraid volumes. */
- SLIST_INIT(&sr_volumes);
- SLIST_INIT(&sr_keydisks);
-
md = alloc(SR_META_SIZE * DEV_BSIZE);
TAILQ_FOREACH(dip, &disklist, list) {
Index: sys/arch/i386/isa/ahc_isa.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/i386/isa/ahc_isa.c,v
diff -u -p -r1.21 ahc_isa.c
--- sys/arch/i386/isa/ahc_isa.c 21 Feb 2022 12:53:39 -0000 1.21
+++ sys/arch/i386/isa/ahc_isa.c 2 Nov 2026 16:23:14 -0000
@@ -138,8 +138,8 @@ struct ahc_isa_slot {
int bus;
int slot;
};
-static LIST_HEAD(, ahc_isa_slot) ahc_isa_all_slots;
-static int ahc_isa_slot_initialized;
+static LIST_HEAD(, ahc_isa_slot) ahc_isa_all_slots =
+ LIST_HEAD_INITALIZER(ahc_isa_all_slots);
/*
* Return irq setting of the board, otherwise -1.
@@ -287,11 +287,6 @@ ahc_isa_probe(struct device *parent, voi
{
struct isa_attach_args *ia = aux;
struct ahc_isa_slot *as;
-
- if (ahc_isa_slot_initialized == 0) {
- LIST_INIT(&ahc_isa_all_slots);
- ahc_isa_slot_initialized = 1;
- }
if (ia->ia_iobase != IOBASEUNK)
return (ahc_isa_match(ia, ia->ia_iobase));
Index: sys/arch/i386/pci/pci_intr_fixup.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/i386/pci/pci_intr_fixup.c,v
diff -u -p -r1.64 pci_intr_fixup.c
--- sys/arch/i386/pci/pci_intr_fixup.c 30 Jan 2023 10:49:05 -0000 1.64
+++ sys/arch/i386/pci/pci_intr_fixup.c 2 Nov 2026 16:23:14 -0000
@@ -117,7 +117,8 @@ struct pciintr_link_map *pciintr_link_lo
struct pcibios_intr_routing *pciintr_pir_lookup(int, int);
int pciintr_bitmap_count_irq(int, int *);
-SIMPLEQ_HEAD(, pciintr_link_map) pciintr_link_map_list;
+SIMPLEQ_HEAD(, pciintr_link_map) pciintr_link_map_list =
+ SIMPLEQ_HEAD_INITIALIZER(pciintr_link_map_list);
const struct pciintr_icu_table {
pci_vendor_id_t piit_vendor;
@@ -375,8 +376,6 @@ pciintr_link_init(pci_chipset_tag_t pc)
printf("pciintr_link_init: no PIR table\n");
return (1);
}
-
- SIMPLEQ_INIT(&pciintr_link_map_list);
for (entry = 0; entry < pcibios_pir_table_nentries; entry++) {
pir = &pcibios_pir_table[entry];
Index: sys/arch/i386/stand/libsa/softraid_i386.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/i386/stand/libsa/softraid_i386.c,v
diff -u -p -r1.7 softraid_i386.c
--- sys/arch/i386/stand/libsa/softraid_i386.c 18 Nov 2025 15:24:09 -0000 1.7
+++ sys/arch/i386/stand/libsa/softraid_i386.c 2 Nov 2026 16:23:14 -0000
@@ -132,9 +132,6 @@ srprobe(void)
daddr_t off;
/* Probe for softraid volumes. */
- SLIST_INIT(&sr_volumes);
- SLIST_INIT(&sr_keydisks);
-
md = alloc(SR_META_SIZE * DEV_BSIZE);
TAILQ_FOREACH(dip, &disklist, list) {
Index: sys/arch/riscv64/stand/efiboot/softraid_riscv64.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/riscv64/stand/efiboot/softraid_riscv64.c,v
diff -u -p -r1.6 softraid_riscv64.c
--- sys/arch/riscv64/stand/efiboot/softraid_riscv64.c 18 Nov 2025 15:24:09 -0000 1.6
+++ sys/arch/riscv64/stand/efiboot/softraid_riscv64.c 2 Nov 2026 16:23:15 -0000
@@ -138,9 +138,6 @@ srprobe(void)
daddr_t off;
/* Probe for softraid volumes. */
- SLIST_INIT(&sr_volumes);
- SLIST_INIT(&sr_keydisks);
-
md = alloc(SR_META_SIZE * DEV_BSIZE);
TAILQ_FOREACH(dip, &disklist, list) {
Index: sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c,v
diff -u -p -r1.9 softraid_sparc64.c
--- sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c 17 Oct 2025 16:54:04 -0000 1.9
+++ sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c 2 Nov 2026 16:23:15 -0000
@@ -135,9 +135,6 @@ srprobe(void)
dev_t bsd_dev;
/* Probe for softraid volumes. */
- SLIST_INIT(&sr_volumes);
- SLIST_INIT(&sr_keydisks);
-
md = alloc(SR_META_SIZE * DEV_BSIZE);
diskno = 0;
ihandle = -1;
Index: sys/dev/softraid.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/softraid.c,v
diff -u -p -r1.440 softraid.c
--- sys/dev/softraid.c 29 Sep 2026 22:49:58 -0000 1.440
+++ sys/dev/softraid.c 2 Nov 2026 16:23:15 -0000
@@ -172,7 +172,8 @@ struct sr_hotplug_list {
};
SLIST_HEAD(sr_hotplug_list_head, sr_hotplug_list);
-struct sr_hotplug_list_head sr_hotplug_callbacks;
+struct sr_hotplug_list_head sr_hotplug_callbacks =
+ SLIST_HEAD_INITIALIZER(sr_hotplug_callbacks);
extern void (*softraid_disk_attach)(struct disk *, int);
/* scsi glue */
Index: sys/dev/dt/dt_dev.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/dt/dt_dev.c,v
diff -u -p -r1.49 dt_dev.c
--- sys/dev/dt/dt_dev.c 16 May 2026 12:59:37 -0000 1.49
+++ sys/dev/dt/dt_dev.c 2 Nov 2026 16:23:15 -0000
@@ -138,14 +138,16 @@ struct dt_softc {
unsigned int ds_lastcpu; /* [r] last CPU ring read(2). */
};
-SLIST_HEAD(, dt_softc) dtdev_list; /* [K] list of open /dev/dt nodes */
+SLIST_HEAD(, dt_softc) dtdev_list = /* [K] list of open /dev/dt nodes */
+ SLIST_HEAD_INITIALIZER(dtdev_list);
/*
* Probes are created during dt_attach() and never modified/freed during
* the lifetime of the system. That's why we consider them as [I]mmutable.
*/
unsigned int dt_nprobes; /* [I] # of probes available */
-SIMPLEQ_HEAD(, dt_probe) dt_probe_list; /* [I] list of probes */
+SIMPLEQ_HEAD(, dt_probe) dt_probe_list = /* [I] list of probes */
+ SIMPLEQ_HEAD_INITIALIZER(dt_probe_list);
struct rwlock dt_lock = RWLOCK_INITIALIZER("dtlk");
volatile uint32_t dt_tracing = 0; /* [D] # of processes tracing */
@@ -179,9 +181,6 @@ void dt_deferred_wakeup(void *);
void
dtattach(int count)
{
- SLIST_INIT(&dtdev_list);
- SIMPLEQ_INIT(&dt_probe_list);
-
/* Init providers */
dt_nprobes += dt_prov_profile_init();
dt_nprobes += dt_prov_syscall_init();
Index: sys/dev/isa/elink.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/isa/elink.c,v
diff -u -p -r1.7 elink.c
--- sys/dev/isa/elink.c 29 Jun 2007 15:17:02 -0000 1.7
+++ sys/dev/isa/elink.c 2 Nov 2026 16:23:15 -0000
@@ -51,8 +51,8 @@ struct elink_done_reset {
LIST_ENTRY(elink_done_reset) er_link;
int er_bus;
};
-static LIST_HEAD(, elink_done_reset) elink_all_resets;
-static int elink_all_resets_initialized;
+static LIST_HEAD(, elink_done_reset) elink_all_resets =
+ LIST_HEAD_INITIALIZER(elink_all_resets);
/*
* Issue a `global reset' to all cards, and reset the ID state machines. We
@@ -68,11 +68,6 @@ void
elink_reset(bus_space_tag_t iot, bus_space_handle_t ioh, int bus)
{
struct elink_done_reset *er;
-
- if (elink_all_resets_initialized == 0) {
- LIST_INIT(&elink_all_resets);
- elink_all_resets_initialized = 1;
- }
/*
* Reset these cards if we haven't done so already.
Index: sys/dev/isa/if_ep_isa.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/isa/if_ep_isa.c,v
diff -u -p -r1.33 if_ep_isa.c
--- sys/dev/isa/if_ep_isa.c 11 Sep 2023 08:41:26 -0000 1.33
+++ sys/dev/isa/if_ep_isa.c 2 Nov 2026 16:23:15 -0000
@@ -93,8 +93,8 @@ struct ep_isa_done_probe {
LIST_ENTRY(ep_isa_done_probe) er_link;
int er_bus;
};
-static LIST_HEAD(, ep_isa_done_probe) ep_isa_all_probes;
-static int ep_isa_probes_initialized;
+static LIST_HEAD(, ep_isa_done_probe) ep_isa_all_probes =
+ LIST_HEAD_INITIALIZER(ep_isa_probes);
#define MAXEPCARDS 20 /* if you have more than 20, you lose */
@@ -137,11 +137,6 @@ ep_isa_probe(struct device *parent, void
u_int16_t vendor, model;
struct ep_isa_done_probe *er;
int bus = parent->dv_unit;
-
- if (ep_isa_probes_initialized == 0) {
- LIST_INIT(&ep_isa_all_probes);
- ep_isa_probes_initialized = 1;
- }
/*
* Probe this bus if we haven't done so already.
Index: sys/dev/isa/wds.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/isa/wds.c,v
diff -u -p -r1.59 wds.c
--- sys/dev/isa/wds.c 16 Apr 2022 19:19:59 -0000 1.59
+++ sys/dev/isa/wds.c 2 Nov 2026 16:23:15 -0000
@@ -135,7 +135,7 @@ struct wds_buf {
TAILQ_ENTRY(wds_buf) chain;
} wds_buffer[BUFCNT];
-TAILQ_HEAD(, wds_buf) wds_free_buffer;
+TAILQ_HEAD(, wds_buf) wds_free_buffer = TAILQ_HEAD_INITIALIZER(wds_free_buffer);
#ifdef WDSDEBUG
int wds_debug = WDSDEBUG;
@@ -787,7 +787,6 @@ wds_init(struct wds_softc *sc)
sc->sc_mbofull = 0;
/* Clear the buffers. */
- TAILQ_INIT(&wds_free_buffer);
for (i = 0; i < BUFCNT; i++) {
wds_buffer[i].busy = 0;
TAILQ_INSERT_HEAD(&wds_free_buffer, &wds_buffer[i], chain);
Index: sys/dev/usb/usb.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/usb/usb.c,v
diff -u -p -r1.134 usb.c
--- sys/dev/usb/usb.c 22 Dec 2024 22:36:23 -0000 1.134
+++ sys/dev/usb/usb.c 2 Nov 2026 16:23:17 -0000
@@ -95,9 +95,12 @@ struct usb_softc {
struct rwlock usbpalock;
-TAILQ_HEAD(, usb_task) usb_abort_tasks;
-TAILQ_HEAD(, usb_task) usb_explore_tasks;
-TAILQ_HEAD(, usb_task) usb_generic_tasks;
+TAILQ_HEAD(, usb_task) usb_abort_tasks =
+ TAILQ_HEAD_INITIALIZER(usb_abort_tasks);
+TAILQ_HEAD(, usb_task) usb_explore_tasks =
+ TAILQ_HEAD_INITIALIZER(usb_explore_tasks);
+TAILQ_HEAD(, usb_task) usb_generic_tasks =
+ TAILQ_HEAD_INITIALIZER(usb_generic_tasks);
static int usb_nbuses = 0;
static int usb_run_tasks, usb_run_abort_tasks;
@@ -145,9 +148,6 @@ usb_attach(struct device *parent, struct
if (usb_nbuses == 0) {
rw_init(&usbpalock, "usbpalock");
- TAILQ_INIT(&usb_abort_tasks);
- TAILQ_INIT(&usb_explore_tasks);
- TAILQ_INIT(&usb_generic_tasks);
usb_run_tasks = usb_run_abort_tasks = 1;
kthread_create_deferred(usb_create_task_threads, NULL);
}
Index: sys/dev/wsfont/wsfont.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/wsfont/wsfont.c,v
diff -u -p -r1.65 wsfont.c
--- sys/dev/wsfont/wsfont.c 24 Oct 2023 13:52:49 -0000 1.65
+++ sys/dev/wsfont/wsfont.c 2 Nov 2026 16:23:17 -0000
@@ -132,7 +132,7 @@ struct font {
u_short cookie;
u_short flg;
};
-TAILQ_HEAD(, font) fontlist;
+TAILQ_HEAD(, font) fontlist = TAILQ_HEAD_INITIALIZER(fontlist);
/* Our list of built-in fonts */
static struct font builtin_fonts[] = {
@@ -425,8 +425,6 @@ wsfont_init(void)
if (again != 0)
return;
again = 1;
-
- TAILQ_INIT(&fontlist);
for (i = 0; i < nitems(builtin_fonts); i++) {
TAILQ_INSERT_TAIL(&fontlist, &builtin_fonts[i], chain);
Index: sys/kern/init_main.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/init_main.c,v
diff -u -p -r1.331 init_main.c
--- sys/kern/init_main.c 1 Jan 2026 07:00:57 -0000 1.331
+++ sys/kern/init_main.c 2 Nov 2026 16:23:17 -0000
@@ -164,7 +164,6 @@ main(void *framep)
struct process *pr;
struct pdevinit *pdev;
extern struct pdevinit pdevinit[];
- extern void disk_init(void);
/*
* Initialize the current process pointer (curproc) before
@@ -182,7 +181,6 @@ main(void *framep)
* Attempt to find console and initialize
* in case of early panic or other messages.
*/
- config_init(); /* init autoconfiguration data structures */
consinit();
printf("%s\n", copyright);
@@ -199,8 +197,6 @@ main(void *framep)
rw_obj_init();
uvm_init();
- disk_init(); /* must come before autoconfiguration */
- tty_init(); /* initialise tty's */
cpu_startup();
random_start(boothowto & RB_GOODRANDOM); /* Start the flow */
Index: sys/kern/subr_autoconf.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/subr_autoconf.c,v
diff -u -p -r1.98 subr_autoconf.c
--- sys/kern/subr_autoconf.c 16 Sep 2025 12:18:10 -0000 1.98
+++ sys/kern/subr_autoconf.c 2 Nov 2026 16:23:17 -0000
@@ -88,13 +88,16 @@ struct deferred_config {
void (*dc_func)(struct device *);
};
-TAILQ_HEAD(, deferred_config) deferred_config_queue;
-TAILQ_HEAD(, deferred_config) mountroot_config_queue;
+TAILQ_HEAD(, deferred_config) deferred_config_queue =
+ TAILQ_HEAD_INITIALIZER(deferred_config_queue);
+TAILQ_HEAD(, deferred_config) mountroot_config_queue =
+ TAILQ_HEAD_INITIALIZER(mountroot_config_queue);
void *config_rootsearch(cfmatch_t, char *, void *);
void config_process_deferred_children(struct device *);
-struct devicelist alldevs; /* list of all devices */
+struct devicelist alldevs = /* list of all devices */
+ TAILQ_HEAD_INITIALIZER(alldevs);
volatile int config_pending; /* semaphore for mountroot */
@@ -110,19 +113,6 @@ int autoconf_attdet;
* Versioned state of the devices tree so that changes can be detected.
*/
unsigned int autoconf_serial = 0;
-
-/*
- * Initialize autoconfiguration data structures. This occurs before console
- * initialization as that might require use of this subsystem. Furthermore
- * this means that malloc et al. isn't yet available.
- */
-void
-config_init(void)
-{
- TAILQ_INIT(&deferred_config_queue);
- TAILQ_INIT(&mountroot_config_queue);
- TAILQ_INIT(&alldevs);
-}
/*
* Apply the matching function and choose the best. This is used
Index: sys/kern/subr_disk.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/subr_disk.c,v
diff -u -p -r1.287 subr_disk.c
--- sys/kern/subr_disk.c 9 Aug 2026 19:22:49 -0000 1.287
+++ sys/kern/subr_disk.c 2 Nov 2026 16:23:17 -0000
@@ -76,9 +76,9 @@
* A global list of all disks attached to the system. May grow or
* shrink over time.
*/
-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
+struct disklist_head disklist = TAILQ_HEAD_INITIALIZER(disklist);
+int disk_count = 0; /* number of drives in global disklist */
+int disk_change = 0; /* set if a disk has been attached/detached
* since last we looked at this variable. This
* is reset by hw_sysctl()
*/
@@ -1031,17 +1031,6 @@ diskerr(struct buf *bp, char *dname, cha
(long long)(sn / DL_SECTOBLK(lp, lp->d_nsectors)),
(long long)(sn % DL_SECTOBLK(lp, lp->d_nsectors)));
}
-}
-
-/*
- * Initialize the disklist. Called by main() before autoconfiguration.
- */
-void
-disk_init(void)
-{
-
- TAILQ_INIT(&disklist);
- disk_count = disk_change = 0;
}
int
Index: sys/kern/subr_extent.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/subr_extent.c,v
diff -u -p -r1.65 subr_extent.c
--- sys/kern/subr_extent.c 19 Jan 2024 22:12:24 -0000 1.65
+++ sys/kern/subr_extent.c 2 Nov 2026 16:23:17 -0000
@@ -100,7 +100,8 @@ extent_align(u_long start, u_long align,
* Register the extent on a doubly linked list.
* Should work, no?
*/
-static LIST_HEAD(listhead, extent) ext_list;
+static LIST_HEAD(listhead, extent) ext_list =
+ LIST_HEAD_INITIALIZER(ext_list);
static void extent_register(struct extent *);
static void
@@ -108,15 +109,7 @@ extent_register(struct extent *ex)
{
#ifdef DIAGNOSTIC
struct extent *ep;
-#endif
- static int initialized;
- if (!initialized){
- LIST_INIT(&ext_list);
- initialized = 1;
- }
-
-#ifdef DIAGNOSTIC
LIST_FOREACH(ep, &ext_list, ex_link) {
if (ep == ex)
panic("%s: already registered", __func__);
Index: sys/kern/sysv_msg.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/sysv_msg.c,v
diff -u -p -r1.51 sysv_msg.c
--- sys/kern/sysv_msg.c 12 Jul 2026 22:06:01 -0000 1.51
+++ sys/kern/sysv_msg.c 2 Nov 2026 16:23:17 -0000
@@ -70,7 +70,7 @@ const struct msginfo msginfo = {
.msgseg = MSGSEG,
};
-TAILQ_HEAD(, que) msg_queues;
+TAILQ_HEAD(, que) msg_queues = TAILQ_HEAD_INITIALIZER(msg_queues);
int num_ques;
int num_msgs;
@@ -82,8 +82,6 @@ msginit(void)
{
pool_init(&sysvmsgpl, sizeof(struct msg), 0, IPL_NONE, PR_WAITOK,
"sysvmsgpl", NULL);
-
- TAILQ_INIT(&msg_queues);
num_ques = 0;
num_msgs = 0;
Index: sys/kern/sysv_sem.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/sysv_sem.c,v
diff -u -p -r1.72 sysv_sem.c
--- sys/kern/sysv_sem.c 21 Sep 2026 04:26:47 -0000 1.72
+++ sys/kern/sysv_sem.c 2 Nov 2026 16:23:17 -0000
@@ -52,7 +52,8 @@ struct rwlock sysvsem_lock = RWLOCK_INIT
int semtot = 0;
int semutot = 0;
struct semid_ds_kern **sema; /* semaphore id list */
-SLIST_HEAD(, sem_undo) semu_list; /* list of undo structures */
+SLIST_HEAD(, sem_undo) semu_list = /* list of undo structures */
+ SLIST_HEAD_INITIALIZER(semu_list);
struct pool sema_pool; /* pool for struct semid_ds_kern */
struct pool semu_pool; /* pool for struct sem_undo (SEMUSZ) */
unsigned short *semseqs; /* array of sem sequence numbers */
@@ -73,7 +74,6 @@ seminit(void)
M_SEM, M_WAITOK|M_ZERO);
semseqs = mallocarray(seminfo.semmni, sizeof(unsigned short),
M_SEM, M_WAITOK|M_ZERO);
- SLIST_INIT(&semu_list);
}
static inline void
Index: sys/kern/tty.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/tty.c,v
diff -u -p -r1.186 tty.c
--- sys/kern/tty.c 19 Aug 2026 22:56:24 -0000 1.186
+++ sys/kern/tty.c 2 Nov 2026 16:23:17 -0000
@@ -166,8 +166,8 @@ u_char const char_type[] = {
#define tolower(c) ((c) - 'A' + 'a')
#define toupper(c) ((c) - 'a' + 'A')
-struct ttylist_head ttylist; /* TAILQ_HEAD */
-int tty_count;
+struct ttylist_head ttylist = TAILQ_HEAD_INITIALIZER(ttylist);
+int tty_count = 0;
struct rwlock ttylist_lock = RWLOCK_INITIALIZER("ttylist");
int64_t tk_cancc, tk_nin, tk_nout, tk_rawcc;
@@ -2327,17 +2327,6 @@ ttysleep_nsec(struct tty *tp, void *chan
if ((error = tsleep_nsec(chan, pri, wmesg, nsecs)) != 0)
return (error);
return (tp->t_gen == gen ? 0 : ERESTART);
-}
-
-/*
- * Initialise the global tty list.
- */
-void
-tty_init(void)
-{
-
- TAILQ_INIT(&ttylist);
- tty_count = 0;
}
/*
Index: sys/kern/vfs_bio.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/vfs_bio.c,v
diff -u -p -r1.220 vfs_bio.c
--- sys/kern/vfs_bio.c 9 Oct 2026 16:35:28 -0000 1.220
+++ sys/kern/vfs_bio.c 2 Nov 2026 16:23:17 -0000
@@ -93,7 +93,7 @@ struct proc *cleanerproc;
int bd_req; /* Sleep point for cleaner daemon. */
struct bufcache cleancache;
-struct bufqueue dirtyqueue;
+struct bufqueue dirtyqueue = TAILQ_HEAD_INITIALIZER(dirtyqueue);
void
buf_put(struct buf *bp)
@@ -1288,7 +1288,6 @@ bufcache_init(void)
TAILQ_INIT(&cleancache.hotqueue);
TAILQ_INIT(&cleancache.coldqueue);
TAILQ_INIT(&cleancache.warmqueue);
- TAILQ_INIT(&dirtyqueue);
}
/*
Index: sys/kern/vfs_biomem.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/vfs_biomem.c,v
diff -u -p -r1.55 vfs_biomem.c
--- sys/kern/vfs_biomem.c 10 Jun 2026 00:04:38 -0000 1.55
+++ sys/kern/vfs_biomem.c 2 Nov 2026 16:23:17 -0000
@@ -29,7 +29,7 @@
vaddr_t buf_kva_start, buf_kva_end;
int buf_needva;
-TAILQ_HEAD(,buf) buf_valist;
+TAILQ_HEAD(,buf) buf_valist = TAILQ_HEAD_INITIALIZER(buf_valist);
extern struct bcachestats bcstats;
@@ -38,8 +38,6 @@ vaddr_t buf_unmap(struct buf *);
void
buf_mem_init(vsize_t size)
{
- TAILQ_INIT(&buf_valist);
-
buf_kva_start = vm_map_min(kernel_map);
if (uvm_map(kernel_map, &buf_kva_start, size, NULL,
UVM_UNKNOWN_OFFSET, PAGE_SIZE, UVM_MAPFLAG(PROT_NONE,
Index: sys/kern/vfs_cache.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/vfs_cache.c,v
diff -u -p -r1.58 vfs_cache.c
--- sys/kern/vfs_cache.c 14 Aug 2022 01:58:28 -0000 1.58
+++ sys/kern/vfs_cache.c 2 Nov 2026 16:23:17 -0000
@@ -60,8 +60,10 @@
long numcache; /* total number of cache entries allocated */
long numneg; /* number of negative cache entries */
-TAILQ_HEAD(, namecache) nclruhead; /* Regular Entry LRU chain */
-TAILQ_HEAD(, namecache) nclruneghead; /* Negative Entry LRU chain */
+TAILQ_HEAD(, namecache) nclruhead = /* Regular Entry LRU chain */
+ TAILQ_HEAD_INITIALIZER(nclruhead);
+TAILQ_HEAD(, namecache) nclruneghead = /* Negative Entry LRU chain */
+ TAILQ_HEAD_INITIALIZER(nclruneghead);
struct nchstats nchstats; /* cache effectiveness statistics */
int doingcache = 1; /* 1 => enable the cache */
@@ -417,8 +419,6 @@ done:
void
nchinit(void)
{
- TAILQ_INIT(&nclruhead);
- TAILQ_INIT(&nclruneghead);
pool_init(&nch_pool, sizeof(struct namecache), 0, IPL_NONE, PR_WAITOK,
"nchpl", NULL);
}
Index: sys/kern/vfs_subr.c
===================================================================
RCS file: /OpenBSD/src/sys/kern/vfs_subr.c,v
diff -u -p -r1.335 vfs_subr.c
--- sys/kern/vfs_subr.c 30 Jun 2026 14:04:03 -0000 1.335
+++ sys/kern/vfs_subr.c 2 Nov 2026 16:23:17 -0000
@@ -100,10 +100,13 @@ int prtactive = 0; /* 1 => print out rec
}
TAILQ_HEAD(freelst, vnode);
-struct freelst vnode_hold_list; /* list of vnodes referencing buffers */
-struct freelst vnode_free_list; /* vnode free list */
+struct freelst vnode_hold_list = /* list of vnodes referencing buffers */
+ TAILQ_HEAD_INITIALIZER(vnode_hold_list);
+struct freelst vnode_free_list = /* vnode free list */
+ TAILQ_HEAD_INITIALIZER(vnode_free_list);
-struct mntlist mountlist; /* mounted filesystem list */
+struct mntlist mountlist = /* mounted filesystem list */
+ TAILQ_HEAD_INITIALIZER(mountlist);
void vclean(struct vnode *, int, struct proc *);
@@ -152,9 +155,6 @@ vntblinit(void)
maxvnodes = 2 * initialvnodes;
pool_init(&vnode_pool, sizeof(struct vnode), 0, IPL_NONE,
PR_WAITOK, "vnodes", NULL);
- TAILQ_INIT(&vnode_hold_list);
- TAILQ_INIT(&vnode_free_list);
- TAILQ_INIT(&mountlist);
/*
* Initialize the filesystem syncer.
*/
Index: sys/lib/libsa/softraid.c
===================================================================
RCS file: /OpenBSD/src/sys/lib/libsa/softraid.c,v
diff -u -p -r1.7 softraid.c
--- sys/lib/libsa/softraid.c 25 Apr 2024 18:31:49 -0000 1.7
+++ sys/lib/libsa/softraid.c 2 Nov 2026 16:23:17 -0000
@@ -36,10 +36,10 @@
#define SR_CRYPTO_KEYBLOCK_BYTES SR_CRYPTO_MAXKEYS * SR_CRYPTO_KEYBYTES
/* List of softraid volumes. */
-struct sr_boot_volume_head sr_volumes;
+struct sr_boot_volume_head sr_volumes = SLIST_HEAD_INITIALIZER(sr_volumes);
/* List of softraid keydisks. */
-struct sr_boot_keydisk_head sr_keydisks;
+struct sr_boot_keydisk_head sr_keydisks = SLIST_HEAD_INITIALIZER(sr_keydisks);
#ifdef DEBUG
void
Index: sys/miscfs/fuse/fuse_device.c
===================================================================
RCS file: /OpenBSD/src/sys/miscfs/fuse/fuse_device.c,v
diff -u -p -r1.51 fuse_device.c
--- sys/miscfs/fuse/fuse_device.c 20 Jun 2026 13:45:13 -0000 1.51
+++ sys/miscfs/fuse/fuse_device.c 2 Nov 2026 16:23:17 -0000
@@ -57,7 +57,7 @@ int stat_fbufs_in = 0;
int stat_fbufs_wait = 0;
int stat_opened_fusedev = 0;
-LIST_HEAD(, fuse_d) fuse_d_list;
+LIST_HEAD(, fuse_d) fuse_d_list = LIST_HEAD_INITIALIZER(fuse_d_list);
struct fuse_d *fuse_lookup(int);
void fuseattach(int);
@@ -191,7 +191,6 @@ fuse_device_set_fmp(struct fusefs_mnt *f
void
fuseattach(int num)
{
- LIST_INIT(&fuse_d_list);
}
int
Index: sys/net/bfd.c
===================================================================
RCS file: /OpenBSD/src/sys/net/bfd.c,v
diff -u -p -r1.81 bfd.c
--- sys/net/bfd.c 24 Jul 2025 00:49:22 -0000 1.81
+++ sys/net/bfd.c 2 Nov 2026 16:23:17 -0000
@@ -169,7 +169,8 @@ void bfd_set_uptime(struct bfd_config *
void bfd_debug(struct bfd_config *);
-TAILQ_HEAD(bfd_queue, bfd_config) bfd_queue;
+TAILQ_HEAD(bfd_queue, bfd_config) bfd_queue =
+ TAILQ_HEAD_INITIALIZER(bfd_queue);
/*
* allocate a new bfd session
@@ -285,8 +286,6 @@ bfdinit(void)
bfdtq = taskq_create("bfd", 1, IPL_SOFTNET, 0);
if (bfdtq == NULL)
panic("unable to create BFD taskq");
-
- TAILQ_INIT(&bfd_queue);
}
/*
Index: sys/net/if_pflow.c
===================================================================
RCS file: /OpenBSD/src/sys/net/if_pflow.c,v
diff -u -p -r1.112 if_pflow.c
--- sys/net/if_pflow.c 13 Nov 2025 17:12:30 -0000 1.112
+++ sys/net/if_pflow.c 2 Nov 2026 16:23:17 -0000
@@ -56,7 +56,8 @@
#define DPRINTF(x)
#endif
-SMR_SLIST_HEAD(, pflow_softc) pflowif_list;
+SMR_SLIST_HEAD(, pflow_softc) pflowif_list =
+ SMR_SLIST_HEAD_INITIALIZER(pflowif_list);
enum pflowstat_counters {
pflow_flows,
@@ -127,7 +128,6 @@ struct if_clone pflow_cloner =
void
pflowattach(int npflow)
{
- SMR_SLIST_INIT(&pflowif_list);
pflow_counters = counters_alloc(pflow_ncounters);
if_clone_attach(&pflow_cloner);
}
Index: sys/net/if_ppp.c
===================================================================
RCS file: /OpenBSD/src/sys/net/if_ppp.c,v
diff -u -p -r1.124 if_ppp.c
--- sys/net/if_ppp.c 10 Sep 2026 18:31:39 -0000 1.124
+++ sys/net/if_ppp.c 2 Nov 2026 16:23:17 -0000
@@ -184,7 +184,7 @@ struct compressor *ppp_compressors[] = {
};
#endif /* PPP_COMPRESS */
-LIST_HEAD(, ppp_softc) ppp_softc_list;
+LIST_HEAD(, ppp_softc) ppp_softc_list = LIST_HEAD_INITIALIZER(ppp_softc_list);
struct if_clone ppp_cloner =
IF_CLONE_INITIALIZER("ppp", ppp_clone_create, ppp_clone_destroy);
@@ -194,7 +194,6 @@ struct if_clone ppp_cloner =
void
pppattach(int count)
{
- LIST_INIT(&ppp_softc_list);
if_clone_attach(&ppp_cloner);
}
Index: sys/net/if_pppoe.c
===================================================================
RCS file: /OpenBSD/src/sys/net/if_pppoe.c,v
diff -u -p -r1.92 if_pppoe.c
--- sys/net/if_pppoe.c 16 Oct 2026 05:35:11 -0000 1.92
+++ sys/net/if_pppoe.c 2 Nov 2026 16:23:17 -0000
@@ -176,8 +176,10 @@ static struct pppoe_softc *pppoe_find_so
static struct pppoe_softc *pppoe_find_softc_by_hunique(u_int8_t *, size_t, u_int);
static struct mbuf *pppoe_get_mbuf(size_t len);
-LIST_HEAD(pppoe_softc_head, pppoe_softc) pppoe_softc_list;
-SMR_LIST_HEAD(pppoe_softc_sessions, pppoe_softc) pppoe_sessions; /* [K] */
+LIST_HEAD(pppoe_softc_head, pppoe_softc) pppoe_softc_list =
+ LIST_HEAD_INITIALIZER(pppoe_softc_list);
+SMR_LIST_HEAD(pppoe_softc_sessions, pppoe_softc) pppoe_sessions = /* [K] */
+ SMR_LIST_HEAD_INITIALIZER(pppoe_sessions);
/* interface cloning */
int pppoe_clone_create(struct if_clone *, int);
@@ -211,8 +213,6 @@ pppoeintr(void)
void
pppoeattach(int count)
{
- LIST_INIT(&pppoe_softc_list);
- SMR_LIST_INIT(&pppoe_sessions);
if_clone_attach(&pppoe_cloner);
}
Index: sys/net/if_trunk.c
===================================================================
RCS file: /OpenBSD/src/sys/net/if_trunk.c,v
diff -u -p -r1.161 if_trunk.c
--- sys/net/if_trunk.c 27 Jun 2026 06:29:15 -0000 1.161
+++ sys/net/if_trunk.c 2 Nov 2026 16:23:17 -0000
@@ -48,7 +48,8 @@
#include <net/bpf.h>
#endif
-SLIST_HEAD(__trhead, trunk_softc) trunk_list; /* list of trunks */
+SLIST_HEAD(__trhead, trunk_softc) trunk_list = /* list of trunks */
+ SLIST_HEAD_INITIALIZER(trunk_list);
void trunkattach(int);
int trunk_clone_create(struct if_clone *, int);
@@ -139,7 +140,6 @@ static const struct {
void
trunkattach(int count)
{
- SLIST_INIT(&trunk_list);
if_clone_attach(&trunk_cloner);
}
Index: sys/net/pf.c
===================================================================
RCS file: /OpenBSD/src/sys/net/pf.c,v
diff -u -p -r1.1247 pf.c
--- sys/net/pf.c 29 Oct 2026 16:50:23 -0000 1.1247
+++ sys/net/pf.c 2 Nov 2026 16:23:17 -0000
@@ -579,7 +579,7 @@ pf_source_find(struct pf_sourcelim *srli
return (RBT_FIND(pf_source_tree, &srlim->pfsrlim_sources, key));
}
-struct pf_src_tree tree_src_tracking;
+struct pf_src_tree tree_src_tracking = RB_INITIALIZER(tree_src_tracking);
struct pf_state_tree_id tree_id;
struct pf_state_list pf_state_list = PF_STATE_LIST_INITIALIZER(pf_state_list);
Index: sys/net/pf_ioctl.c
===================================================================
RCS file: /OpenBSD/src/sys/net/pf_ioctl.c,v
diff -u -p -r1.434 pf_ioctl.c
--- sys/net/pf_ioctl.c 10 Sep 2026 12:28:04 -0000 1.434
+++ sys/net/pf_ioctl.c 2 Nov 2026 16:23:17 -0000
@@ -247,8 +247,6 @@ pfattach(int num)
pf_pool_limits[PF_LIMIT_TABLE_ENTRIES].limit =
PFR_KENTRY_HIWAT_SMALL;
- RB_INIT(&tree_src_tracking);
- RB_INIT(&pf_anchors);
pf_init_ruleset(&pf_main_ruleset);
TAILQ_INIT(&pf_queues[0]);
TAILQ_INIT(&pf_queues[1]);
Index: sys/net/pf_norm.c
===================================================================
RCS file: /OpenBSD/src/sys/net/pf_norm.c,v
diff -u -p -r1.240 pf_norm.c
--- sys/net/pf_norm.c 28 Oct 2026 12:08:29 -0000 1.240
+++ sys/net/pf_norm.c 2 Nov 2026 16:23:17 -0000
@@ -105,7 +105,8 @@ struct pf_fragment_tag {
u_int16_t ft_maxlen; /* maximum fragment payload length */
};
-TAILQ_HEAD(pf_fragqueue, pf_fragment) pf_fragqueue;
+TAILQ_HEAD(pf_fragqueue, pf_fragment) pf_fragqueue =
+ TAILQ_HEAD_INITIALIZER(pf_fragqueue);
static __inline int pf_frnode_compare(struct pf_frnode *,
struct pf_frnode *);
@@ -163,8 +164,6 @@ pf_normalize_init(void)
pool_sethiwat(&pf_frag_pl, PFFRAG_FRAG_HIWAT);
pool_sethardlimit(&pf_frent_pl, PFFRAG_FRENT_HIWAT);
-
- TAILQ_INIT(&pf_fragqueue);
PF_FRAG_LOCK_INIT();
}
Index: sys/net/pf_ruleset.c
===================================================================
RCS file: /OpenBSD/src/sys/net/pf_ruleset.c,v
diff -u -p -r1.22 pf_ruleset.c
--- sys/net/pf_ruleset.c 7 Jul 2025 02:28:50 -0000 1.22
+++ sys/net/pf_ruleset.c 2 Nov 2026 16:23:17 -0000
@@ -74,7 +74,7 @@ struct pool pf_anchor_pl;
#endif /* _KERNEL */
-struct pf_anchor_global pf_anchors;
+struct pf_anchor_global pf_anchors = RB_INITIALIZER(pf_anchors);
struct pf_anchor pf_main_anchor;
static __inline int pf_anchor_compare(struct pf_anchor *, struct pf_anchor *);
Index: sys/netinet/igmp.c
===================================================================
RCS file: /OpenBSD/src/sys/netinet/igmp.c,v
diff -u -p -r1.100 igmp.c
--- sys/netinet/igmp.c 30 Jul 2026 14:57:46 -0000 1.100
+++ sys/netinet/igmp.c 2 Nov 2026 16:23:17 -0000
@@ -114,7 +114,8 @@ struct router_info {
int igmp_timers_are_running; /* [a] shortcut for fast timer */
struct mutex igmp_mtx = MUTEX_INITIALIZER(IPL_SOFTNET);
-static LIST_HEAD(, router_info) rti_head; /* [G] */
+static LIST_HEAD(, router_info) rti_head = /* [G] */
+ LIST_HEAD_INITIALIZER(rti_head);
static struct mbuf *router_alert;
struct cpumem *igmpcounters;
@@ -132,7 +133,6 @@ igmp_init(void)
struct ipoption *ra;
igmp_timers_are_running = 0;
- LIST_INIT(&rti_head);
igmpcounters = counters_alloc(igps_ncounters);
router_alert = m_get(M_WAIT, MT_DATA);
Index: sys/netinet/ip_input.c
===================================================================
RCS file: /OpenBSD/src/sys/netinet/ip_input.c,v
diff -u -p -r1.433 ip_input.c
--- sys/netinet/ip_input.c 11 Aug 2026 14:28:59 -0000 1.433
+++ sys/netinet/ip_input.c 2 Nov 2026 16:23:17 -0000
@@ -105,7 +105,8 @@ int ip_directedbcast = 0; /* [a] */
struct mutex ipq_mutex = MUTEX_INITIALIZER(IPL_SOFTNET);
/* IP reassembly queue */
-LIST_HEAD(, ipq) ipq; /* [Q] */
+LIST_HEAD(, ipq) ipq = /* [Q] */
+ LIST_HEAD_INITIALIZER(ipq);
/* Keep track of memory used for reassembly */
int ip_maxqueue = 300; /* [a] */
@@ -212,7 +213,6 @@ ip_init(void)
pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW &&
pr->pr_protocol < IPPROTO_MAX)
ip_protox[pr->pr_protocol] = pr - inetsw;
- LIST_INIT(&ipq);
/* Fill in list of ports not to allocate dynamically. */
memset(&baddynamicports, 0, sizeof(baddynamicports));
Index: sys/netinet6/frag6.c
===================================================================
RCS file: /OpenBSD/src/sys/netinet6/frag6.c,v
diff -u -p -r1.97 frag6.c
--- sys/netinet6/frag6.c 11 Aug 2026 14:28:59 -0000 1.97
+++ sys/netinet6/frag6.c 2 Nov 2026 16:23:17 -0000
@@ -56,7 +56,8 @@ struct mutex frag6_mutex = MUTEX_INITIAL
u_int frag6_nfragpackets; /* [Q] */
u_int frag6_nfrags; /* [Q] */
-TAILQ_HEAD(ip6q_head, ip6q) frag6_queue; /* [Q] ip6 reassemble queue */
+TAILQ_HEAD(ip6q_head, ip6q) frag6_queue = /* [Q] ip6 reassemble queue */
+ TAILQ_HEAD_INITIALIZER(frag6_queue);
void frag6_freef(struct ip6q *);
void frag6_unlink(struct ip6q *, struct ip6q_head *);
@@ -74,8 +75,6 @@ frag6_init(void)
0, IPL_SOFTNET, 0, "ip6af", NULL);
pool_init(&ip6q_pool, sizeof(struct ip6q),
0, IPL_SOFTNET, 0, "ip6q", NULL);
-
- TAILQ_INIT(&frag6_queue);
}
/*
Index: sys/nfs/nfs_bio.c
===================================================================
RCS file: /OpenBSD/src/sys/nfs/nfs_bio.c,v
diff -u -p -r1.87 nfs_bio.c
--- sys/nfs/nfs_bio.c 18 Sep 2024 05:21:19 -0000 1.87
+++ sys/nfs/nfs_bio.c 2 Nov 2026 16:23:17 -0000
@@ -53,7 +53,7 @@
extern int nfs_numasync;
extern struct nfsstats nfsstats;
-struct nfs_bufqhead nfs_bufq;
+struct nfs_bufqhead nfs_bufq = TAILQ_HEAD_INITIALIZER(nfs_bufq);
uint32_t nfs_bufqmax, nfs_bufqlen;
struct buf *nfs_getcacheblk(struct vnode *, daddr_t, int, struct proc *);
Index: sys/nfs/nfs_srvcache.c
===================================================================
RCS file: /OpenBSD/src/sys/nfs/nfs_srvcache.c,v
diff -u -p -r1.32 nfs_srvcache.c
--- sys/nfs/nfs_srvcache.c 18 Sep 2024 05:21:19 -0000 1.32
+++ sys/nfs/nfs_srvcache.c 2 Nov 2026 16:23:17 -0000
@@ -65,7 +65,8 @@ void nfsrv_cleanentry(struct nfsrvcac
LIST_HEAD(nfsrvhash, nfsrvcache) *nfsrvhashtbl;
SIPHASH_KEY nfsrvhashkey;
-TAILQ_HEAD(nfsrvlru, nfsrvcache) nfsrvlruhead;
+TAILQ_HEAD(nfsrvlru, nfsrvcache) nfsrvlruhead =
+ TAILQ_HEAD_INITIALIZER(nfsrvlruhead);
u_long nfsrvhash;
#define NFSRCHASH(xid) \
(&nfsrvhashtbl[SipHash24(&nfsrvhashkey, &(xid), sizeof(xid)) & nfsrvhash])
@@ -106,7 +107,6 @@ nfsrv_initcache(void)
nfsrvhashtbl = hashinit(desirednfsrvcache, M_NFSD, M_WAITOK, &nfsrvhash);
arc4random_buf(&nfsrvhashkey, sizeof(nfsrvhashkey));
- TAILQ_INIT(&nfsrvlruhead);
}
/*
Index: sys/nfs/nfs_subs.c
===================================================================
RCS file: /OpenBSD/src/sys/nfs/nfs_subs.c,v
diff -u -p -r1.153 nfs_subs.c
--- sys/nfs/nfs_subs.c 1 Sep 2026 02:33:27 -0000 1.153
+++ sys/nfs/nfs_subs.c 2 Nov 2026 16:23:17 -0000
@@ -907,8 +907,6 @@ nfs_vfs_init(struct vfsconf *vfsp)
{
extern struct pool nfs_node_pool;
- TAILQ_INIT(&nfs_bufq);
-
pool_init(&nfs_node_pool, sizeof(struct nfsnode), 0, IPL_NONE,
PR_WAITOK, "nfsnodepl", NULL);
Index: sys/sys/device.h
===================================================================
RCS file: /OpenBSD/src/sys/sys/device.h,v
diff -u -p -r1.73 device.h
--- sys/sys/device.h 14 Oct 2026 23:51:44 -0000 1.73
+++ sys/sys/device.h 2 Nov 2026 16:23:17 -0000
@@ -182,7 +182,6 @@ extern struct devicelist alldevs; /* lis
extern int autoconf_verbose;
extern volatile int config_pending; /* semaphore for mountroot */
-void config_init(void);
void *config_search(cfmatch_t, struct device *, void *);
struct device *config_found_sm(struct device *, void *, cfprint_t,
cfmatch_t);
Index: sys/sys/disk.h
===================================================================
RCS file: /OpenBSD/src/sys/sys/disk.h,v
diff -u -p -r1.42 disk.h
--- sys/sys/disk.h 15 Sep 2025 10:33:03 -0000 1.42
+++ sys/sys/disk.h 2 Nov 2026 16:23:17 -0000
@@ -134,7 +134,6 @@ extern struct disklist_head disklist; /*
extern int disk_count; /* number of disks in global disklist */
extern int disk_change; /* disk attached/detached */
-void disk_init(void);
int disk_construct(struct disk *);
void disk_attach(struct device *, struct disk *);
void disk_detach(struct disk *);
Index: sys/sys/tty.h
===================================================================
RCS file: /OpenBSD/src/sys/sys/tty.h,v
diff -u -p -r1.46 tty.h
--- sys/sys/tty.h 6 Aug 2026 20:38:02 -0000 1.46
+++ sys/sys/tty.h 2 Nov 2026 16:23:17 -0000
@@ -295,7 +295,6 @@ int ttywait(struct tty *tp);
int ttywflush(struct tty *tp);
void ttytstamp(struct tty *tp, int octs, int ncts, int odcd, int ndcd);
-void tty_init(void);
struct tty *ttymalloc(int);
void ttyfree(struct tty *);
Index: sys/ufs/ufs/ufs_dirhash.c
===================================================================
RCS file: /OpenBSD/src/sys/ufs/ufs/ufs_dirhash.c,v
diff -u -p -r1.43 ufs_dirhash.c
--- sys/ufs/ufs/ufs_dirhash.c 9 Jan 2024 03:15:59 -0000 1.43
+++ sys/ufs/ufs/ufs_dirhash.c 2 Nov 2026 16:23:17 -0000
@@ -80,7 +80,7 @@ struct pool ufsdirhash_pool;
#define DIRHASH_ASSERT(e, m) KASSERT((e))
/* Dirhash list; recently-used entries are near the tail. */
-TAILQ_HEAD(, dirhash) ufsdirhash_list;
+TAILQ_HEAD(, dirhash) ufsdirhash_list = TAILQ_HEAD_INITIALIZER(ufsdirhash_list);
/* Protects: ufsdirhash_list, `dh_list' field, ufs_dirhashmem. */
struct rwlock ufsdirhash_mtx;
@@ -1051,7 +1051,6 @@ ufsdirhash_init(void)
PR_WAITOK, "dirhash", NULL);
rw_init(&ufsdirhash_mtx, "dirhash_list");
arc4random_buf(&ufsdirhash_key, sizeof(ufsdirhash_key));
- TAILQ_INIT(&ufsdirhash_list);
ufs_dirhashmaxmem = 5 * 1024 * 1024;
ufs_mindirhashsize = 5 * DIRBLKSIZ;
}
Index: sys/ufs/ufs/ufs_quota.c
===================================================================
RCS file: /OpenBSD/src/sys/ufs/ufs/ufs_quota.c,v
diff -u -p -r1.48 ufs_quota.c
--- sys/ufs/ufs/ufs_quota.c 20 Sep 2025 13:53:36 -0000 1.48
+++ sys/ufs/ufs/ufs_quota.c 2 Nov 2026 16:23:17 -0000
@@ -810,7 +810,7 @@ u_long dqhash;
* Dquot free list.
*/
#define DQUOTINC 5 /* minimum free dquots desired */
-TAILQ_HEAD(dqfreelist, dquot) dqfreelist;
+TAILQ_HEAD(dqfreelist, dquot) dqfreelist = TAILQ_HEAD_INITIALIZER(dqfreelist);
long numdquot, desireddquot = DQUOTINC;
/*
@@ -821,7 +821,6 @@ ufs_quota_init(void)
{
dqhashtbl = hashinit(initialvnodes, M_DQUOT, M_WAITOK, &dqhash);
arc4random_buf(&dqhashkey, sizeof(dqhashkey));
- TAILQ_INIT(&dqfreelist);
}
/*
Index: sys/uvm/uvm_swap.c
===================================================================
RCS file: /OpenBSD/src/sys/uvm/uvm_swap.c,v
diff -u -p -r1.184 uvm_swap.c
--- sys/uvm/uvm_swap.c 4 Oct 2026 21:12:18 -0000 1.184
+++ sys/uvm/uvm_swap.c 2 Nov 2026 16:23:17 -0000
@@ -211,8 +211,8 @@ struct pool vndbuf_pool;
struct extent *swapmap; /* controls the mapping of /dev/drum */
/* list of all active swap devices [by priority] */
-LIST_HEAD(swap_priority, swappri);
-struct swap_priority swap_priority; /* [S] */
+LIST_HEAD(swap_priority, swappri) swap_priority = /* [S] */
+ LIST_HEAD_INITIALIZER(swappri);
/* locks */
struct mutex uvm_swap_data_lock = MUTEX_INITIALIZER(IPL_MPFLOOR);
@@ -262,7 +262,6 @@ uvm_swap_init(void)
* then get a handle on the vnode for /dev/drum by using
* the its dev_t number ("swapdev", from MD conf.c).
*/
- LIST_INIT(&swap_priority);
atomic_store_int(&uvmexp.nswapdev, 0);
if (!swapdev_vp && bdevvp(swapdev, &swapdev_vp))
Index: sys/uvm/uvm_vnode.c
===================================================================
RCS file: /OpenBSD/src/sys/uvm/uvm_vnode.c,v
diff -u -p -r1.152 uvm_vnode.c
--- sys/uvm/uvm_vnode.c 16 Oct 2026 04:56:21 -0000 1.152
+++ sys/uvm/uvm_vnode.c 2 Nov 2026 16:23:17 -0000
@@ -69,7 +69,8 @@
* we keep a simpleq of vnodes that are currently being sync'd.
*/
struct pool uvm_vnode_pool;
-LIST_HEAD(, uvm_vnode) uvn_wlist; /* [K] writeable uvns */
+LIST_HEAD(, uvm_vnode) uvn_wlist = /* [K] writeable uvns */
+ LIST_HEAD_INITIALIZER(uvn_wlist);
SIMPLEQ_HEAD(, uvm_vnode) uvn_sync_q; /* [S] sync'ing uvns */
struct rwlock uvn_sync_lock; /* locks sync operation */
@@ -116,7 +117,6 @@ uvn_init(void)
{
pool_init(&uvm_vnode_pool, sizeof(struct uvm_vnode), 0, IPL_NONE,
PR_WAITOK, "uvmvnodes", NULL);
- LIST_INIT(&uvn_wlist);
/* note: uvn_sync_q init'd in uvm_vnp_sync() */
rw_init_flags(&uvn_sync_lock, "uvnsync", RWL_IS_VNODE);
}
kernel: more compile-time initializers