From: d032747 <michael.trapp@xxxxxxx> --- vhostmd/virtio.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/vhostmd/virtio.c b/vhostmd/virtio.c index f227b45..857123d 100644 --- a/vhostmd/virtio.c +++ b/vhostmd/virtio.c @@ -69,7 +69,7 @@ static time_t exp_period = 0; static const char *channel_path = "/var/lib/libvirt/qemu/channel/target"; static const char *channel_name = "org.github.vhostmd.1"; -static int channel_max = 0; +static size_t channel_max = 0; static volatile int channel_count = 0; static volatile int connection_count = 0; @@ -216,7 +216,7 @@ static int vio_channel_open(channel_t * c) connection_count++; - vu_log(VHOSTMD_INFO, "Opened channel '%d %s' (%d/%d/%d)", + vu_log(VHOSTMD_INFO, "Opened channel '%d %s' (%d/%d/%lu)", c->id, c->name, connection_count, channel_count, channel_max); return 0; @@ -243,7 +243,7 @@ static void vio_channel_close(channel_t * c) if (c->fd != FREE) connection_count--; - vu_log(VHOSTMD_INFO, "Closed channel '%d %s' (%d/%d/%d)", + vu_log(VHOSTMD_INFO, "Closed channel '%d %s' (%d/%d/%lu)", c->id, c->name, connection_count, channel_count, channel_max); vio_channel_free(c); @@ -322,7 +322,7 @@ error: */ static void vio_expire(void) { - int i; + unsigned i; time_t ts = time(NULL) - exp_period; for (i = 1; i <= channel_max; i++) { @@ -333,7 +333,7 @@ static void vio_expire(void) c->update_ts < ts) { #ifdef ENABLE_DEBUG - vu_log(VHOSTMD_DEBUG, "Expire channel '%s' (%d/%d/%d)", + vu_log(VHOSTMD_DEBUG, "Expire channel '%s' (%d/%d/%u)", c->name, connection_count, channel_count, channel_max); #endif vio_channel_close(c); @@ -364,7 +364,7 @@ static channel_t *vio_channel_find(int id, const char * name, int insert) int i; #endif vu_log(VHOSTMD_ERR, - "Could not add channel '%d %s' - too many VMs (%d/%d/%d)", + "Could not add channel '%d %s' - too many VMs (%d/%d/%lu)", id, name, connection_count, channel_count, channel_max); #ifdef ENABLE_DEBUG @@ -399,7 +399,7 @@ static channel_t *vio_channel_find(int id, const char * name, int insert) vu_buffer_create(&c->response, DEFAULT_VU_BUFFER_SIZE)) goto error; - vu_log(VHOSTMD_INFO, "Added channel '%d %s' (%d/%d/%d)", + vu_log(VHOSTMD_INFO, "Added channel '%d %s' (%d/%d/%lu)", c->id, c->name, connection_count, channel_count, channel_max); return c; @@ -583,8 +583,7 @@ int virtio_init(int _max_channel, int _expiration_period) channel_count = 0; connection_count = 0; - channel = (channel_t *) calloc((size_t) (channel_max + 1), - sizeof(channel_t)); + channel = (channel_t *) calloc(channel_max + 1, sizeof(channel_t)); if (channel == NULL) goto error; @@ -595,7 +594,7 @@ int virtio_init(int _max_channel, int _expiration_period) channel[i].fd = -1; } - id_map = (id_map_t *) calloc((size_t) channel_max, sizeof(id_map_t)); + id_map = (id_map_t *) calloc(channel_max, sizeof(id_map_t)); if (id_map == NULL) goto error; @@ -606,8 +605,7 @@ int virtio_init(int _max_channel, int _expiration_period) if (epoll_fd == -1) { - epoll_events = calloc((size_t) (channel_max + 1), - sizeof(struct epoll_event)); + epoll_events = calloc(channel_max + 1, sizeof(struct epoll_event)); if (epoll_events == NULL) goto error; @@ -618,7 +616,7 @@ int virtio_init(int _max_channel, int _expiration_period) virtio_status = VIRTIO_ACTIVE; vu_log(VHOSTMD_INFO, - "Activating virtio, using max_channels %d, expiration_time %ld", + "Activating virtio, using max_channels %lu, expiration_time %ld", channel_max, exp_period); } -- 2.24.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list