| 1491 | } |
| 1492 | |
| 1493 | static void |
| 1494 | linker_preload(void *arg) |
| 1495 | { |
| 1496 | caddr_t modptr; |
| 1497 | const char *modname, *nmodname; |
| 1498 | char *modtype; |
| 1499 | linker_file_t lf, nlf; |
| 1500 | linker_class_t lc; |
| 1501 | int error; |
| 1502 | linker_file_list_t loaded_files; |
| 1503 | linker_file_list_t depended_files; |
| 1504 | struct mod_metadata *mp, *nmp; |
| 1505 | struct mod_metadata **start, **stop, **mdp, **nmdp; |
| 1506 | const struct mod_depend *verinfo; |
| 1507 | int nver; |
| 1508 | int resolves; |
| 1509 | modlist_t mod; |
| 1510 | struct sysinit **si_start, **si_stop; |
| 1511 | |
| 1512 | TAILQ_INIT(&loaded_files); |
| 1513 | TAILQ_INIT(&depended_files); |
| 1514 | TAILQ_INIT(&found_modules); |
| 1515 | error = 0; |
| 1516 | |
| 1517 | modptr = NULL; |
| 1518 | sx_xlock(&kld_sx); |
| 1519 | while ((modptr = preload_search_next_name(modptr)) != NULL) { |
| 1520 | modname = (char *)preload_search_info(modptr, MODINFO_NAME); |
| 1521 | modtype = (char *)preload_search_info(modptr, MODINFO_TYPE); |
| 1522 | if (modname == NULL) { |
| 1523 | printf("Preloaded module at %p does not have a" |
| 1524 | " name!\n", modptr); |
| 1525 | continue; |
| 1526 | } |
| 1527 | if (modtype == NULL) { |
| 1528 | printf("Preloaded module at %p does not have a type!\n", |
| 1529 | modptr); |
| 1530 | continue; |
| 1531 | } |
| 1532 | if (bootverbose) |
| 1533 | printf("Preloaded %s \"%s\" at %p.\n", modtype, modname, |
| 1534 | modptr); |
| 1535 | lf = NULL; |
| 1536 | TAILQ_FOREACH(lc, &classes, link) { |
| 1537 | error = LINKER_LINK_PRELOAD(lc, modname, &lf); |
| 1538 | if (!error) |
| 1539 | break; |
| 1540 | lf = NULL; |
| 1541 | } |
| 1542 | if (lf) |
| 1543 | TAILQ_INSERT_TAIL(&loaded_files, lf, loaded); |
| 1544 | } |
| 1545 | |
| 1546 | /* |
| 1547 | * First get a list of stuff in the kernel. |
| 1548 | */ |
| 1549 | if (linker_file_lookup_set(linker_kernel_file, MDT_SETNAME, &start, |
| 1550 | &stop, NULL) == 0) |
nothing calls this directly
no test coverage detected