* Scan the content of the CDX bus, and the devices in the devices * list. */
| 262 | * list. |
| 263 | */ |
| 264 | static int |
| 265 | cdx_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 | |
| 294 | error: |
| 295 | closedir(dir); |
| 296 | return -1; |
| 297 | } |
| 298 | |
| 299 | /* map a particular resource from a file */ |
| 300 | void * |
nothing calls this directly
no test coverage detected