Define the scheduler interface once and for all (in 'sys/sys/sched.h')
and remove all code duplication related to it (function signatures, slot
names, dispatch, scheduler instance declaration), making it easier to
modify the interface or to add new schedulers.
This is implemented by defining the interface as X macros, which are
passed a macro (and additional arguments for it) that is "called" with
a variable number of arguments describing a single function of the
interface. The convention used for a function's parameters is that each
parameter is represented with two macro arguments, the first one being
the type and the second one being the name. Helper macros allow to
process arguments described in this convention in order to generate
a list of arguments for function definitions (currently, up to
4 function parameters). The chosen convention eliminates the need for
any specific declaration of functions depending on their number of
arguments.
DECLARE_SCHEDULER() has been changed to automatically declare and fill
a 'struct sched_instance' structure. Its number of parameters has been
reduced to the minimum, and the symbol part used to produce distinct
structure names can now start with a digit (useful for 4BSD).
The new implementation has the following additional benefits:
- The name of implementations for the interface functions is imposed (same name as the interface function but with the scheduler symbol that was passed to DECLARE_SCHEDULER() added just after the 'sched_' prefix, e.g., for ULE, 'sched_ule_*()') and checked at compile-time.
- Missing functions in an implementation are detected at compile-time (and not at runtime with a NULL dereference).
- Failures to fill correctly the 'struct sched_instance' object associated to an implementation are eliminated.
Preserve comments/categories of interface functions by moving comments
that were in the old explicit interface declarations to the SCHED_ITF*()
macros, and while here, marginally improve some (and move the common
documentation for sched_initticks() from the implementations to the
interface). Several of them are not exact, but this will be fixed in
a separate commit.
Make the active scheduler instance object internal, as the purpose of
the interface is precisely to hide the actual implementation.
Fixes: ce38acee8d0b ("Add kern/sched_shim.c") (+ some followups)