Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/common/module.c
Show First 20 Lines • Show All 763 Lines • ▼ Show 20 Lines | goto bad; | ||||
recptr = mdp->d_hints; | recptr = mdp->d_hints; | ||||
bufend = recptr + mdp->d_hintsz; | bufend = recptr + mdp->d_hintsz; | ||||
clen = blen = 0; | clen = blen = 0; | ||||
best = cp = NULL; | best = cp = NULL; | ||||
while (recptr < bufend && !found) { | while (recptr < bufend && !found) { | ||||
intp = (int*)recptr; | intp = (int*)recptr; | ||||
reclen = *intp++; | reclen = *intp++; | ||||
ival = *intp++; | ival = *intp++; | ||||
cp = (char*)intp; | cp = (u_char*)intp; | ||||
switch (ival) { | switch (ival) { | ||||
case MDT_VERSION: | case MDT_VERSION: | ||||
clen = *cp++; | clen = *cp++; | ||||
if (clen != modnamelen || bcmp(cp, modname, clen) != 0) | if (clen != modnamelen || bcmp(cp, modname, clen) != 0) | ||||
break; | break; | ||||
cp += clen; | cp += clen; | ||||
INT_ALIGN(mdp->d_hints, cp); | INT_ALIGN(mdp->d_hints, cp); | ||||
ival = *(int*)cp; | ival = *(int*)cp; | ||||
Show All 15 Lines | default: | ||||
break; | break; | ||||
} | } | ||||
recptr += reclen + sizeof(int); | recptr += reclen + sizeof(int); | ||||
} | } | ||||
/* | /* | ||||
* Finally check if KLD is in the place | * Finally check if KLD is in the place | ||||
*/ | */ | ||||
if (found) | if (found) | ||||
result = file_lookup(mdp->d_path, cp, clen, NULL); | result = file_lookup(mdp->d_path, (const char *)cp, clen, NULL); | ||||
else if (best) | else if (best) | ||||
result = file_lookup(mdp->d_path, best, blen, NULL); | result = file_lookup(mdp->d_path, (const char *)best, blen, NULL); | ||||
bad: | bad: | ||||
/* | /* | ||||
* If nothing found or hints is absent - fallback to the old way | * If nothing found or hints is absent - fallback to the old way | ||||
* by using "kldname[.ko]" as module name. | * by using "kldname[.ko]" as module name. | ||||
*/ | */ | ||||
if (!found && !bestver && result == NULL) | if (!found && !bestver && result == NULL) | ||||
result = file_lookup(mdp->d_path, modname, modnamelen, kld_ext_list); | result = file_lookup(mdp->d_path, modname, modnamelen, kld_ext_list); | ||||
return result; | return result; | ||||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |