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 /lib/migration.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 'lib/migration.c')
-rw-r--r-- | lib/migration.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/migration.c b/lib/migration.c index 0e1b2a6..ec07961 100644 --- a/lib/migration.c +++ b/lib/migration.c @@ -528,6 +528,9 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, pos -= migr->data_offset; if (is_write) { ret = migr->callbacks.write_data(vfu_ctx, buf, count, pos); + if (ret == -1) { + ret = -errno; + } } else { /* * FIXME <linux/vfio.h> says: @@ -538,6 +541,9 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, * Does this mean that partial reads are not allowed? */ ret = migr->callbacks.read_data(vfu_ctx, buf, count, pos); + if (ret == -1) { + ret = -errno; + } } } |