Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102599332
D40450.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
45 KB
Referenced Files
None
Subscribers
None
D40450.diff
View Options
diff --git a/share/man/man9/SYSINIT.9 b/share/man/man9/SYSINIT.9
--- a/share/man/man9/SYSINIT.9
+++ b/share/man/man9/SYSINIT.9
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 1, 2010
+.Dd June 7, 2023
.Dt SYSINIT 9
.Os
.Sh NAME
@@ -34,8 +34,8 @@
.Sh SYNOPSIS
.In sys/param.h
.In sys/kernel.h
-.Fn SYSINIT "uniquifier" "enum sysinit_sub_id subsystem" "enum sysinit_elem_order order" "sysinit_cfunc_t func" "const void *ident"
-.Fn SYSUNINIT "uniquifier" "enum sysinit_sub_id subsystem" "enum sysinit_elem_order order" "sysinit_cfunc_t func" "const void *ident"
+.Fn SYSINIT "uniquifier" "enum sysinit_sub_id subsystem" "enum sysinit_elem_order order" "func" "args..."
+.Fn SYSUNINIT "uniquifier" "enum sysinit_sub_id subsystem" "enum sysinit_elem_order order" "func" "args..."
.Sh DESCRIPTION
.Nm
is a mechanism for scheduling the execution of initialization and teardown
@@ -47,6 +47,12 @@
.Pp
The
.Fn SYSINIT
+and
+.Fn SYSUNINIT
+macros may not be used inside function blocks.
+.Pp
+The
+.Fn SYSINIT
macro creates a
.Vt struct sysinit
and stores it in a startup linker set.
@@ -78,10 +84,9 @@
.Fa order
of initialization within the subsystem, the
.Fa func
-function to call,
-and the data specified in
-.Fa ident
-argument to pass the function.
+function to call
+and the arguments, if any, are given by the
+.Fa args .
.Pp
The
.Fn SYSUNINIT
@@ -130,15 +135,24 @@
.Sy not
executed during shutdown.
.Sh EXAMPLES
-This example shows the SYSINIT which displays the copyright notice during boot:
+How to create a SYSINIT() passing no arguments to a callback function:
+.Bd -literal -offset indent
+static void
+print_notice(void)
+{
+ printf("This is a 2-clause-BSD licensed system\n");
+}
+SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_notice, NULL);
+.Pp
+How to create a SYSINIT() passing a single argument to a callback function:
.Bd -literal -offset indent
+static const char notice[] = "This is a 2-clause-BSD licensed system\n";
static void
-print_caddr_t(void *data)
+print_notice(const char *data)
{
- printf("%s", (char *)data);
+ printf("%s", notice);
}
-SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t,
- copyright);
+SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_notice, notice);
.Ed
.Sh SEE ALSO
.Xr kld 4 ,
@@ -146,7 +160,11 @@
.Xr DEV_MODULE 9 ,
.Xr DRIVER_MODULE 9 ,
.Xr MTX_SYSINIT 9 ,
-.Xr SYSCALL_MODULE 9
+.Xr RM_SYSINIT 9 ,
+.Xr RW_SYSINIT 9 ,
+.Xr SX_SYSINIT 9 ,
+.Xr SYSCALL_MODULE 9 ,
+.Xr VNET_SYSINIT 9
.Sh HISTORY
The
.Nm
diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c
--- a/sys/amd64/amd64/elf_machdep.c
+++ b/sys/amd64/amd64/elf_machdep.c
@@ -232,7 +232,7 @@
};
SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo);
+ elf64_insert_brand_entry, &freebsd_brand_oinfo);
static Elf64_Brandinfo kfreebsd_brand_info = {
.brand = ELFOSABI_FREEBSD,
@@ -247,7 +247,7 @@
};
SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t)elf64_insert_brand_entry, &kfreebsd_brand_info);
+ elf64_insert_brand_entry, &kfreebsd_brand_info);
void
elf64_dump_thread(struct thread *td, void *dst, size_t *off)
diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c
--- a/sys/arm/arm/elf_machdep.c
+++ b/sys/arm/arm/elf_machdep.c
@@ -122,7 +122,7 @@
};
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&freebsd_brand_info);
static bool
diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -1275,7 +1275,7 @@
pc->pc_qmap_addr = pages + (PAGE_SIZE * 2);
}
}
-SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL);
+SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages);
/*
* The function can already be use in second initialization stage.
diff --git a/sys/arm/arm/vfp.c b/sys/arm/arm/vfp.c
--- a/sys/arm/arm/vfp.c
+++ b/sys/arm/arm/vfp.c
@@ -195,7 +195,7 @@
}
}
-SYSINIT(vfp, SI_SUB_CPU, SI_ORDER_ANY, vfp_init, NULL);
+SYSINIT(vfp, SI_SUB_CPU, SI_ORDER_ANY, vfp_init);
/* start VFP unit, restore the vfp registers from the PCB and retry
* the instruction
diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -140,7 +140,7 @@
};
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
- (sysinit_cfunc_t)elf32_insert_brand_entry, &freebsd32_brand_info);
+ elf32_insert_brand_entry, &freebsd32_brand_info);
static bool
elf32_arm_abi_supported(struct image_params *imgp, int32_t *osrel __unused,
diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c
--- a/sys/arm64/arm64/elf_machdep.c
+++ b/sys/arm64/arm64/elf_machdep.c
@@ -118,7 +118,7 @@
};
SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
- (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info);
+ elf64_insert_brand_entry, &freebsd_brand_info);
static bool
get_arm64_addr_mask(struct regset *rs, struct thread *td, void *buf,
diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c
--- a/sys/arm64/arm64/vfp.c
+++ b/sys/arm64/arm64/vfp.c
@@ -296,7 +296,7 @@
thread0.td_pcb->pcb_fpusaved->vfp_fpcr = VFPCR_INIT;
}
-SYSINIT(vfp, SI_SUB_CPU, SI_ORDER_ANY, vfp_init, NULL);
+SYSINIT(vfp, SI_SUB_CPU, SI_ORDER_ANY, vfp_init);
struct fpu_kern_ctx *
fpu_kern_alloc_ctx(u_int flags)
diff --git a/sys/arm64/coresight/coresight.c b/sys/arm64/coresight/coresight.c
--- a/sys/arm64/coresight/coresight.c
+++ b/sys/arm64/coresight/coresight.c
@@ -123,4 +123,4 @@
TAILQ_INIT(&cs_devs);
}
-SYSINIT(coresight, SI_SUB_DRIVERS, SI_ORDER_FIRST, coresight_init, NULL);
+SYSINIT(coresight, SI_SUB_DRIVERS, SI_ORDER_FIRST, coresight_init);
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -9308,7 +9308,7 @@
set_scsi_delay(SCSI_DELAY);
}
}
-SYSINIT(scsi_delay, SI_SUB_TUNABLES, SI_ORDER_ANY, init_scsi_delay, NULL);
+SYSINIT(scsi_delay, SI_SUB_TUNABLES, SI_ORDER_ANY, init_scsi_delay);
static int
sysctl_scsi_delay(SYSCTL_HANDLER_ARGS)
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris.c b/sys/cddl/compat/opensolaris/kern/opensolaris.c
--- a/sys/cddl/compat/opensolaris/kern/opensolaris.c
+++ b/sys/cddl/compat/opensolaris/kern/opensolaris.c
@@ -75,7 +75,7 @@
mutex_destroy(&cpu_lock);
}
-SYSUNINIT(opensolaris_unregister, SI_SUB_OPENSOLARIS, SI_ORDER_FIRST, opensolaris_unload, NULL);
+SYSUNINIT(opensolaris_unregister, SI_SUB_OPENSOLARIS, SI_ORDER_FIRST, opensolaris_unload);
static int
opensolaris_modevent(module_t mod __unused, int type, void *data __unused)
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
@@ -18431,7 +18431,7 @@
#include <dtrace_isa.c>
SYSINIT(dtrace_load, SI_SUB_DTRACE, SI_ORDER_FIRST, dtrace_load, NULL);
-SYSUNINIT(dtrace_unload, SI_SUB_DTRACE, SI_ORDER_FIRST, dtrace_unload, NULL);
+SYSUNINIT(dtrace_unload, SI_SUB_DTRACE, SI_ORDER_FIRST, dtrace_unload);
SYSINIT(dtrace_anon_init, SI_SUB_DTRACE_ANON, SI_ORDER_FIRST, dtrace_anon_init, NULL);
DEV_MODULE(dtrace, dtrace_modevent, NULL);
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
@@ -2657,10 +2657,8 @@
return (error);
}
-SYSINIT(fasttrap_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fasttrap_load,
- NULL);
-SYSUNINIT(fasttrap_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY,
- fasttrap_unload, NULL);
+SYSINIT(fasttrap_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fasttrap_load);
+SYSUNINIT(fasttrap_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fasttrap_unload);
DEV_MODULE(fasttrap, fasttrap_modevent, NULL);
MODULE_VERSION(fasttrap, 1);
diff --git a/sys/cddl/dev/dtmalloc/dtmalloc.c b/sys/cddl/dev/dtmalloc/dtmalloc.c
--- a/sys/cddl/dev/dtmalloc/dtmalloc.c
+++ b/sys/cddl/dev/dtmalloc/dtmalloc.c
@@ -211,7 +211,7 @@
}
SYSINIT(dtmalloc_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, dtmalloc_load, NULL);
-SYSUNINIT(dtmalloc_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, dtmalloc_unload, NULL);
+SYSUNINIT(dtmalloc_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, dtmalloc_unload);
DEV_MODULE(dtmalloc, dtmalloc_modevent, NULL);
MODULE_VERSION(dtmalloc, 1);
diff --git a/sys/cddl/dev/fbt/fbt.c b/sys/cddl/dev/fbt/fbt.c
--- a/sys/cddl/dev/fbt/fbt.c
+++ b/sys/cddl/dev/fbt/fbt.c
@@ -1316,7 +1316,7 @@
}
SYSINIT(fbt_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fbt_load, NULL);
-SYSUNINIT(fbt_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fbt_unload, NULL);
+SYSUNINIT(fbt_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, fbt_unload);
DEV_MODULE(fbt, fbt_modevent, NULL);
MODULE_VERSION(fbt, 1);
diff --git a/sys/cddl/dev/profile/profile.c b/sys/cddl/dev/profile/profile.c
--- a/sys/cddl/dev/profile/profile.c
+++ b/sys/cddl/dev/profile/profile.c
@@ -659,7 +659,7 @@
}
SYSINIT(profile_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, profile_load, NULL);
-SYSUNINIT(profile_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, profile_unload, NULL);
+SYSUNINIT(profile_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, profile_unload);
DEV_MODULE(profile, profile_modevent, NULL);
MODULE_VERSION(profile, 1);
diff --git a/sys/cddl/dev/prototype.c b/sys/cddl/dev/prototype.c
--- a/sys/cddl/dev/prototype.c
+++ b/sys/cddl/dev/prototype.c
@@ -139,7 +139,7 @@
}
SYSINIT(prototype_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_load, NULL);
-SYSUNINIT(prototype_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_unload, NULL);
+SYSUNINIT(prototype_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_unload);
DEV_MODULE(prototype, prototype_modevent, NULL);
MODULE_VERSION(prototype, 1);
diff --git a/sys/cddl/dev/sdt/sdt.c b/sys/cddl/dev/sdt/sdt.c
--- a/sys/cddl/dev/sdt/sdt.c
+++ b/sys/cddl/dev/sdt/sdt.c
@@ -433,8 +433,8 @@
}
}
-SYSINIT(sdt_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, sdt_load, NULL);
-SYSUNINIT(sdt_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, sdt_unload, NULL);
+SYSINIT(sdt_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, sdt_load);
+SYSUNINIT(sdt_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, sdt_unload);
DEV_MODULE(sdt, sdt_modevent, NULL);
MODULE_VERSION(sdt, 1);
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c
--- a/sys/compat/ia32/ia32_sysvec.c
+++ b/sys/compat/ia32/ia32_sysvec.c
@@ -160,7 +160,7 @@
};
SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_MIDDLE,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&ia32_brand_info);
static Elf32_Brandinfo ia32_brand_oinfo = {
@@ -176,7 +176,7 @@
};
SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&ia32_brand_oinfo);
static Elf32_Brandinfo kia32_brand_info = {
@@ -191,7 +191,7 @@
};
SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&kia32_brand_info);
void
diff --git a/sys/dev/fdt/fdt_slicer.c b/sys/dev/fdt/fdt_slicer.c
--- a/sys/dev/fdt/fdt_slicer.c
+++ b/sys/dev/fdt/fdt_slicer.c
@@ -163,8 +163,8 @@
* i. e. after g_init() is called, due to the use of the GEOM topology_lock
* in flash_register_slicer(). However, must be before SI_SUB_CONFIGURE.
*/
-SYSINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_THIRD, fdt_slicer_init, NULL);
-SYSUNINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_THIRD, fdt_slicer_cleanup, NULL);
+SYSINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_THIRD, fdt_slicer_init);
+SYSUNINIT(fdt_slicer, SI_SUB_DRIVERS, SI_ORDER_THIRD, fdt_slicer_cleanup);
static int
mod_handler(module_t mod, int type, void *data)
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -87,7 +87,7 @@
sizeof(struct iommu_map_entry), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NODUMP);
}
-SYSINIT(intel_gas, SI_SUB_DRIVERS, SI_ORDER_FIRST, intel_gas_init, NULL);
+SYSINIT(intel_gas, SI_SUB_DRIVERS, SI_ORDER_FIRST, intel_gas_init);
struct iommu_map_entry *
iommu_gas_alloc_entry(struct iommu_domain *domain, u_int flags)
diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c
--- a/sys/dev/mlx4/mlx4_core/mlx4_main.c
+++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c
@@ -1164,6 +1164,8 @@
return err;
}
+static DEFINE_MUTEX(mlx4_set_port_type_mutex);
+
static ssize_t set_port_type(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
@@ -1172,10 +1174,9 @@
port_attr);
struct mlx4_dev *mdev = info->dev;
enum mlx4_port_type port_type;
- static DEFINE_MUTEX(set_port_type_mutex);
int err;
- mutex_lock(&set_port_type_mutex);
+ mutex_lock(&mlx4_set_port_type_mutex);
if (!strcmp(buf, "ib\n")) {
port_type = MLX4_PORT_TYPE_IB;
@@ -1192,7 +1193,7 @@
err = __set_port_type(info, port_type);
err_out:
- mutex_unlock(&set_port_type_mutex);
+ mutex_unlock(&mlx4_set_port_type_mutex);
return err ? err : count;
}
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -61,15 +61,13 @@
for (i = 0; i < NVME_MAX_CONSUMERS; i++)
nvme_consumer[i].id = INVALID_CONSUMER_ID;
}
-
-SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL);
+SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init);
static void
nvme_uninit(void)
{
}
-
-SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL);
+SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit);
int
nvme_shutdown(device_t dev)
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -385,7 +385,7 @@
}
SYSINIT(nvme_sim_register, SI_SUB_DRIVERS, SI_ORDER_ANY,
- nvme_sim_init, NULL);
+ nvme_sim_init);
static void
nvme_sim_uninit(void)
@@ -398,4 +398,4 @@
}
SYSUNINIT(nvme_sim_unregister, SI_SUB_DRIVERS, SI_ORDER_ANY,
- nvme_sim_uninit, NULL);
+ nvme_sim_uninit);
diff --git a/sys/dev/xdma/xdma.c b/sys/dev/xdma/xdma.c
--- a/sys/dev/xdma/xdma.c
+++ b/sys/dev/xdma/xdma.c
@@ -563,4 +563,4 @@
mtx_init(&xdma_mtx, "xDMA", NULL, MTX_DEF);
}
-SYSINIT(xdma, SI_SUB_DRIVERS, SI_ORDER_FIRST, xdma_init, NULL);
+SYSINIT(xdma, SI_SUB_DRIVERS, SI_ORDER_FIRST, xdma_init);
diff --git a/sys/fs/nfsclient/nfs_clkdtrace.c b/sys/fs/nfsclient/nfs_clkdtrace.c
--- a/sys/fs/nfsclient/nfs_clkdtrace.c
+++ b/sys/fs/nfsclient/nfs_clkdtrace.c
@@ -576,7 +576,7 @@
SYSINIT(dtnfsclient_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY,
dtnfsclient_load, NULL);
SYSUNINIT(dtnfsclient_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY,
- dtnfsclient_unload, NULL);
+ dtnfsclient_unload);
DEV_MODULE(dtnfscl, dtnfsclient_modevent, NULL);
MODULE_VERSION(dtnfscl, 1);
diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c
--- a/sys/i386/i386/elan-mmcr.c
+++ b/sys/i386/i386/elan-mmcr.c
@@ -508,4 +508,4 @@
EVENTHANDLER_REGISTER(watchdog_list, elan_watchdog, NULL, 0);
}
-SYSINIT(elan, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, elan_drvinit, NULL);
+SYSINIT(elan, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, elan_drvinit);
diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c
--- a/sys/i386/i386/elf_machdep.c
+++ b/sys/i386/i386/elf_machdep.c
@@ -108,7 +108,7 @@
};
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&freebsd_brand_info);
static Elf32_Brandinfo freebsd_brand_oinfo = {
@@ -124,7 +124,7 @@
};
SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&freebsd_brand_oinfo);
static Elf32_Brandinfo kfreebsd_brand_info = {
@@ -140,7 +140,7 @@
};
SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&kfreebsd_brand_info);
void
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -1697,7 +1697,7 @@
PCPU_SET(copyout_buf, copyout_buf);
copyout_init_tramp();
}
-SYSINIT(vm_mem, SI_SUB_VM, SI_ORDER_SECOND, machdep_init_trampoline, NULL);
+SYSINIT(vm_mem, SI_SUB_VM, SI_ORDER_SECOND, machdep_init_trampoline);
#ifdef COMPAT_43
static void
@@ -1722,7 +1722,7 @@
desc.sd_hibase = lcall_addr >> 24;
bcopy(&desc, &ldt[LSYS5CALLS_SEL], sizeof(desc));
}
-SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, i386_setup_lcall_gate, NULL);
+SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, i386_setup_lcall_gate);
#endif
void
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -788,7 +788,7 @@
}
}
-SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL);
+SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages);
/*
* Setup the PAT MSR.
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -153,7 +153,11 @@
* symbol is not undefined. A sybsystem ID of SI_SUB_DUMMY is never
* executed.
*/
-SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL);
+static void
+placeholder(void)
+{
+}
+SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, placeholder);
/*
* The sysinit table itself. Items are checked off as the are run.
@@ -359,7 +363,7 @@
}
static void
-print_version(void *data __unused)
+print_version(void)
{
int len;
@@ -375,7 +379,7 @@
copyright);
SYSINIT(trademark, SI_SUB_COPYRIGHT, SI_ORDER_SECOND, print_caddr_t,
trademark);
-SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version, NULL);
+SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version);
#ifdef WITNESS
static char wit_warn[] =
@@ -456,7 +460,7 @@
*/
/* ARGSUSED*/
static void
-proc0_init(void *dummy __unused)
+proc0_init(void)
{
struct proc *p;
struct thread *td;
@@ -640,11 +644,11 @@
racct_add_force(p, RACCT_NPROC, 1);
PROC_UNLOCK(p);
}
-SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL);
+SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init);
/* ARGSUSED*/
static void
-proc0_post(void *dummy __unused)
+proc0_post(void)
{
struct proc *p;
struct rusage ru;
@@ -678,7 +682,7 @@
PCPU_SET(switchtime, cpu_ticks());
PCPU_SET(switchticks, ticks);
}
-SYSINIT(p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post, NULL);
+SYSINIT(p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post);
/*
***************************************************************************
@@ -806,7 +810,7 @@
* runnable yet, init execution is started when userspace can be served.
*/
static void
-create_init(const void *udata __unused)
+create_init(void)
{
struct fork_req fr;
struct ucred *newcred, *oldcred;
@@ -845,13 +849,13 @@
cpu_fork_kthread_handler(FIRST_THREAD_IN_PROC(initproc),
start_init, NULL);
}
-SYSINIT(init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init, NULL);
+SYSINIT(init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init);
/*
* Make it runnable now.
*/
static void
-kick_init(const void *udata __unused)
+kick_init(void)
{
struct thread *td;
@@ -860,7 +864,7 @@
TD_SET_CAN_RUN(td);
sched_add(td, SRQ_BORING);
}
-SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, kick_init, NULL);
+SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, kick_init);
/*
* DDB(4).
diff --git a/sys/kern/kern_boottrace.c b/sys/kern/kern_boottrace.c
--- a/sys/kern/kern_boottrace.c
+++ b/sys/kern/kern_boottrace.c
@@ -609,4 +609,4 @@
st.table = malloc(st.size * sizeof(struct bt_event), M_BOOTTRACE,
M_WAITOK | M_ZERO);
}
-SYSINIT(boottrace, SI_SUB_CPU, SI_ORDER_ANY, boottrace_init, 0);
+SYSINIT(boottrace, SI_SUB_CPU, SI_ORDER_ANY, boottrace_init);
diff --git a/sys/kern/kern_devctl.c b/sys/kern/kern_devctl.c
--- a/sys/kern/kern_devctl.c
+++ b/sys/kern/kern_devctl.c
@@ -170,7 +170,7 @@
EVENTHANDLER_REGISTER(device_nomatch, devctl_nomatch_handler,
NULL, EVENTHANDLER_PRI_LAST);
}
-SYSINIT(devctl_init, SI_SUB_DRIVERS, SI_ORDER_SECOND, devctl_init, NULL);
+SYSINIT(devctl_init, SI_SUB_DRIVERS, SI_ORDER_SECOND, devctl_init);
/*
* A device was added to the tree. We are called just after it successfully
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -2790,7 +2790,7 @@
NULL, NULL, UMA_ALIGN_PTR, 0);
ast_register(TDA_KQUEUE, ASTR_ASTF_REQUIRED, 0, ast_kqueue);
}
-SYSINIT(knote, SI_SUB_PSEUDO, SI_ORDER_ANY, knote_init, NULL);
+SYSINIT(knote, SI_SUB_PSEUDO, SI_ORDER_ANY, knote_init);
static struct knote *
knote_alloc(int mflag)
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -423,9 +423,7 @@
linker_file_register_modules(linker_kernel_file);
sx_xunlock(&kld_sx);
}
-
-SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules,
- NULL);
+SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules);
static int
linker_load_file(const char *filename, linker_file_t *result)
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -309,7 +309,7 @@
if (numzones > MALLOC_DEBUG_MAXZONES)
numzones = MALLOC_DEBUG_MAXZONES;
}
-SYSINIT(numzones, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_set_numzones, NULL);
+SYSINIT(numzones, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_set_numzones);
SYSCTL_INT(_debug_malloc, OID_AUTO, numzones, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
&numzones, 0, "Number of malloc uma subzones");
diff --git a/sys/kern/kern_poll.c b/sys/kern/kern_poll.c
--- a/sys/kern/kern_poll.c
+++ b/sys/kern/kern_poll.c
@@ -276,7 +276,7 @@
EVENTHANDLER_REGISTER(shutdown_post_sync, poll_shutdown, NULL,
SHUTDOWN_PRI_LAST);
}
-SYSINIT(device_poll, SI_SUB_SOFTINTR, SI_ORDER_MIDDLE, init_device_poll, NULL);
+SYSINIT(device_poll, SI_SUB_SOFTINTR, SI_ORDER_MIDDLE, init_device_poll);
/*
* Hook from hardclock. Tries to schedule a netisr, but keeps track
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -1350,7 +1350,7 @@
kproc_start(&racctd_kp);
}
-SYSINIT(racctd, SI_SUB_RACCTD, SI_ORDER_FIRST, racctd_init, NULL);
+SYSINIT(racctd, SI_SUB_RACCTD, SI_ORDER_FIRST, racctd_init);
static void
racct_init(void)
@@ -1367,6 +1367,6 @@
*/
prison0.pr_prison_racct = prison_racct_find("0");
}
-SYSINIT(racct, SI_SUB_RACCT, SI_ORDER_FIRST, racct_init, NULL);
+SYSINIT(racct, SI_SUB_RACCT, SI_ORDER_FIRST, racct_init);
#endif /* !RACCT */
diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c
--- a/sys/kern/kern_rangelock.c
+++ b/sys/kern/kern_rangelock.c
@@ -54,7 +54,7 @@
rl_entry_zone = uma_zcreate("rl_entry", sizeof(struct rl_q_entry),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
}
-SYSINIT(vfs, SI_SUB_LOCK, SI_ORDER_ANY, rangelock_sys_init, NULL);
+SYSINIT(vfs, SI_SUB_LOCK, SI_ORDER_ANY, rangelock_sys_init);
static struct rl_q_entry *
rlqentry_alloc(void)
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -213,7 +213,7 @@
{ NULL, -1 }};
static void rctl_init(void);
-SYSINIT(rctl, SI_SUB_RACCT, SI_ORDER_FIRST, rctl_init, NULL);
+SYSINIT(rctl, SI_SUB_RACCT, SI_ORDER_FIRST, rctl_init);
static uma_zone_t rctl_rule_zone;
static uma_zone_t rctl_rule_link_zone;
diff --git a/sys/kern/kern_sharedpage.c b/sys/kern/kern_sharedpage.c
--- a/sys/kern/kern_sharedpage.c
+++ b/sys/kern/kern_sharedpage.c
@@ -114,7 +114,7 @@
}
static void
-shared_page_init(void *dummy __unused)
+shared_page_init(void)
{
vm_page_t m;
vm_offset_t addr;
@@ -132,8 +132,7 @@
shared_page_mapping = (char *)addr;
}
-SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)shared_page_init,
- NULL);
+SYSINIT(shp, SI_SUB_EXEC, SI_ORDER_FIRST, shared_page_init);
/*
* Push the timehands update to the shared page.
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -174,7 +174,7 @@
"Discard ignored signals on delivery, otherwise queue them to "
"the target queue");
-SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDER_FIRST+3, sigqueue_start, NULL);
+SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDER_FIRST+3, sigqueue_start);
/*
* Policy -- Can ucred cr1 send SIGIO to process cr2?
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -117,7 +117,7 @@
#define CLOCK_CALL(clock, call, arglist) \
((*posix_clocks[clock].call) arglist)
-SYSINIT(posix_timer, SI_SUB_P1003_1B, SI_ORDER_FIRST+4, itimer_start, NULL);
+SYSINIT(posix_timer, SI_SUB_P1003_1B, SI_ORDER_FIRST+4, itimer_start);
static int
settime(struct thread *td, struct timeval *tv)
diff --git a/sys/kern/subr_pcpu.c b/sys/kern/subr_pcpu.c
--- a/sys/kern/subr_pcpu.c
+++ b/sys/kern/subr_pcpu.c
@@ -118,7 +118,7 @@
}
static void
-dpcpu_startup(void *dummy __unused)
+dpcpu_startup(void)
{
struct dpcpu_free *df;
@@ -128,7 +128,7 @@
TAILQ_INSERT_HEAD(&dpcpu_head, df, df_link);
sx_init(&dpcpu_lock, "dpcpu alloc lock");
}
-SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, NULL);
+SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup);
/*
* UMA_ZONE_PCPU zones for general kernel use.
@@ -154,7 +154,7 @@
pcpu_zone_64 = uma_zcreate("pcpu-64", 64,
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
}
-SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup, NULL);
+SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup);
/*
* First-fit extent based allocator for allocating space in the per-cpu
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -208,7 +208,7 @@
}
SYSINIT(sleepqueue_profiling, SI_SUB_LOCK, SI_ORDER_ANY,
- init_sleepqueue_profiling, NULL);
+ init_sleepqueue_profiling);
#endif
/*
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -581,7 +581,7 @@
soaio_kproc_unr = new_unrhdr(1, INT_MAX, NULL);
TASK_INIT(&soaio_kproc_task, 0, soaio_kproc_create, NULL);
}
-SYSINIT(soaio, SI_SUB_VFS, SI_ORDER_ANY, soaio_init, NULL);
+SYSINIT(soaio, SI_SUB_VFS, SI_ORDER_ANY, soaio_init);
static __inline int
soaio_ready(struct socket *so, struct sockbuf *sb)
diff --git a/sys/libkern/arc4random.c b/sys/libkern/arc4random.c
--- a/sys/libkern/arc4random.c
+++ b/sys/libkern/arc4random.c
@@ -175,7 +175,7 @@
explicit_bzero(&chacha20->ctx, sizeof(chacha20->ctx));
}
}
-SYSINIT(chacha20, SI_SUB_LOCK, SI_ORDER_ANY, chacha20_init, NULL);
+SYSINIT(chacha20, SI_SUB_LOCK, SI_ORDER_ANY, chacha20_init);
static void
@@ -187,7 +187,7 @@
mtx_destroy(&chacha20->mtx);
free(chacha20inst, M_CHACHA20RANDOM);
}
-SYSUNINIT(chacha20, SI_SUB_LOCK, SI_ORDER_ANY, chacha20_uninit, NULL);
+SYSUNINIT(chacha20, SI_SUB_LOCK, SI_ORDER_ANY, chacha20_uninit);
/*
diff --git a/sys/libkern/x86/crc32_sse42.c b/sys/libkern/x86/crc32_sse42.c
--- a/sys/libkern/x86/crc32_sse42.c
+++ b/sys/libkern/x86/crc32_sse42.c
@@ -210,7 +210,7 @@
crc32c_zeros(crc32c_2short, 2 * SHORT);
}
#ifdef _KERNEL
-SYSINIT(crc32c_sse42, SI_SUB_LOCK, SI_ORDER_ANY, crc32c_init_hw, NULL);
+SYSINIT(crc32c_sse42, SI_SUB_LOCK, SI_ORDER_ANY, crc32c_init_hw);
#endif
/* Compute CRC-32C using the Intel hardware instruction. */
diff --git a/sys/net/route.c b/sys/net/route.c
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -93,7 +93,7 @@
nhops_init();
}
-SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, NULL);
+SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init);
struct rib_head *
rt_table_init(int offset, int family, u_int fibnum)
diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c
--- a/sys/net/route/route_tables.c
+++ b/sys/net/route/route_tables.c
@@ -194,7 +194,7 @@
};
osd_jail_register(rtables_prison_destructor, methods);
}
-SYSINIT(rtables_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rtables_init, NULL);
+SYSINIT(rtables_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rtables_init);
/*
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -315,7 +315,7 @@
rtsbridge_orig_p = rtsock_callback_p;
rtsock_callback_p = &rtsbridge;
}
-SYSINIT(rtsock_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rtsock_init, NULL);
+SYSINIT(rtsock_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rtsock_init);
static void
rts_handle_ifnet_arrival(void *arg __unused, struct ifnet *ifp)
diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -204,7 +204,7 @@
ieee80211_send_action_register(IEEE80211_ACTION_CAT_HT,
IEEE80211_ACTION_HT_TXCHWIDTH, ht_send_action_ht_txchwidth);
}
-SYSINIT(wlan_ht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_ht_init, NULL);
+SYSINIT(wlan_ht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_ht_init);
static int ieee80211_ampdu_enable(struct ieee80211_node *ni,
struct ieee80211_tx_ampdu *tap);
diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c
--- a/sys/net80211/ieee80211_hwmp.c
+++ b/sys/net80211/ieee80211_hwmp.c
@@ -252,7 +252,7 @@
*/
ieee80211_mesh_register_proto_path(&mesh_proto_hwmp);
}
-SYSINIT(wlan_hwmp, SI_SUB_DRIVERS, SI_ORDER_SECOND, ieee80211_hwmp_init, NULL);
+SYSINIT(wlan_hwmp, SI_SUB_DRIVERS, SI_ORDER_SECOND, ieee80211_hwmp_init);
static void
hwmp_vattach(struct ieee80211vap *vap)
diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c
--- a/sys/net80211/ieee80211_mesh.c
+++ b/sys/net80211/ieee80211_mesh.c
@@ -607,7 +607,7 @@
ieee80211_mesh_register_proto_metric(&mesh_metric_airtime);
}
-SYSINIT(wlan_mesh, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_mesh_init, NULL);
+SYSINIT(wlan_mesh, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_mesh_init);
void
ieee80211_mesh_attach(struct ieee80211com *ic)
diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c
--- a/sys/net80211/ieee80211_phy.c
+++ b/sys/net80211/ieee80211_phy.c
@@ -369,7 +369,7 @@
ieee80211_setup_ratetable(ratetables[i]);
}
-SYSINIT(wlan_phy, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_phy_init, NULL);
+SYSINIT(wlan_phy, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_phy_init);
const struct ieee80211_rate_table *
ieee80211_get_ratetable(struct ieee80211_channel *c)
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -466,7 +466,7 @@
ieee80211_authenticator_register(IEEE80211_AUTH_SHARED, &auth_internal);
ieee80211_authenticator_register(IEEE80211_AUTH_AUTO, &auth_internal);
}
-SYSINIT(wlan_auth, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_auth_setup, NULL);
+SYSINIT(wlan_auth, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_auth_setup);
const struct ieee80211_authenticator *
ieee80211_authenticator_get(int auth)
diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c
--- a/sys/net80211/ieee80211_vht.c
+++ b/sys/net80211/ieee80211_vht.c
@@ -125,7 +125,7 @@
WLAN_ACTION_VHT_OPMODE_NOTIF, vht_send_action_placeholder);
}
-SYSINIT(wlan_vht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_vht_init, NULL);
+SYSINIT(wlan_vht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_vht_init);
void
ieee80211_vht_attach(struct ieee80211com *ic)
diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c
--- a/sys/netinet/cc/cc.c
+++ b/sys/netinet/cc/cc.c
@@ -651,7 +651,7 @@
return (err);
}
-SYSINIT(cc, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, cc_init, NULL);
+SYSINIT(cc, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, cc_init);
/* Declare sysctl tree and populate it. */
SYSCTL_NODE(_net_inet_tcp, OID_AUTO, cc, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
diff --git a/sys/netinet/in_fib_algo.c b/sys/netinet/in_fib_algo.c
--- a/sys/netinet/in_fib_algo.c
+++ b/sys/netinet/in_fib_algo.c
@@ -775,4 +775,4 @@
fib_module_register(&flm_radix4_lockless);
fib_module_register(&flm_radix4);
}
-SYSINIT(fib4_algo_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, fib4_algo_init, NULL);
+SYSINIT(fib4_algo_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, fib4_algo_init);
diff --git a/sys/netinet/sctp_syscalls.c b/sys/netinet/sctp_syscalls.c
--- a/sys/netinet/sctp_syscalls.c
+++ b/sys/netinet/sctp_syscalls.c
@@ -116,7 +116,7 @@
}
#ifdef SCTP
-SYSINIT(sctp_syscalls, SI_SUB_SYSCALLS, SI_ORDER_ANY, sctp_syscalls_init, NULL);
+SYSINIT(sctp_syscalls, SI_SUB_SYSCALLS, SI_ORDER_ANY, sctp_syscalls_init);
#endif
int
diff --git a/sys/netinet6/in6_fib_algo.c b/sys/netinet6/in6_fib_algo.c
--- a/sys/netinet6/in6_fib_algo.c
+++ b/sys/netinet6/in6_fib_algo.c
@@ -358,4 +358,4 @@
fib_module_register(&flm_radix6_lockless);
fib_module_register(&flm_radix6);
}
-SYSINIT(fib6_algo_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, fib6_algo_init, NULL);
+SYSINIT(fib6_algo_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, fib6_algo_init);
diff --git a/sys/netipsec/xform_ipcomp.c b/sys/netipsec/xform_ipcomp.c
--- a/sys/netipsec/xform_ipcomp.c
+++ b/sys/netipsec/xform_ipcomp.c
@@ -776,7 +776,5 @@
xform_detach(&ipcomp_xformsw);
}
-SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE,
- ipcomp_attach, NULL);
-SYSUNINIT(ipcomp_xform_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE,
- ipcomp_detach, NULL);
+SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_attach);
+SYSUNINIT(ipcomp_xform_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_detach);
diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c
--- a/sys/netpfil/ipfw/ip_fw2.c
+++ b/sys/netpfil/ipfw/ip_fw2.c
@@ -3685,8 +3685,7 @@
* Starting up. Done in order after ipfwmod() has been called.
* VNET_SYSINIT is also called for each existing vnet and each new vnet.
*/
-SYSINIT(ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER,
- ipfw_init, NULL);
+SYSINIT(ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER, ipfw_init);
VNET_SYSINIT(vnet_ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER,
vnet_ipfw_init, NULL);
@@ -3697,7 +3696,7 @@
* or when the module is unloaded.
*/
SYSUNINIT(ipfw_destroy, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER,
- ipfw_destroy, NULL);
+ ipfw_destroy);
VNET_SYSUNINIT(vnet_ipfw_uninit, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER,
vnet_ipfw_uninit, NULL);
/* end of file */
diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c
--- a/sys/netpfil/ipfw/ip_fw_nat.c
+++ b/sys/netpfil/ipfw/ip_fw_nat.c
@@ -1237,12 +1237,12 @@
MODULE_VERSION(ipfw_nat, 1);
SYSINIT(ipfw_nat_init, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_MODULE_ORDER,
- ipfw_nat_init, NULL);
+ ipfw_nat_init);
VNET_SYSINIT(vnet_ipfw_nat_init, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_VNET_ORDER,
vnet_ipfw_nat_init, NULL);
SYSUNINIT(ipfw_nat_destroy, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_MODULE_ORDER,
- ipfw_nat_destroy, NULL);
+ ipfw_nat_destroy);
VNET_SYSUNINIT(vnet_ipfw_nat_uninit, IPFW_NAT_SI_SUB_FIREWALL,
IPFW_NAT_VNET_ORDER, vnet_ipfw_nat_uninit, NULL);
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -6857,7 +6857,7 @@
pf_unload_vnet();
}
-SYSUNINIT(pf_unload, SI_SUB_PROTO_FIREWALL, SI_ORDER_SECOND, pf_unload, NULL);
+SYSUNINIT(pf_unload, SI_SUB_PROTO_FIREWALL, SI_ORDER_SECOND, pf_unload);
VNET_SYSUNINIT(vnet_pf_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD,
vnet_pf_uninit, NULL);
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -1848,4 +1848,4 @@
return error;
}
-SYSINIT(bootp_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, bootpc_init, NULL);
+SYSINIT(bootp_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, bootpc_init);
diff --git a/sys/nfs/nfs_diskless.c b/sys/nfs/nfs_diskless.c
--- a/sys/nfs/nfs_diskless.c
+++ b/sys/nfs/nfs_diskless.c
@@ -445,5 +445,5 @@
rootdevnames[0] = "nfs:";
}
-SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, nfs_rootconf, NULL);
+SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, nfs_rootconf);
#endif
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -1301,7 +1301,7 @@
}
}
-SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, moea64_pmap_init_qpages, NULL);
+SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, moea64_pmap_init_qpages);
/*
* Activate a user pmap. This mostly involves setting some non-CPU
diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c
--- a/sys/powerpc/powerpc/elf32_machdep.c
+++ b/sys/powerpc/powerpc/elf32_machdep.c
@@ -161,7 +161,7 @@
};
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&freebsd_brand_info);
static Elf32_Brandinfo freebsd_brand_oinfo = {
@@ -177,7 +177,7 @@
};
SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY,
- (sysinit_cfunc_t) elf32_insert_brand_entry,
+ elf32_insert_brand_entry,
&freebsd_brand_oinfo);
void elf_reloc_self(Elf_Dyn *dynp, Elf_Addr relocbase);
diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c
--- a/sys/riscv/riscv/elf_machdep.c
+++ b/sys/riscv/riscv/elf_machdep.c
@@ -129,7 +129,7 @@
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
};
SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
- (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info);
+ elf64_insert_brand_entry, &freebsd_brand_info);
static void
elf64_register_sysvec(void *arg)
diff --git a/sys/security/audit/audit.c b/sys/security/audit/audit.c
--- a/sys/security/audit/audit.c
+++ b/sys/security/audit/audit.c
@@ -386,7 +386,7 @@
audit_worker_init();
}
-SYSINIT(audit_init, SI_SUB_AUDIT, SI_ORDER_FIRST, audit_init, NULL);
+SYSINIT(audit_init, SI_SUB_AUDIT, SI_ORDER_FIRST, audit_init);
/*
* Drain the audit queue and close the log at shutdown. Note that this can
diff --git a/sys/security/audit/audit_dtrace.c b/sys/security/audit/audit_dtrace.c
--- a/sys/security/audit/audit_dtrace.c
+++ b/sys/security/audit/audit_dtrace.c
@@ -528,7 +528,7 @@
SYSINIT(dtaudit_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, dtaudit_load,
NULL);
SYSUNINIT(dtaudit_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY,
- dtaudit_unload, NULL);
+ dtaudit_unload);
DEV_MODULE(dtaudit, dtaudit_modevent, NULL);
MODULE_VERSION(dtaudit, 1);
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c
--- a/sys/security/mac/mac_framework.c
+++ b/sys/security/mac/mac_framework.c
@@ -738,5 +738,5 @@
return (0);
}
-SYSINIT(mac, SI_SUB_MAC, SI_ORDER_FIRST, mac_init, NULL);
-SYSINIT(mac_late, SI_SUB_MAC_LATE, SI_ORDER_FIRST, mac_late_init, NULL);
+SYSINIT(mac, SI_SUB_MAC, SI_ORDER_FIRST, mac_init);
+SYSINIT(mac_late, SI_SUB_MAC_LATE, SI_ORDER_FIRST, mac_late_init);
diff --git a/sys/security/mac_veriexec/veriexec_fingerprint.c b/sys/security/mac_veriexec/veriexec_fingerprint.c
--- a/sys/security/mac_veriexec/veriexec_fingerprint.c
+++ b/sys/security/mac_veriexec/veriexec_fingerprint.c
@@ -464,4 +464,4 @@
}
SYSINIT(mac_veriexec_late, SI_SUB_MAC_LATE, SI_ORDER_ANY,
- mac_veriexec_late_init, NULL);
+ mac_veriexec_late_init);
diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h
--- a/sys/sys/kernel.h
+++ b/sys/sys/kernel.h
@@ -226,75 +226,66 @@
};
/*
- * Default: no special processing
- *
- * The C_ version of SYSINIT is for data pointers to const
- * data ( and functions taking data pointers to const data ).
- * At the moment it is no different from SYSINIT and thus
- * still results in warnings.
- *
- * The casts are necessary to have the compiler produce the
- * correct warnings when -Wcast-qual is used.
- *
+ * All macros prefixed by double underscore are internal to the
+ * sysinit implementation and should not be used outside the scope of
+ * the implementation and may be subject to change!
*/
+
#ifdef TSLOG
-struct sysinit_tslog {
- sysinit_cfunc_t func;
- const void * data;
- const char * name;
-};
-static inline void
-sysinit_tslog_shim(const void * data)
-{
- const struct sysinit_tslog * x = data;
-
- TSRAW(curthread, TS_ENTER, "SYSINIT", x->name);
- (x->func)(x->data);
- TSRAW(curthread, TS_EXIT, "SYSINIT", x->name);
-}
-#define C_SYSINIT(uniquifier, subsystem, order, func, ident) \
- static struct sysinit_tslog uniquifier ## _sys_init_tslog = { \
- func, \
- (ident), \
- #uniquifier \
- }; \
- static struct sysinit uniquifier ## _sys_init = { \
- subsystem, \
- order, \
- sysinit_tslog_shim, \
- &uniquifier ## _sys_init_tslog \
- }; \
- DATA_WSET(sysinit_set,uniquifier ## _sys_init)
+#define __SI_FUNCTION_PRE(type, name) \
+ TSRAW(curthread, TS_ENTER, #type, #name)
+#define __SI_FUNCTION_POST(type, name) \
+ TSRAW(curthread, TS_EXIT, #type, #name)
#else
-#define C_SYSINIT(uniquifier, subsystem, order, func, ident) \
- static struct sysinit uniquifier ## _sys_init = { \
- subsystem, \
- order, \
- func, \
- (ident) \
- }; \
- DATA_WSET(sysinit_set,uniquifier ## _sys_init)
+#define __SI_FUNCTION_PRE(type, name) \
+ do { } while (0)
+#define __SI_FUNCTION_POST(type, name) \
+ do { } while (0)
#endif
-#define SYSINIT(uniquifier, subsystem, order, func, ident) \
- C_SYSINIT(uniquifier, subsystem, order, \
- (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident))
+/*
+ * Explanation of arguments for the __SI_REGISTER() macro:
+ *
+ * @param uniq An identifier for the needed functions and structures.
+ * @param type sysinit_set or sysuninit_set, depending on use case.
+ * @param _sub SI_SUB_XXX enum.
+ * @param _order SI_ORDER_XXX enum.
+ * @param _func Pointer to callback function.
+ * @param ... Arguments for callback function, if any.
+ *
+ * This macro create two functions. The first function calls the given
+ * function and passes the given argument, also called shim function.
+ * The second function is the actual constructor function. This way
+ * pointer casting between types is avoided entirely.
+ */
+#define __SI_REGISTER(uniq, type, _sub, _order, _func, ...) \
+static void \
+type##_##uniq##_shim(const void *arg __unused) \
+{ \
+ __SI_FUNCTION_PRE(type, _func); \
+ (_func)(__VA_ARGS__); \
+ __SI_FUNCTION_POST(type, _func); \
+} \
+static struct sysinit type##_##uniq = { \
+ .subsystem = _sub, \
+ .order = _order, \
+ .func = &type##_##uniq##_shim, \
+ .udata = NULL, \
+}; \
+DATA_WSET(type, type##_##uniq); \
+struct __hack
/*
- * Called on module unload: no special processing
+ * Sysinit API macro, called on kernel or module load:
*/
-#define C_SYSUNINIT(uniquifier, subsystem, order, func, ident) \
- static struct sysinit uniquifier ## _sys_uninit = { \
- subsystem, \
- order, \
- func, \
- (ident) \
- }; \
- DATA_WSET(sysuninit_set,uniquifier ## _sys_uninit)
+#define SYSINIT(uniq, sub, order, ...) \
+ __SI_REGISTER(uniq, sysinit_set, sub, order, __VA_ARGS__)
-#define SYSUNINIT(uniquifier, subsystem, order, func, ident) \
- C_SYSUNINIT(uniquifier, subsystem, order, \
- (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident))
+/*
+ * Sysuninit API macros, called on module unload:
+ */
+#define SYSUNINIT(uniq, sub, order, ...) \
+ __SI_REGISTER(uniq, sysuinit_set, sub, order, __VA_ARGS__)
void sysinit_add(struct sysinit **set, struct sysinit **set_end);
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -336,9 +336,8 @@
void exec_free_abi_mappings(struct proc *p);
void exec_onexec_old(struct thread *td);
-#define INIT_SYSENTVEC(name, sv) \
- SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, \
- (sysinit_cfunc_t)exec_sysvec_init, sv);
+#define INIT_SYSENTVEC(name, sv) \
+ SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY, exec_sysvec_init, sv)
#endif /* _KERNEL */
diff --git a/sys/vm/memguard.c b/sys/vm/memguard.c
--- a/sys/vm/memguard.c
+++ b/sys/vm/memguard.c
@@ -240,7 +240,7 @@
CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_ULONG, NULL, 0, memguard_sysctl_mapused, "LU",
"MemGuard KVA used");
}
-SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_ANY, memguard_sysinit, NULL);
+SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_ANY, memguard_sysinit);
/*
* v2sizep() converts a virtual address of the first page allocated for
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -106,7 +106,7 @@
COUNTER_ARRAY_ALLOC(cnt, VM_METER_NCOUNTERS, M_WAITOK);
}
-SYSINIT(counter, SI_SUB_KMEM, SI_ORDER_FIRST, vmcounter_startup, NULL);
+SYSINIT(counter, SI_SUB_KMEM, SI_ORDER_FIRST, vmcounter_startup);
SYSCTL_UINT(_vm, VM_V_FREE_MIN, v_free_min,
CTLFLAG_RW, &vm_cnt.v_free_min, 0, "Minimum low-free-pages threshold");
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -128,8 +128,7 @@
static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage,
int starting_page_shortage);
-SYSINIT(pagedaemon_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_FIRST, vm_pageout_init,
- NULL);
+SYSINIT(pagedaemon_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_FIRST, vm_pageout_init);
struct proc *pageproc;
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -745,7 +745,7 @@
*/
}
}
-SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc, NULL);
+SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc);
static void
tsc_update_freq(uint64_t new_freq)
diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -477,7 +477,7 @@
else
DPCPU_SET(vcpu_info, vcpu_info);
}
-SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init, NULL);
+SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init);
bool
xen_has_iommu_maps(void)
diff --git a/sys/x86/xen/xen_apic.c b/sys/x86/xen/xen_apic.c
--- a/sys/x86/xen/xen_apic.c
+++ b/sys/x86/xen/xen_apic.c
@@ -364,4 +364,4 @@
}
/* Switch to using PV IPIs as soon as the vcpu_id is set. */
-SYSINIT(xen_setup_cpus, SI_SUB_SMP, SI_ORDER_SECOND, xen_setup_cpus, NULL);
+SYSINIT(xen_setup_cpus, SI_SUB_SMP, SI_ORDER_SECOND, xen_setup_cpus);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 2:57 PM (17 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14644163
Default Alt Text
D40450.diff (45 KB)
Attached To
Mode
D40450: kernel: Change SYSINITs and SYSUNINITs to pass callback arguments AS-IS
Attached
Detach File
Event Timeline
Log In to Comment