Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/pci/pci_user.c
Show First 20 Lines • Show All 702 Lines • ▼ Show 20 Lines | #endif /* PRE7_COMPAT */ | ||||
error = EINVAL; | error = EINVAL; | ||||
goto getconfexit; | goto getconfexit; | ||||
} | } | ||||
/* | /* | ||||
* Go through the list of devices and copy out the devices | * Go through the list of devices and copy out the devices | ||||
* that match the user's criteria. | * that match the user's criteria. | ||||
*/ | */ | ||||
for (cio->num_matches = 0, error = 0, i = 0, | for (cio->num_matches = 0, i = 0, | ||||
dinfo = STAILQ_FIRST(devlist_head); | dinfo = STAILQ_FIRST(devlist_head); | ||||
(dinfo != NULL) && (cio->num_matches < ionum) && | dinfo != NULL; | ||||
(error == 0) && (i < pci_numdevs); | |||||
dinfo = STAILQ_NEXT(dinfo, pci_links), i++) { | dinfo = STAILQ_NEXT(dinfo, pci_links), i++) { | ||||
if (i < cio->offset) | if (i < cio->offset) | ||||
continue; | continue; | ||||
/* Populate pd_name and pd_unit */ | /* Populate pd_name and pd_unit */ | ||||
name = NULL; | name = NULL; | ||||
if (dinfo->cfg.dev) | if (dinfo->cfg.dev) | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | #endif /* COMPAT_FREEBSD32 */ | ||||
sizeof(conf_old.pd_name)); | sizeof(conf_old.pd_name)); | ||||
conf_old.pd_name[PCI_MAXNAMELEN] = 0; | conf_old.pd_name[PCI_MAXNAMELEN] = 0; | ||||
conf_old.pd_unit = | conf_old.pd_unit = | ||||
dinfo->conf.pd_unit; | dinfo->conf.pd_unit; | ||||
confdata = &conf_old; | confdata = &conf_old; | ||||
} else | } else | ||||
#endif /* PRE7_COMPAT */ | #endif /* PRE7_COMPAT */ | ||||
confdata = &dinfo->conf; | confdata = &dinfo->conf; | ||||
/* Only if we can copy it out do we count it. */ | error = copyout(confdata, | ||||
if (!(error = copyout(confdata, | |||||
(caddr_t)cio->matches + | (caddr_t)cio->matches + | ||||
confsz * cio->num_matches, confsz))) | confsz * cio->num_matches, confsz); | ||||
if (error) | |||||
break; | |||||
cio->num_matches++; | cio->num_matches++; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Set the pointer into the list, so if the user is getting | * Set the pointer into the list, so if the user is getting | ||||
* n records at a time, where n < pci_numdevs, | * n records at a time, where n < pci_numdevs, | ||||
*/ | */ | ||||
cio->offset = i; | cio->offset = i; | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |