Re: git: 662497d5a741 - main - SYSINIT: add explicit SI_ORDER_LAST

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Tue, 25 Aug 2026 19:18:03 UTC
On Mon, Aug 24, 2026 at 09:50:18AM +0000, Brooks Davis wrote:
B> Given that SI_ORDER_LAST isn't UINT_MAX, should we have an assert like
B> the one below so LAST continues to be last?
B> 
B> -- Brooks
B> 
B> diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
B> index 8cbdd645a230..9825b71a746e 100644
B> --- a/sys/kern/init_main.c
B> +++ b/sys/kern/init_main.c
B> @@ -200,8 +200,10 @@ sysinit_mklist(struct sysinitlist *list, struct
B> sysinit **set,
B> 	TSENTER();
B> 	TSENTER2("listify");
B> 	STAILQ_INIT(list);
B> -	for (sipp = set; sipp < set_end; sipp++)
B> +	for (sipp = set; sipp < set_end; sipp++) {
B> +		MPASS((*sipp)->order <= SI_ORDER_LAST);
B> 		STAILQ_INSERT_TAIL(list, *sipp, next);
B> +	}
B> 	TSEXIT2("listify");
B> 	TSENTER2("mergesort");
B> 	STAILQ_MERGESORT(list, NULL, sysinit_compar, sysinit, next);

I'm not against this change, but if we enable -Werror=assign-enum for
the kernel compilation, any incorrect use of SYSINIT orders and subsystems
is going to be catched at compile time.

See https://github.com/freebsd/freebsd-src/compare/main...glebius:FreeBSD:Werror%3Dassign-enum

-- 
Gleb Smirnoff