diff --git a/examples/ioat/perf/perf.c b/examples/ioat/perf/perf.c index 36cf528bf7..d5d47f58d7 100644 --- a/examples/ioat/perf/perf.c +++ b/examples/ioat/perf/perf.c @@ -176,8 +176,8 @@ ioat_init(void) pci_dev->vendor_id, pci_dev->device_id, pci_device_get_device_name(pci_dev)); - if (pci_device_has_non_null_driver(pci_dev)) { - printf("Device has kernel driver, skipping...\n"); + if (pci_device_has_non_uio_driver(pci_dev)) { + printf("Device has non-uio kernel driver, skipping...\n"); continue; } diff --git a/examples/ioat/verify/verify.c b/examples/ioat/verify/verify.c index a8e82643f2..de536265a6 100644 --- a/examples/ioat/verify/verify.c +++ b/examples/ioat/verify/verify.c @@ -191,8 +191,8 @@ ioat_init(void) pci_dev->vendor_id, pci_dev->device_id, pci_device_get_device_name(pci_dev)); - if (pci_device_has_non_null_driver(pci_dev)) { - printf("Device has kernel driver, skipping...\n"); + if (pci_device_has_non_uio_driver(pci_dev)) { + printf("Device has non-uio kernel driver, skipping...\n"); continue; } diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 7979516441..857a5e5573 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -584,8 +584,8 @@ int main(int argc, char **argv) while ((pci_dev = pci_device_next(pci_dev_iter))) { struct nvme_controller *ctrlr; - if (pci_device_has_non_null_driver(pci_dev)) { - fprintf(stderr, "non-null kernel driver attached to nvme\n"); + if (pci_device_has_non_uio_driver(pci_dev)) { + fprintf(stderr, "non-uio kernel driver attached to nvme\n"); fprintf(stderr, " controller at pci bdf %d:%d:%d\n", pci_dev->bus, pci_dev->dev, pci_dev->func); fprintf(stderr, " skipping...\n"); diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 66767d8343..c4f77fdceb 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -705,8 +705,8 @@ register_controllers(void) while ((pci_dev = pci_device_next(pci_dev_iter))) { struct nvme_controller *ctrlr; - if (pci_device_has_non_null_driver(pci_dev)) { - fprintf(stderr, "non-null kernel driver attached to nvme\n"); + if (pci_device_has_non_uio_driver(pci_dev)) { + fprintf(stderr, "non-uio kernel driver attached to nvme\n"); fprintf(stderr, " controller at pci bdf %d:%d:%d\n", pci_dev->bus, pci_dev->dev, pci_dev->func); fprintf(stderr, " skipping...\n"); diff --git a/include/spdk/pci.h b/include/spdk/pci.h index 1f086bfb26..cd1640b79b 100644 --- a/include/spdk/pci.h +++ b/include/spdk/pci.h @@ -39,8 +39,7 @@ #define PCI_UIO_DRIVER "uio_pci_generic" int pci_device_get_serial_number(struct pci_device *dev, char *sn, int len); -int pci_device_has_uio_driver(struct pci_device *dev); -int pci_device_has_non_null_driver(struct pci_device *dev); +int pci_device_has_non_uio_driver(struct pci_device *dev); int pci_device_unbind_kernel_driver(struct pci_device *dev); int pci_device_bind_uio_driver(struct pci_device *dev, char *driver_name); int pci_device_switch_to_uio_driver(struct pci_device *pci_dev); diff --git a/lib/util/pci.c b/lib/util/pci.c index 8423e3cdf2..12c5989cff 100644 --- a/lib/util/pci.c +++ b/lib/util/pci.c @@ -95,7 +95,8 @@ pci_device_get_serial_number(struct pci_device *dev, char *sn, int len) return -1; } -int +#ifdef __linux__ +static int pci_device_has_uio_driver(struct pci_device *dev) { struct dirent *e; @@ -129,10 +130,11 @@ pci_device_has_uio_driver(struct pci_device *dev) return 1; } +#endif #ifdef __FreeBSD__ int -pci_device_has_non_null_driver(struct pci_device *dev) +pci_device_has_non_uio_driver(struct pci_device *dev) { struct pci_conf_io configsel; struct pci_match_conf pattern; @@ -183,7 +185,7 @@ pci_device_has_non_null_driver(struct pci_device *dev) } #else int -pci_device_has_non_null_driver(struct pci_device *dev) +pci_device_has_non_uio_driver(struct pci_device *dev) { return pci_device_has_kernel_driver(dev) && !pci_device_has_uio_driver(dev); } diff --git a/test/lib/nvme/aer/aer.c b/test/lib/nvme/aer/aer.c index 2daa7fda77..04e182f1a6 100644 --- a/test/lib/nvme/aer/aer.c +++ b/test/lib/nvme/aer/aer.c @@ -242,8 +242,8 @@ int main(int argc, char **argv) while ((pci_dev = pci_device_next(pci_dev_iter))) { struct dev *dev; - if (pci_device_has_non_null_driver(pci_dev)) { - fprintf(stderr, "non-null kernel driver attached to nvme\n"); + if (pci_device_has_non_uio_driver(pci_dev)) { + fprintf(stderr, "non-uio kernel driver attached to nvme\n"); fprintf(stderr, " controller at pci bdf %d:%d:%d\n", pci_dev->bus, pci_dev->dev, pci_dev->func); fprintf(stderr, " skipping...\n"); diff --git a/test/lib/nvme/reset/reset.c b/test/lib/nvme/reset/reset.c index 337f41492e..46a030d048 100644 --- a/test/lib/nvme/reset/reset.c +++ b/test/lib/nvme/reset/reset.c @@ -528,8 +528,8 @@ register_controllers(void) while ((pci_dev = pci_device_next(pci_dev_iter))) { struct nvme_controller *ctrlr; - if (pci_device_has_non_null_driver(pci_dev)) { - fprintf(stderr, "non-null kernel driver attached to nvme\n"); + if (pci_device_has_non_uio_driver(pci_dev)) { + fprintf(stderr, "non-uio kernel driver attached to nvme\n"); fprintf(stderr, " controller at pci bdf %d:%d:%d\n", pci_dev->bus, pci_dev->dev, pci_dev->func); fprintf(stderr, " skipping...\n");