irq_parse.c 572 B

12345678910111213141516171819202122232425262728293031323334
  1. /* irq_parse.c
  2. * Parse IRQ-related files.
  3. */
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <sys/types.h>
  8. #include <dirent.h>
  9. #include <limits.h>
  10. #include "lub/list.h"
  11. #include "irq.h"
  12. int irqs_populate(lub_list_t *irqs)
  13. {
  14. DIR *dir;
  15. struct dirent *dent;
  16. char path[PATH_MAX];
  17. /* Now we can parse PCI devices only */
  18. dir = opendir(SYSFS_PCI_PATH);
  19. if (!dir)
  20. return -1;
  21. while((dent = readdir(dir))) {
  22. if (!strcmp(dent->d_name, ".") ||
  23. !strcmp(dent->d_name, ".."))
  24. continue;
  25. printf("entry: %s\n", dent->d_name);
  26. }
  27. return 0;
  28. }