Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_linker.c
Show First 20 Lines • Show All 2,073 Lines • ▼ Show 20 Lines | linker_load_module(const char *kldname, const char *modname, | ||||
sx_assert(&kld_sx, SA_XLOCKED); | sx_assert(&kld_sx, SA_XLOCKED); | ||||
if (modname == NULL) { | if (modname == NULL) { | ||||
/* | /* | ||||
* We have to load KLD | * We have to load KLD | ||||
*/ | */ | ||||
KASSERT(verinfo == NULL, ("linker_load_module: verinfo" | KASSERT(verinfo == NULL, ("linker_load_module: verinfo" | ||||
" is not NULL")); | " is not NULL")); | ||||
if (rootvnode == NULL) | /* check if root file system is not mounted */ | ||||
if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) | |||||
return (ENXIO); | return (ENXIO); | ||||
pathname = linker_search_kld(kldname); | pathname = linker_search_kld(kldname); | ||||
} else { | } else { | ||||
if (modlist_lookup2(modname, verinfo) != NULL) | if (modlist_lookup2(modname, verinfo) != NULL) | ||||
return (EEXIST); | return (EEXIST); | ||||
if (rootvnode == NULL) | /* check if root file system is not mounted */ | ||||
if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) | |||||
return (ENXIO); | return (ENXIO); | ||||
if (kldname != NULL) | if (kldname != NULL) | ||||
pathname = strdup(kldname, M_LINKER); | pathname = strdup(kldname, M_LINKER); | ||||
else | else | ||||
/* | /* | ||||
* Need to find a KLD with required module | * Need to find a KLD with required module | ||||
*/ | */ | ||||
pathname = linker_search_module(modname, | pathname = linker_search_module(modname, | ||||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |