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

Function preload_search_info

freebsd/kern/subr_module.c:163–205  ·  view source on GitHub ↗

* Given a preloaded module handle (mod), return a pointer * to the data for the attribute (inf). */

Source from the content-addressed store, hash-verified

161 * to the data for the attribute (inf).
162 */
163caddr_t
164preload_search_info(caddr_t mod, int inf)
165{
166 caddr_t curp;
167 uint32_t *hdr;
168 uint32_t type = 0;
169 int next;
170
171 if (mod == NULL)
172 return (NULL);
173
174 curp = mod;
175 for (;;) {
176 hdr = (uint32_t *)curp;
177 /* end of module data? */
178 if (hdr[0] == 0 && hdr[1] == 0)
179 break;
180 /*
181 * We give up once we've looped back to what we were looking at
182 * first - this should normally be a MODINFO_NAME field.
183 */
184 if (type == 0) {
185 type = hdr[0];
186 } else {
187 if (hdr[0] == type)
188 break;
189 }
190
191 /*
192 * Attribute match? Return pointer to data.
193 * Consumer may safely assume that size value precedes
194 * data.
195 */
196 if (hdr[0] == inf)
197 return(curp + (sizeof(uint32_t) * 2));
198
199 /* skip to next field */
200 next = sizeof(uint32_t) * 2 + hdr[1];
201 next = roundup(next, sizeof(u_long));
202 curp += next;
203 }
204 return(NULL);
205}
206
207/*
208 * Delete a preload record by name.

Callers 15

getmemsizeFunction · 0.85
smap_sysctl_handlerFunction · 0.85
native_parse_memmapFunction · 0.85
hammer_timeFunction · 0.85
smap_sysctl_handlerFunction · 0.85
efi_map_sysctl_handlerFunction · 0.85
initarmFunction · 0.85
initarmFunction · 0.85
link_elf_link_preloadFunction · 0.85
preload_fetch_addrFunction · 0.85
preload_fetch_sizeFunction · 0.85
linker_preloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected