MCPcopy Create free account
hub / github.com/F-Stack/f-stack / preload_search_by_name

Function preload_search_by_name

freebsd/kern/subr_module.c:55–81  ·  view source on GitHub ↗

* Search for the preloaded module (name) */

Source from the content-addressed store, hash-verified

53 * Search for the preloaded module (name)
54 */
55caddr_t
56preload_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)

Callers 2

link_elf_link_preloadFunction · 0.85
link_elf_link_preloadFunction · 0.85

Calls 1

strcmpFunction · 0.85

Tested by

no test coverage detected