mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Export a routine, kobj_machdep_init(), that allows platforms
to use the kobj subsystem as soon at mutex_init() has been called instead of having to wait for the SI_SUB_LOCK sysinit. Reviewed by: dfr
This commit is contained in:
parent
db12d03ed9
commit
e000e00118
2 changed files with 16 additions and 2 deletions
|
|
@ -57,6 +57,7 @@ SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD,
|
|||
#endif
|
||||
|
||||
static struct mtx kobj_mtx;
|
||||
static int kobj_mutex_inited;
|
||||
static int kobj_next_id = 1;
|
||||
|
||||
SYSCTL_UINT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD,
|
||||
|
|
@ -65,12 +66,20 @@ SYSCTL_UINT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD,
|
|||
static void
|
||||
kobj_init_mutex(void *arg)
|
||||
{
|
||||
|
||||
mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF);
|
||||
if (!kobj_mutex_inited) {
|
||||
mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF);
|
||||
kobj_mutex_inited = 1;
|
||||
}
|
||||
}
|
||||
|
||||
SYSINIT(kobj, SI_SUB_LOCK, SI_ORDER_ANY, kobj_init_mutex, NULL);
|
||||
|
||||
void
|
||||
kobj_machdep_init(void)
|
||||
{
|
||||
kobj_init_mutex(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* This method structure is used to initialise new caches. Since the
|
||||
* desc pointer is NULL, it is guaranteed never to match any read
|
||||
|
|
|
|||
|
|
@ -246,4 +246,9 @@ kobj_method_t* kobj_lookup_method(kobj_class_t cls,
|
|||
*/
|
||||
int kobj_error_method(void);
|
||||
|
||||
/*
|
||||
* Machine-dependent initialisation call for boot-time kobj clients
|
||||
*/
|
||||
void kobj_machdep_init(void);
|
||||
|
||||
#endif /* !_SYS_KOBJ_H_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue