diff options
author | John Levon <john.levon@nutanix.com> | 2020-11-27 14:48:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-27 14:48:07 +0000 |
commit | e94bd44d10d8019ea2c39356363a5743136bdb5d (patch) | |
tree | 93f71114f5e57682a5a5a1182f7c1e19ce963ff8 /samples/gpio-pci-idio-16.c | |
parent | 40ac852fec651f54a4be8905ab8bb6b25ddb64e2 (diff) | |
download | libvfio-user-e94bd44d10d8019ea2c39356363a5743136bdb5d.zip libvfio-user-e94bd44d10d8019ea2c39356363a5743136bdb5d.tar.gz libvfio-user-e94bd44d10d8019ea2c39356363a5743136bdb5d.tar.bz2 |
rename to libvfio-user (#128)
The muser name no longer reflects the implementation, and will just serve to
confuse. Bite the bullet now, and rename ourselves to reflect the actual
implementation.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@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 | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index 7572ce2..aabcf75 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -1,6 +1,4 @@ /* - * Userspace mediated device sample application - * * Copyright (c) 2019, Nutanix Inc. All rights reserved. * Author: Thanos Makatos <thanos@nutanix.com> * Swapnil Ingle <swapnil.ingle@nutanix.com> @@ -31,7 +29,9 @@ * */ -/* gpio-pci-idio-16 */ +/* + * gpio-pci-idio-16: a simple example server identifying as a GPIO PCI device. + */ #include <stdio.h> #include <err.h> @@ -42,11 +42,11 @@ #include <errno.h> #include "common.h" -#include "muser.h" +#include "libvfio-user.h" #include "tran_sock.h" static void -_log(UNUSED void *pvt, UNUSED lm_log_lvl_t lvl, char const *msg) +_log(UNUSED void *pvt, UNUSED vfu_log_lvl_t lvl, char const *msg) { fprintf(stderr, "gpio: %s\n", msg); } @@ -74,10 +74,10 @@ main(int argc, char *argv[]) bool verbose = false; char opt; struct sigaction act = { .sa_handler = _sa_handler }; - lm_ctx_t *lm_ctx; - lm_pci_hdr_id_t id = { .vid = 0x494F, .did = 0x0DC8 }; - lm_pci_hdr_ss_t ss = { .vid = 0x0, .sid = 0x0 }; - lm_pci_hdr_cc_t cc = { { 0 } }; + vfu_ctx_t *vfu_ctx; + vfu_pci_hdr_id_t id = { .vid = 0x494F, .did = 0x0DC8 }; + vfu_pci_hdr_ss_t ss = { .vid = 0x0, .sid = 0x0 }; + vfu_pci_hdr_cc_t cc = { { 0 } }; while ((opt = getopt(argc, argv, "v")) != -1) { switch (opt) { @@ -91,7 +91,7 @@ main(int argc, char *argv[]) } if (optind >= argc) { - errx(EXIT_FAILURE, "missing MUSER socket path"); + errx(EXIT_FAILURE, "missing vfio-user socket path"); } sigemptyset(&act.sa_mask); @@ -99,8 +99,8 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to register signal handler"); } - lm_ctx = lm_create_ctx(LM_TRANS_SOCK, argv[optind], 0, NULL); - if (lm_ctx == NULL) { + vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[optind], 0, NULL); + if (vfu_ctx == NULL) { if (errno == EINTR) { printf("interrupted\n"); exit(EXIT_SUCCESS); @@ -108,25 +108,25 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to initialize device emulation"); } - ret = lm_setup_log(lm_ctx, _log, verbose ? LM_DBG : LM_ERR); + ret = vfu_setup_log(vfu_ctx, _log, verbose ? VFU_DBG : VFU_ERR); if (ret < 0) { err(EXIT_FAILURE, "failed to setup log"); } - ret = lm_pci_setup_config_hdr(lm_ctx, id, ss, cc, false); + ret = vfu_pci_setup_config_hdr(vfu_ctx, id, ss, cc, false); if (ret < 0) { fprintf(stderr, "failed to setup pci header\n"); goto out; } - ret = lm_setup_region(lm_ctx, LM_PCI_DEV_BAR2_REGION_IDX, 0x100, &bar2_access, - LM_REG_FLAG_RW, NULL, NULL); + ret = vfu_setup_region(vfu_ctx, VFU_PCI_DEV_BAR2_REGION_IDX, 0x100, + &bar2_access, VFU_REG_FLAG_RW, NULL, NULL); if (ret < 0) { fprintf(stderr, "failed to setup region\n"); goto out; } - ret = lm_ctx_drive(lm_ctx); + ret = vfu_ctx_drive(vfu_ctx); if (ret != 0) { if (ret != -ENOTCONN && ret != -EINTR) { fprintf(stderr, "failed to realize device emulation\n"); @@ -136,7 +136,7 @@ main(int argc, char *argv[]) } out: - lm_ctx_destroy(lm_ctx); + vfu_ctx_destroy(vfu_ctx); return ret; } |