* Search for the preloaded module (name) */
| 53 | * Search for the preloaded module (name) |
| 54 | */ |
| 55 | caddr_t |
| 56 | preload_search_by_name(const char *name) |
| 57 | { |
| 58 | caddr_t curp; |
| 59 | uint32_t *hdr; |
| 60 | int next; |
| 61 | |
| 62 | if (preload_metadata != NULL) { |
| 63 | curp = preload_metadata; |
| 64 | for (;;) { |
| 65 | hdr = (uint32_t *)curp; |
| 66 | if (hdr[0] == 0 && hdr[1] == 0) |
| 67 | break; |
| 68 | |
| 69 | /* Search for a MODINFO_NAME field */ |
| 70 | if ((hdr[0] == MODINFO_NAME) && |
| 71 | !strcmp(name, curp + sizeof(uint32_t) * 2)) |
| 72 | return(curp); |
| 73 | |
| 74 | /* skip to next field */ |
| 75 | next = sizeof(uint32_t) * 2 + hdr[1]; |
| 76 | next = roundup(next, sizeof(u_long)); |
| 77 | curp += next; |
| 78 | } |
| 79 | } |
| 80 | return(NULL); |
| 81 | } |
| 82 | |
| 83 | /* |
| 84 | * Search for the first preloaded module of (type) |
no test coverage detected