diff options
Diffstat (limited to 'samples/gpio-pci-idio-16.c')
-rw-r--r-- | samples/gpio-pci-idio-16.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index 26ac62a..1efc291 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -126,13 +126,12 @@ migration_write_data(UNUSED vfu_ctx_t *vfu_ctx, void *buf, __u64 size, } static void -map_dma(vfu_ctx_t *vfu_ctx UNUSED, uint64_t iova UNUSED, uint64_t len UNUSED, - uint32_t prot UNUSED) +dma_register(UNUSED vfu_ctx_t *vfu_ctx, UNUSED vfu_dma_info_t *info) { } static int -unmap_dma(vfu_ctx_t *vfu_ctx UNUSED, uint64_t iova UNUSED, uint64_t len UNUSED) +dma_unregister(UNUSED vfu_ctx_t *vfu_ctx, UNUSED vfu_dma_info_t *info) { return 0; } @@ -142,7 +141,6 @@ main(int argc, char *argv[]) { int ret; bool verbose = false; - bool dma = false; char opt; struct sigaction act = { .sa_handler = _sa_handler }; vfu_ctx_t *vfu_ctx; @@ -159,16 +157,13 @@ main(int argc, char *argv[]) .write_data = &migration_write_data }; - while ((opt = getopt(argc, argv, "vd")) != -1) { + while ((opt = getopt(argc, argv, "v")) != -1) { switch (opt) { case 'v': verbose = true; break; - case 'd': - dma = true; - break; default: /* '?' */ - fprintf(stderr, "Usage: %s [-d] [-v] <socketpath>\n", argv[0]); + fprintf(stderr, "Usage: %s [-v] <socketpath>\n", argv[0]); exit(EXIT_FAILURE); } } @@ -227,11 +222,9 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to setup irq counts"); } - if (dma) { - ret = vfu_setup_device_dma_cb(vfu_ctx, map_dma, unmap_dma); - if (ret < 0) { - err(EXIT_FAILURE, "failed to setup DMA"); - } + ret = vfu_setup_device_dma(vfu_ctx, dma_register, dma_unregister); + if (ret < 0) { + err(EXIT_FAILURE, "failed to setup DMA"); } ret = vfu_realize_ctx(vfu_ctx); |