aboutsummaryrefslogtreecommitdiff
path: root/samples/server.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-04-06 13:37:53 +0100
committerGitHub <noreply@github.com>2021-04-06 13:37:53 +0100
commitb2ce987ce3954a23a806e875a65304989fae7067 (patch)
tree3fe9deacd801b4b12bc32b25b39f2d9bd9e6e04a /samples/server.c
parent6c9e6a86dbf3e5c6ec2932358ca2c352bdcba5c8 (diff)
downloadlibvfio-user-b2ce987ce3954a23a806e875a65304989fae7067.zip
libvfio-user-b2ce987ce3954a23a806e875a65304989fae7067.tar.gz
libvfio-user-b2ce987ce3954a23a806e875a65304989fae7067.tar.bz2
samples client/server: log more consistently (#420)
Prefix logs with client/server; run the tests verbosely. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples/server.c')
-rw-r--r--samples/server.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/samples/server.c b/samples/server.c
index 5130688..476b669 100644
--- a/samples/server.c
+++ b/samples/server.c
@@ -68,7 +68,7 @@ struct server_data {
static void
_log(vfu_ctx_t *vfu_ctx UNUSED, UNUSED int level, char const *msg)
{
- fprintf(stderr, "server: %s\n", msg);
+ fprintf(stderr, "server[%d]: %s\n", getpid(), msg);
}
static int
@@ -227,7 +227,7 @@ static void do_dma_io(vfu_ctx_t *vfu_ctx, struct server_data *server_data)
memset(buf, 'A', count);
get_md5sum(buf, count, md5sum1);
- printf("%s: WRITE addr %p count %d\n", __func__,
+ vfu_log(vfu_ctx, LOG_DEBUG, "%s: WRITE addr %p count %d", __func__,
server_data->regions[0].iova.iov_base, count);
ret = vfu_dma_write(vfu_ctx, &sg, buf);
if (ret < 0) {
@@ -235,7 +235,7 @@ static void do_dma_io(vfu_ctx_t *vfu_ctx, struct server_data *server_data)
}
memset(buf, 0, count);
- printf("%s: READ addr %p count %d\n", __func__,
+ vfu_log(vfu_ctx, LOG_DEBUG, "%s: READ addr %p count %d", __func__,
server_data->regions[0].iova.iov_base, count);
ret = vfu_dma_read(vfu_ctx, &sg, buf);
if (ret < 0) {
@@ -251,8 +251,7 @@ static void do_dma_io(vfu_ctx_t *vfu_ctx, struct server_data *server_data)
static int device_reset(vfu_ctx_t *vfu_ctx UNUSED)
{
- printf("device reset callback\n");
-
+ vfu_log(vfu_ctx, LOG_DEBUG, "device reset callback");
return 0;
}
@@ -263,7 +262,8 @@ migration_device_state_transition(vfu_ctx_t *vfu_ctx, vfu_migr_state_t state)
int ret;
struct itimerval new = { { 0 }, };
- printf("migration: transition to device state %d\n", state);
+ vfu_log(vfu_ctx, LOG_DEBUG, "migration: transition to device state %d",
+ state);
switch (state) {
case VFU_MIGR_STATE_STOP_AND_COPY: