diff options
author | John Levon <john.levon@nutanix.com> | 2021-02-10 18:26:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 18:26:53 +0000 |
commit | cf449d6290ddd723a23f0451d0ce18ffc6099e15 (patch) | |
tree | bb59c4564609839ca6281582035068a6ea92ff92 /samples/gpio-pci-idio-16.c | |
parent | aa2157aad1876c3963efe34c694c93eadd309c97 (diff) | |
download | libvfio-user-cf449d6290ddd723a23f0451d0ce18ffc6099e15.zip libvfio-user-cf449d6290ddd723a23f0451d0ce18ffc6099e15.tar.gz libvfio-user-cf449d6290ddd723a23f0451d0ce18ffc6099e15.tar.bz2 |
don't expose -errno in public API (#327)
Regardless of what we do internally, most of our API uses standard mechanisms
for reporting errors. Fix vfu_run_ctx() to do so properly as well, and fix a
couple of other references for user-provided callbacks.
This will require a small fix to SPDK.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'samples/gpio-pci-idio-16.c')
-rw-r--r-- | samples/gpio-pci-idio-16.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index 350d11f..771de3a 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -122,8 +122,7 @@ main(int argc, char *argv[]) ret = vfu_setup_region(vfu_ctx, VFU_PCI_DEV_BAR2_REGION_IDX, 0x100, &bar2_access, VFU_REGION_FLAG_RW, NULL, 0, -1); if (ret < 0) { - fprintf(stderr, "failed to setup region\n"); - goto out; + err(EXIT_FAILURE, "failed to setup region"); } ret = vfu_setup_device_nr_irqs(vfu_ctx, VFU_DEV_INTX_IRQ, 1); @@ -143,16 +142,13 @@ main(int argc, char *argv[]) ret = vfu_run_ctx(vfu_ctx); if (ret != 0) { - if (ret != -ENOTCONN && ret != -EINTR) { - fprintf(stderr, "failed to realize device emulation\n"); - goto out; + if (errno != ENOTCONN && errno != EINTR) { + err(EXIT_FAILURE, "failed to realize device emulation"); } - ret = 0; } -out: vfu_destroy_ctx(vfu_ctx); - return ret; + return EXIT_SUCCESS; } /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ |