aboutsummaryrefslogtreecommitdiff
path: root/samples/null.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2020-11-27 14:48:07 +0000
committerGitHub <noreply@github.com>2020-11-27 14:48:07 +0000
commite94bd44d10d8019ea2c39356363a5743136bdb5d (patch)
tree93f71114f5e57682a5a5a1182f7c1e19ce963ff8 /samples/null.c
parent40ac852fec651f54a4be8905ab8bb6b25ddb64e2 (diff)
downloadlibvfio-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/null.c')
-rw-r--r--samples/null.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/samples/null.c b/samples/null.c
index b633059..1998a08 100644
--- a/samples/null.c
+++ b/samples/null.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>
@@ -41,19 +39,19 @@
#include <string.h>
#include "common.h"
-#include "muser.h"
+#include "libvfio-user.h"
#include "tran_sock.h"
static void
-null_log(UNUSED void *pvt, UNUSED lm_log_lvl_t lvl, char const *msg)
+null_log(UNUSED void *pvt, UNUSED vfu_log_lvl_t lvl, char const *msg)
{
- fprintf(stderr, "muser: %s", msg);
+ fprintf(stderr, "null: %s", msg);
}
static void* null_drive(void *arg)
{
- lm_ctx_t *lm_ctx = (lm_ctx_t*)arg;
+ vfu_ctx_t *vfu_ctx = (vfu_ctx_t*)arg;
int ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
if (ret != 0) {
fprintf(stderr, "failed to enable cancel state: %s\n", strerror(ret));
@@ -65,7 +63,7 @@ static void* null_drive(void *arg)
return NULL;
}
printf("starting device emulation\n");
- lm_ctx_drive(lm_ctx);
+ vfu_ctx_drive(vfu_ctx);
return NULL;
}
@@ -75,20 +73,20 @@ int main(int argc, char **argv)
pthread_t thread;
if (argc != 2) {
- errx(EXIT_FAILURE, "missing MUSER socket path");
+ errx(EXIT_FAILURE, "missing vfio-user socket path");
}
- lm_ctx_t *lm_ctx = lm_create_ctx(LM_TRANS_SOCK, argv[1], 0, NULL);
- if (lm_ctx == NULL) {
- err(EXIT_FAILURE, "failed to create libmuser context");
+ vfu_ctx_t *vfu_ctx = vfu_create_ctx(VFU_TRANS_SOCK, argv[1], 0, NULL);
+ if (vfu_ctx == NULL) {
+ err(EXIT_FAILURE, "failed to create libvfio-user context");
}
- ret = lm_setup_log(lm_ctx, null_log, LM_DBG);
+ ret = vfu_setup_log(vfu_ctx, null_log, VFU_DBG);
if (ret < 0) {
err(EXIT_FAILURE, "failed to setup log");
}
- ret = pthread_create(&thread, NULL, null_drive, lm_ctx);
+ ret = pthread_create(&thread, NULL, null_drive, vfu_ctx);
if (ret != 0) {
errno = ret;
err(EXIT_FAILURE, "failed to create pthread");
@@ -104,7 +102,7 @@ int main(int argc, char **argv)
errno = ret;
err(EXIT_FAILURE, "failed to create pthread");
}
- lm_ctx_destroy(lm_ctx);
+ vfu_ctx_destroy(vfu_ctx);
printf("device emulation stopped and cleaned up, press enter to exit\n");
if (getchar() == EOF) {