diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-12-04 07:05:37 -0500 |
---|---|---|
committer | Thanos Makatos <tmakatos@gmail.com> | 2020-12-07 11:53:52 +0000 |
commit | 56ad046f32b46b24d0e743dc41b400d937eb2c9f (patch) | |
tree | 8240f5ff30fb955e43a8aa576b419b5cd7c529a3 /lib | |
parent | 345a4ee5b47e9e64d7e1197a74ef675e498dd78b (diff) | |
download | libvfio-user-56ad046f32b46b24d0e743dc41b400d937eb2c9f.zip libvfio-user-56ad046f32b46b24d0e743dc41b400d937eb2c9f.tar.gz libvfio-user-56ad046f32b46b24d0e743dc41b400d937eb2c9f.tar.bz2 |
rename prepare_ctx into vfio_realize_ctx and make it public
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libvfio-user.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index 7bec753..007169f 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1080,8 +1080,8 @@ process_request(vfu_ctx_t *vfu_ctx) return ret; } -static int -prepare_ctx(vfu_ctx_t *vfu_ctx) +int +vfu_realize_ctx(vfu_ctx_t *vfu_ctx) { vfu_reg_info_t *cfg_reg; const vfu_reg_info_t zero_reg = { 0 }; @@ -1105,7 +1105,7 @@ prepare_ctx(vfu_ctx_t *vfu_ctx) vfu_log(vfu_ctx, LOG_ERR, "failed to attach: %s", strerror(-err)); } - return err; + return ERROR(err); } } @@ -1122,7 +1122,7 @@ prepare_ctx(vfu_ctx_t *vfu_ctx) if (vfu_ctx->pci.config_space == NULL) { vfu_ctx->pci.config_space = calloc(1, cfg_reg->size); if (vfu_ctx->pci.config_space == NULL) { - return -ENOMEM; + return ERROR(ENOMEM); } } @@ -1151,7 +1151,7 @@ prepare_ctx(vfu_ctx_t *vfu_ctx) vfu_ctx->irqs = calloc(1, sizeof(vfu_irqs_t) + size); if (vfu_ctx->irqs == NULL) { // vfu_ctx->pci.config_space should be free'ed by vfu_destroy_ctx(). - return -ENOMEM; + return ERROR(ENOMEM); } // Set context irq information. @@ -1187,9 +1187,9 @@ vfu_ctx_drive(vfu_ctx_t *vfu_ctx) return ERROR(EINVAL); } - err = prepare_ctx(vfu_ctx); - if (err < 0) { - return ERROR(-err); + err = vfu_realize_ctx(vfu_ctx); + if (err == -1) { + return -1; } do { @@ -1279,9 +1279,9 @@ vfu_ctx_try_attach(vfu_ctx_t *vfu_ctx) return ERROR(EINVAL); } - err = prepare_ctx(vfu_ctx); - if (err < 0) { - return ERROR(-err); + err = vfu_realize_ctx(vfu_ctx); + if (err == -1) { + return err; } return vfu_ctx->trans->attach(vfu_ctx); |