struct pci_access * pci_alloc(void) { struct pci_access *a = malloc(sizeof(struct pci_access)); int i; bzero(a, sizeof(*a)); pci_set_name_list_path(a, PCI_PATH_IDS_DIR "/" PCI_IDS, 0); for(i=0; i<PCI_ACCESS_MAX; i++) if (pci_methods[i] && pci_methods[i]->config) pci_methods[i]->config(a); return a; }
void pci_cleanup(struct pci_access *a) { struct pci_dev *d, *e; for(d=a->devices; d; d=e) { e = d->next; pci_free_dev(d); } if (a->methods) a->methods->cleanup(a); pci_free_name_list(a); pci_set_name_list_path(a, NULL, 0); pci_mfree(a); }
struct pci_access * pci_alloc(void) { struct pci_access *a = malloc(sizeof(struct pci_access)); int i; memset(a, 0, sizeof(*a)); pci_set_name_list_path(a, PCI_PATH_IDS_DIR "/" PCI_IDS, 0); #ifdef PCI_USE_DNS pci_define_param(a, "net.domain", PCI_ID_DOMAIN, "DNS domain used for resolving of ID's"); pci_define_param(a, "net.cache_name", "~/.pciids-cache", "Name of the ID cache file"); a->id_lookup_mode = PCI_LOOKUP_CACHE; #endif for (i=0; i<PCI_ACCESS_MAX; i++) if (pci_methods[i] && pci_methods[i]->config) pci_methods[i]->config(a); return a; }