diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-12-02 05:31:52 -0500 |
---|---|---|
committer | Thanos <tmakatos@gmail.com> | 2020-12-02 11:09:41 +0000 |
commit | ddf444e8da02e0c8796944e2484cd0ca91a0105d (patch) | |
tree | 72b8ee1f1fae4ba84155fc1970da16bb49693345 /samples | |
parent | 806284b29414e11f7fd5274ba608ba66bbedc49f (diff) | |
download | libvfio-user-ddf444e8da02e0c8796944e2484cd0ca91a0105d.zip libvfio-user-ddf444e8da02e0c8796944e2484cd0ca91a0105d.tar.gz libvfio-user-ddf444e8da02e0c8796944e2484cd0ca91a0105d.tar.bz2 |
use log level defines from syslog
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/client.c | 2 | ||||
-rw-r--r-- | samples/gpio-pci-idio-16.c | 4 | ||||
-rw-r--r-- | samples/null.c | 4 | ||||
-rw-r--r-- | samples/server.c | 16 |
4 files changed, 13 insertions, 13 deletions
diff --git a/samples/client.c b/samples/client.c index 7002582..99289cb 100644 --- a/samples/client.c +++ b/samples/client.c @@ -58,7 +58,7 @@ static char *irq_to_str[] = { }; void -vfu_log(UNUSED vfu_ctx_t *vfu_ctx, UNUSED vfu_log_lvl_t lvl, +vfu_log(UNUSED vfu_ctx_t *vfu_ctx, UNUSED int level, const char *fmt, ...) { va_list ap; diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index be8ecdb..149bb59 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -46,7 +46,7 @@ #include "tran_sock.h" static void -_log(UNUSED void *pvt, UNUSED vfu_log_lvl_t lvl, char const *msg) +_log(UNUSED void *pvt, UNUSED int level, char const *msg) { fprintf(stderr, "gpio: %s\n", msg); } @@ -109,7 +109,7 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to initialize device emulation"); } - ret = vfu_setup_log(vfu_ctx, _log, verbose ? VFU_DBG : VFU_ERR); + ret = vfu_setup_log(vfu_ctx, _log, verbose ? LOG_DEBUG : LOG_ERR); if (ret < 0) { err(EXIT_FAILURE, "failed to setup log"); } diff --git a/samples/null.c b/samples/null.c index adf3a46..fda260e 100644 --- a/samples/null.c +++ b/samples/null.c @@ -43,7 +43,7 @@ #include "tran_sock.h" static void -null_log(UNUSED void *pvt, UNUSED vfu_log_lvl_t lvl, char const *msg) +null_log(UNUSED void *pvt, UNUSED int level, char const *msg) { fprintf(stderr, "null: %s", msg); } @@ -86,7 +86,7 @@ int main(int argc, char **argv) err(EXIT_FAILURE, "failed to create libvfio-user context"); } - ret = vfu_setup_log(vfu_ctx, null_log, VFU_DBG); + ret = vfu_setup_log(vfu_ctx, null_log, LOG_DEBUG); if (ret < 0) { err(EXIT_FAILURE, "failed to setup log"); } diff --git a/samples/server.c b/samples/server.c index ccfad1c..aeb9e69 100644 --- a/samples/server.c +++ b/samples/server.c @@ -70,7 +70,7 @@ struct server_data { }; static void -_log(UNUSED void *pvt, UNUSED vfu_log_lvl_t lvl, char const *msg) +_log(UNUSED void *pvt, UNUSED int level, char const *msg) { fprintf(stderr, "server: %s\n", msg); } @@ -79,10 +79,10 @@ static int arm_timer(struct server_data *server_data, time_t t) { struct itimerval new = {.it_value.tv_sec = t - time(NULL) }; - vfu_log(server_data->vfu_ctx, VFU_DBG, + vfu_log(server_data->vfu_ctx, LOG_DEBUG, "arming timer to trigger in %ld seconds", new.it_value.tv_sec); if (setitimer(ITIMER_REAL, &new, NULL) != 0) { - vfu_log(server_data->vfu_ctx, VFU_ERR, "failed to arm timer: %m"); + vfu_log(server_data->vfu_ctx, LOG_ERR, "failed to arm timer: %m"); return -errno; } return 0; @@ -95,7 +95,7 @@ bar0_access(void *pvt, char * const buf, size_t count, loff_t offset, struct server_data *server_data = pvt; if (count != sizeof(time_t) || offset != 0) { - vfu_log(server_data->vfu_ctx, VFU_ERR, "bad BAR0 access %#lx-%#lx", + vfu_log(server_data->vfu_ctx, LOG_ERR, "bad BAR0 access %#lx-%#lx", offset, offset + count - 1); errno = EINVAL; return -1; @@ -303,7 +303,7 @@ migration_read_data(void *pvt, void *buf, __u64 size, __u64 offset) struct server_data *server_data = pvt; if (server_data->migration.data_size < size) { - vfu_log(server_data->vfu_ctx, VFU_ERR, + vfu_log(server_data->vfu_ctx, LOG_ERR, "invalid migration data read %#llx-%#llx", offset, offset + size - 1); return -EINVAL; @@ -328,7 +328,7 @@ migration_write_data(void *pvt, void *data, __u64 size, __u64 offset) assert(data != NULL); if (offset + size > server_data->migration.migr_data_len) { - vfu_log(server_data->vfu_ctx, VFU_ERR, + vfu_log(server_data->vfu_ctx, LOG_ERR, "invalid write %#llx-%#llx", offset, offset + size - 1); } @@ -347,7 +347,7 @@ migration_data_written(void *pvt, __u64 count, __u64 offset) assert(server_data != NULL); if (offset + count > server_data->migration.migr_data_len) { - vfu_log(server_data->vfu_ctx, VFU_ERR, + vfu_log(server_data->vfu_ctx, LOG_ERR, "bad migration data range %#llx-%#llx", offset, offset + count - 1); return -EINVAL; @@ -417,7 +417,7 @@ int main(int argc, char *argv[]) err(EXIT_FAILURE, "failed to initialize device emulation\n"); } - ret = vfu_setup_log(vfu_ctx, _log, verbose ? VFU_DBG : VFU_ERR); + ret = vfu_setup_log(vfu_ctx, _log, verbose ? LOG_DEBUG : LOG_ERR); if (ret < 0) { err(EXIT_FAILURE, "failed to setup log"); } |