diff options
author | John Levon <john.levon@nutanix.com> | 2021-01-04 17:53:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 17:53:10 +0000 |
commit | 1fa90d5abecd896362e551b2bd2ec987d8f60a6b (patch) | |
tree | 6bcb22c92d2bf52c1baf6786a644d4abbbd09604 /samples/null.c | |
parent | 715b7963312002980b9eea5a695719cfdf2bf6e4 (diff) | |
download | libvfio-user-1fa90d5abecd896362e551b2bd2ec987d8f60a6b.zip libvfio-user-1fa90d5abecd896362e551b2bd2ec987d8f60a6b.tar.gz libvfio-user-1fa90d5abecd896362e551b2bd2ec987d8f60a6b.tar.bz2 |
re-work PCI config setup API (#198)
Split up vfu_pci_setup_config_hdr(): individual "helpers" like vfu_pci_set_id()
are much simpler to use than making the user specify the values in
header-formatted structs; and this way if we want to add additional helpers, we
won't need to modify the existing functions.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/null.c')
-rw-r--r-- | samples/null.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/samples/null.c b/samples/null.c index 23d727a..d05d0fc 100644 --- a/samples/null.c +++ b/samples/null.c @@ -81,10 +81,6 @@ 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"); @@ -101,8 +97,10 @@ 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); + if (vfu_pci_init(vfu_ctx, VFU_PCI_TYPE_CONVENTIONAL, + PCI_HEADER_TYPE_NORMAL, 0) < 0) { + err(EXIT_FAILURE, "vfu_pci_init() failed"); + } ret = pthread_create(&thread, NULL, null_drive, vfu_ctx); if (ret != 0) { |