Lines Matching defs:mdp
69 static void moduledir_readhints(struct moduledir *mdp);
1128 struct moduledir *mdp;
1149 STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
1150 result = file_lookup(mdp->d_path, name, namelen, extlist);
1161 mod_search_hints(struct moduledir *mdp, const char *modname,
1168 moduledir_readhints(mdp);
1173 if (mdp->d_hints == NULL)
1175 recptr = mdp->d_hints;
1176 bufend = recptr + mdp->d_hintsz;
1190 INT_ALIGN(mdp->d_hints, cp);
1215 result = file_lookup(mdp->d_path, (const char *)cp, clen, NULL);
1217 result = file_lookup(mdp->d_path, (const char *)best, blen, NULL);
1224 result = file_lookup(mdp->d_path, modname, modnamelen, kld_ext_list);
1331 devmatch_search_hints(struct moduledir *mdp, const char *bus, const char *dev, const char *pnpinfo)
1338 moduledir_readhints(mdp);
1340 if (mdp->d_hints == NULL)
1342 walker = mdp->d_hints;
1343 hints_end = walker + mdp->d_hintsz;
1512 struct moduledir *mdp;
1520 STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
1521 result = mod_search_hints(mdp, name, verinfo);
1532 struct moduledir *mdp;
1540 STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
1541 result = devmatch_search_hints(mdp, bus, NULL, pnpinfo);
1681 moduledir_fullpath(struct moduledir *mdp, const char *fname)
1685 cp = malloc(strlen(mdp->d_path) + strlen(fname) + 2);
1688 strcpy(cp, mdp->d_path);
1698 moduledir_readhints(struct moduledir *mdp)
1704 if (mdp->d_hints != NULL || (mdp->d_flags & MDIR_NOHINTS))
1706 path = moduledir_fullpath(mdp, "linker.hints");
1711 mdp->d_flags |= MDIR_NOHINTS;
1719 mdp->d_hints = malloc(size);
1720 if (mdp->d_hints == NULL)
1722 if (read(fd, mdp->d_hints, size) != size)
1724 mdp->d_hintsz = size;
1729 free(mdp->d_hints);
1730 mdp->d_hints = NULL;
1731 mdp->d_flags |= MDIR_NOHINTS;
1741 struct moduledir *mdp, *mtmp;
1751 STAILQ_FOREACH(mdp, &moduledir_list, d_link)
1752 mdp->d_flags |= MDIR_REMOVED;
1763 STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
1764 if (strlen(mdp->d_path) != cplen || bcmp(cp, mdp->d_path, cplen) != 0)
1766 mdp->d_flags &= ~MDIR_REMOVED;
1769 if (mdp == NULL) {
1770 mdp = malloc(sizeof(*mdp) + cplen + 1);
1771 if (mdp == NULL)
1773 mdp->d_path = (char*)(mdp + 1);
1774 bcopy(cp, mdp->d_path, cplen);
1775 mdp->d_path[cplen] = 0;
1776 mdp->d_hints = NULL;
1777 mdp->d_flags = 0;
1778 STAILQ_INSERT_TAIL(&moduledir_list, mdp, d_link);
1786 mdp = STAILQ_FIRST(&moduledir_list);
1787 while (mdp) {
1788 if ((mdp->d_flags & MDIR_REMOVED) == 0) {
1789 mdp = STAILQ_NEXT(mdp, d_link);
1791 free(mdp->d_hints);
1792 mtmp = mdp;
1793 mdp = STAILQ_NEXT(mdp, d_link);