From 2015453378f9d00fe271faf0f4cfa39f5f53536a Mon Sep 17 00:00:00 2001 From: swapnili Date: Tue, 8 Dec 2020 16:01:35 +0100 Subject: Misc fixes for vfu_ctx_try_attach() and vfu_realize_ctx() (#175) Misc changes for vfu_ctx_try_attach() * Rename to vfu_attach_ctx() * Removed call to vfu_realize_ctx(), should be called separately * Now vfu_attach_ctx() must also be called for blocking ctx. Misc changes for vfu_realize_ctx() * Made calling vfu_realize_ctx() mandatory * vfu_ctx_drive() and vfu_poll_ctx() returns EINVAL if the device is not realized. * Renamed vfu_ctx->ready to vfu_ctx->realized Added unit test for vfu_attach_ctx() and vfu_realize_ctx() Signed-off-by: Swapnil Ingle Reviewed-by: Thanos Makatos --- samples/gpio-pci-idio-16.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'samples/gpio-pci-idio-16.c') diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index e786d43..a957117 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -133,6 +133,16 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to setup irq counts"); } + ret = vfu_realize_ctx(vfu_ctx); + if (ret < 0) { + err(EXIT_FAILURE, "failed to realize device"); + } + + ret = vfu_attach_ctx(vfu_ctx); + if (ret < 0) { + err(EXIT_FAILURE, "failed to attach device"); + } + ret = vfu_ctx_drive(vfu_ctx); if (ret != 0) { if (ret != -ENOTCONN && ret != -EINTR) { -- cgit v1.1