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

Function cdx_scan

dpdk/drivers/bus/cdx/cdx.c:264–297  ·  view source on GitHub ↗

* Scan the content of the CDX bus, and the devices in the devices * list. */

Source from the content-addressed store, hash-verified

262 * list.
263 */
264static int
265cdx_scan(void)
266{
267 struct dirent *e;
268 DIR *dir;
269 char dirname[PATH_MAX];
270
271 dir = opendir(RTE_CDX_BUS_DEVICES_PATH);
272 if (dir == NULL) {
273 CDX_BUS_INFO("%s(): opendir failed: %s", __func__,
274 strerror(errno));
275 return 0;
276 }
277
278 while ((e = readdir(dir)) != NULL) {
279 if (e->d_name[0] == '.')
280 continue;
281
282 if (cdx_ignore_device(e->d_name))
283 continue;
284
285 snprintf(dirname, sizeof(dirname), "%s/%s",
286 RTE_CDX_BUS_DEVICES_PATH, e->d_name);
287
288 if (cdx_scan_one(dirname, e->d_name) < 0)
289 goto error;
290 }
291 closedir(dir);
292 return 0;
293
294error:
295 closedir(dir);
296 return -1;
297}
298
299/* map a particular resource from a file */
300void *

Callers

nothing calls this directly

Calls 6

opendirFunction · 0.85
readdirFunction · 0.85
cdx_ignore_deviceFunction · 0.85
snprintfFunction · 0.85
cdx_scan_oneFunction · 0.85
closedirFunction · 0.85

Tested by

no test coverage detected