aboutsummaryrefslogtreecommitdiff
path: root/samples/null.c
diff options
context:
space:
mode:
authorThanos <thanos.makatos@nutanix.com>2020-12-02 10:47:36 +0000
committerGitHub <noreply@github.com>2020-12-02 10:47:36 +0000
commit806284b29414e11f7fd5274ba608ba66bbedc49f (patch)
tree17f4905b8080dc075b10f2b5af7c163f22dadb00 /samples/null.c
parenta9cf39b0b32f89a50fda63bdafa2e61023916f3a (diff)
parentee1feabb520694633089f1811e8421f50e24c9dd (diff)
downloadlibvfio-user-806284b29414e11f7fd5274ba608ba66bbedc49f.zip
libvfio-user-806284b29414e11f7fd5274ba608ba66bbedc49f.tar.gz
libvfio-user-806284b29414e11f7fd5274ba608ba66bbedc49f.tar.bz2
Merge pull request #144 from tmakatos/issues/106
introduce device and PCI types
Diffstat (limited to 'samples/null.c')
-rw-r--r--samples/null.c10
1 files changed, 9 insertions, 1 deletions
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;