diff options
Diffstat (limited to 'samples')
-rw-r--r-- | samples/gpio-pci-idio-16.c | 6 | ||||
-rw-r--r-- | samples/null.c | 10 | ||||
-rw-r--r-- | samples/server.c | 6 |
3 files changed, 17 insertions, 5 deletions
diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index 17dfdaa..be8ecdb 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -99,7 +99,8 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to register signal handler"); } - vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[optind], 0, NULL); + vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[optind], 0, NULL, + VFU_DEV_TYPE_PCI); if (vfu_ctx == NULL) { if (errno == EINTR) { printf("interrupted\n"); @@ -113,7 +114,8 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to setup log"); } - ret = vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc, false); + ret = vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc, + VFU_PCI_TYPE_CONVENTIONAL, 0); if (ret < 0) { fprintf(stderr, "failed to setup pci header\n"); goto out; diff --git a/samples/null.c b/samples/null.c index 99e35cc..adf3a46 100644 --- a/samples/null.c +++ b/samples/null.c @@ -71,12 +71,17 @@ int main(int argc, char **argv) { int ret; pthread_t thread; + vfu_pci_hdr_id_t id = { 0 }; + vfu_pci_hdr_ss_t ss = { 0 }; + vfu_pci_hdr_cc_t cc = { { 0 } }; + if (argc != 2) { errx(EXIT_FAILURE, "missing vfio-user socket path"); } - vfu_ctx_t *vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[1], 0, NULL); + vfu_ctx_t *vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[1], 0, NULL, + VFU_DEV_TYPE_PCI); if (vfu_ctx == NULL) { err(EXIT_FAILURE, "failed to create libvfio-user context"); } @@ -86,6 +91,9 @@ int main(int argc, char **argv) err(EXIT_FAILURE, "failed to setup log"); } + ret = vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc, + VFU_PCI_TYPE_CONVENTIONAL, 0); + ret = pthread_create(&thread, NULL, null_drive, vfu_ctx); if (ret != 0) { errno = ret; diff --git a/samples/server.c b/samples/server.c index 571e374..ccfad1c 100644 --- a/samples/server.c +++ b/samples/server.c @@ -411,7 +411,8 @@ int main(int argc, char *argv[]) } server_data.vfu_ctx = vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[optind], - 0, &server_data); + 0, &server_data, + VFU_DEV_TYPE_PCI); if (vfu_ctx == NULL) { err(EXIT_FAILURE, "failed to initialize device emulation\n"); } @@ -421,7 +422,8 @@ int main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to setup log"); } - ret = vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc, false); + ret = vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc, + VFU_PCI_TYPE_CONVENTIONAL, 0); if (ret < 0) { err(EXIT_FAILURE, "failed to setup PCI header"); } |