mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Working on cleansing use of (SI_SUB_FOO + 1) construct through the kernel I found a repeating pattern. Often a developer adds a module that depends on certain subsystem to be fully instantiated and they want to put their module SYSINIT right at the end of the SI_SUB_FOO. Such module usually expects that nothing else within this subsystem shall depend on the module. The problem with SI_ORDER_ANY which practically was "the last" until this change is that it is used very widely and people treat it literally as "any", well, because this is what the name says. This lead to many parts that could have dependencies later to be added as SI_ORDER_ANY. So, our developer with the new subsystem that depends on SI_SUB_FOO has three options: 1) Use SI_ORDER_ANY, but grep around ther kernel for other SI_SUB_FOO entries to make sure that no dependencies are set to SI_ORDER_ANY. And in case they are, shift them up and recheck if dependencies of those dependencies are met. 2) Take next subsystem in sysinit list. However, the next one can be SI_SUB_BAR, that is completely irrelevant from SI_SUB_FOO, and our developer doesn't want to put his module's SYSINIT into SI_SUB_BAR, cause it is ugly. 3) Use the (SI_SUB_FOO + 1) construct that violates -Werror=assign-enum. The SI_ORDER_LAST solves this hard choice. If you know that nothing is going to depend on your module within SI_SUB_FOO, but you depend on SI_SUB_FOO, just use SI_ORDER_LAST. Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D58709