For those things that are actually errors or warnings, switch to spice_warning(). For those things that are just informational, switch to spice_debug(). Currently, these messages are just indiscriminately printed to stderr even if debugging isn't enabled, which can clog up the qemu monitor, for example. Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> --- server/agent-msg-filter.c | 8 +++--- server/char-device.c | 10 +++---- server/dcc.c | 4 +-- server/dispatcher.c | 16 +++++------ server/inputs-channel-client.c | 2 +- server/inputs-channel.c | 10 +++---- server/main-channel-client.c | 56 +++++++++++++++++++-------------------- server/main-channel.c | 16 +++++------ server/net-utils.c | 4 +-- server/red-channel-client.c | 22 +++++++-------- server/red-client.c | 4 +-- server/red-qxl.c | 12 ++++----- server/red-replay-qxl.c | 6 ++--- server/smartcard-channel-client.c | 4 +-- server/smartcard.c | 6 ++--- server/sound.c | 14 +++++----- server/spicevmc.c | 12 ++++----- server/zlib-encoder.c | 2 +- 18 files changed, 104 insertions(+), 104 deletions(-) diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c index da6640c..b5018b4 100644 --- a/server/agent-msg-filter.c +++ b/server/agent-msg-filter.c @@ -52,7 +52,7 @@ AgentMsgFilterResult agent_msg_filter_process_data(AgentMsgFilter *filter, struct VDAgentMessage msg_header; if (len > VD_AGENT_MAX_DATA_SIZE) { - spice_printerr("invalid agent message: too large"); + spice_warning("invalid agent message: too large"); return AGENT_MSG_FILTER_PROTO_ERROR; } @@ -60,7 +60,7 @@ AgentMsgFilterResult agent_msg_filter_process_data(AgentMsgFilter *filter, if (filter->msg_data_to_read) { data_to_read: if (len > filter->msg_data_to_read) { - spice_printerr("invalid agent message: data exceeds size from header"); + spice_warning("invalid agent message: data exceeds size from header"); return AGENT_MSG_FILTER_PROTO_ERROR; } filter->msg_data_to_read -= len; @@ -68,14 +68,14 @@ data_to_read: } if (len < sizeof(msg_header)) { - spice_printerr("invalid agent message: incomplete header"); + spice_warning("invalid agent message: incomplete header"); return AGENT_MSG_FILTER_PROTO_ERROR; } memcpy(&msg_header, data, sizeof(msg_header)); len -= sizeof(msg_header); if (msg_header.protocol != VD_AGENT_PROTOCOL) { - spice_printerr("invalid agent protocol: %u", msg_header.protocol); + spice_warning("invalid agent protocol: %u", msg_header.protocol); return AGENT_MSG_FILTER_PROTO_ERROR; } diff --git a/server/char-device.c b/server/char-device.c index 94c4f7f..a818b13 100644 --- a/server/char-device.c +++ b/server/char-device.c @@ -216,7 +216,7 @@ static void red_char_device_client_free(RedCharDevice *dev, static void red_char_device_handle_client_overflow(RedCharDeviceClient *dev_client) { RedCharDevice *dev = dev_client->dev; - spice_printerr("dev %p client %p ", dev, dev_client); + spice_warning("dev %p client %p ", dev, dev_client); red_char_device_remove_client(dev, dev_client->client); } @@ -569,7 +569,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get( if (dev_client) { if (!migrated_data_tokens && dev_client->do_flow_control && !dev_client->num_client_tokens) { - spice_printerr("token violation: dev %p client %p", dev, client); + spice_warning("token violation: dev %p client %p", dev, client); red_char_device_handle_client_overflow(dev_client); goto error; } @@ -580,7 +580,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get( } else { /* it is possible that the client was removed due to send tokens underflow, but * the caller still receive messages from the client */ - spice_printerr("client not found: dev %p client %p", dev, client); + spice_warning("client not found: dev %p client %p", dev, client); goto error; } } else if (origin == WRITE_BUFFER_ORIGIN_SERVER) { @@ -636,7 +636,7 @@ void red_char_device_write_buffer_add(RedCharDevice *dev, /* caller shouldn't add buffers for client that was removed */ if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT && !red_char_device_client_find(dev, write_buf->priv->client)) { - spice_printerr("client not found: dev %p client %p", dev, write_buf->priv->client); + spice_warning("client not found: dev %p client %p", dev, write_buf->priv->client); red_char_device_write_buffer_pool_add(dev, write_buf); return; } @@ -659,7 +659,7 @@ void red_char_device_write_buffer_release(RedCharDevice *dev, RedClient *client = write_buf->priv->client; if (!dev) { - spice_printerr("no device. write buffer is freed"); + spice_warning("no device. write buffer is freed"); red_char_device_write_buffer_free(write_buf); return; } diff --git a/server/dcc.c b/server/dcc.c index f839336..ae005fa 100644 --- a/server/dcc.c +++ b/server/dcc.c @@ -701,7 +701,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num) /* FIXME: on !unix peer, start streaming with a video codec */ if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) || !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) { - spice_printerr("FIXME: client does not support GL scanout"); + spice_warning("FIXME: client does not support GL scanout"); red_channel_client_disconnect(rcc); return NULL; } @@ -720,7 +720,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num) if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) || !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) { - spice_printerr("FIXME: client does not support GL scanout"); + spice_warning("FIXME: client does not support GL scanout"); red_channel_client_disconnect(rcc); return NULL; } diff --git a/server/dispatcher.c b/server/dispatcher.c index f4fe97b..85fcd71 100644 --- a/server/dispatcher.c +++ b/server/dispatcher.c @@ -273,7 +273,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher) uint32_t ack = ACK; if ((ret = read_safe(dispatcher->priv->recv_fd, (uint8_t*)&type, sizeof(type), 0)) == -1) { - spice_printerr("error reading from dispatcher: %d", errno); + spice_warning("error reading from dispatcher: %d", errno); return 0; } if (ret == 0) { @@ -282,7 +282,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher) } msg = &dispatcher->priv->messages[type]; if (read_safe(dispatcher->priv->recv_fd, payload, msg->size, 1) == -1) { - spice_printerr("error reading from dispatcher: %d", errno); + spice_warning("error reading from dispatcher: %d", errno); /* TODO: close socketpair? */ return 0; } @@ -292,12 +292,12 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher) if (msg->handler) { msg->handler(dispatcher->priv->opaque, payload); } else { - spice_printerr("error: no handler for message type %d", type); + spice_warning("error: no handler for message type %d", type); } if (msg->ack == DISPATCHER_ACK) { if (write_safe(dispatcher->priv->recv_fd, (uint8_t*)&ack, sizeof(ack)) == -1) { - spice_printerr("error writing ack for message %d", type); + spice_warning("error writing ack for message %d", type); /* TODO: close socketpair? */ } } else if (msg->ack == DISPATCHER_ASYNC && dispatcher->priv->handle_async_done) { @@ -328,20 +328,20 @@ void dispatcher_send_message(Dispatcher *dispatcher, uint32_t message_type, msg = &dispatcher->priv->messages[message_type]; pthread_mutex_lock(&dispatcher->priv->lock); if (write_safe(send_fd, (uint8_t*)&message_type, sizeof(message_type)) == -1) { - spice_printerr("error: failed to send message type for message %d", + spice_warning("error: failed to send message type for message %d", message_type); goto unlock; } if (write_safe(send_fd, payload, msg->size) == -1) { - spice_printerr("error: failed to send message body for message %d", + spice_warning("error: failed to send message body for message %d", message_type); goto unlock; } if (msg->ack == DISPATCHER_ACK) { if (read_safe(send_fd, (uint8_t*)&ack, sizeof(ack), 1) == -1) { - spice_printerr("error: failed to read ack"); + spice_warning("error: failed to read ack"); } else if (ack != ACK) { - spice_printerr("error: got wrong ack value in dispatcher " + spice_warning("error: got wrong ack value in dispatcher " "for message %d\n", message_type); /* TODO handling error? */ } diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c index c28e24e..56a7169 100644 --- a/server/inputs-channel-client.c +++ b/server/inputs-channel-client.c @@ -49,7 +49,7 @@ inputs_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size) { if (size > RECEIVE_BUF_SIZE) { - spice_printerr("error: too large incoming message"); + spice_warning("error: too large incoming message"); return NULL; } diff --git a/server/inputs-channel.c b/server/inputs-channel.c index 943c69d..df27395 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -463,7 +463,7 @@ static void inputs_connect(RedChannel *channel, RedClient *client, "keyboard channel is insecure"); } - spice_printerr("inputs channel client create"); + spice_debug("inputs channel client create"); rcc = inputs_channel_client_create(channel, client, stream, caps); if (!rcc) { return; @@ -608,7 +608,7 @@ static SpiceKbdInstance* inputs_channel_get_keyboard(InputsChannel *inputs) int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboard) { if (inputs->keyboard) { - spice_printerr("already have keyboard"); + spice_warning("already have keyboard"); return -1; } inputs->keyboard = keyboard; @@ -624,7 +624,7 @@ static SpiceMouseInstance* inputs_channel_get_mouse(InputsChannel *inputs) int inputs_channel_set_mouse(InputsChannel *inputs, SpiceMouseInstance *mouse) { if (inputs->mouse) { - spice_printerr("already have mouse"); + spice_warning("already have mouse"); return -1; } inputs->mouse = mouse; @@ -640,7 +640,7 @@ static SpiceTabletInstance* inputs_channel_get_tablet(InputsChannel *inputs) int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet, RedsState *reds) { if (inputs->tablet) { - spice_printerr("already have tablet"); + spice_warning("already have tablet"); return -1; } inputs->tablet = tablet; @@ -656,7 +656,7 @@ int inputs_channel_has_tablet(InputsChannel *inputs) void inputs_channel_detach_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet) { - spice_printerr(""); + spice_debug(NULL); inputs->tablet = NULL; } diff --git a/server/main-channel-client.c b/server/main-channel-client.c index ae8d2d5..b436564 100644 --- a/server/main-channel-client.c +++ b/server/main-channel-client.c @@ -442,7 +442,7 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc, int seamless) { RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc)); - spice_printerr("client %p connected: %d seamless %d", client, success, seamless); + spice_debug("client %p connected: %d seamless %d", client, success, seamless); if (mcc->priv->mig_wait_connect) { RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc)); MainChannel *main_channel = MAIN_CHANNEL(channel); @@ -452,7 +452,7 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc, main_channel_on_migrate_connected(main_channel, success, seamless); } else { if (success) { - spice_printerr("client %p MIGRATE_CANCEL", client); + spice_debug("client %p MIGRATE_CANCEL", client); red_channel_client_pipe_add_empty_msg(RED_CHANNEL_CLIENT(mcc), SPICE_MSG_MAIN_MIGRATE_CANCEL); } @@ -502,9 +502,9 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping, mcc->priv->net_test_id = 0; if (roundtrip <= mcc->priv->latency) { // probably high load on client or server result with incorrect values - spice_printerr("net test: invalid values, latency %" PRIu64 - " roundtrip %" PRIu64 ". assuming high" - "bandwidth", mcc->priv->latency, roundtrip); + spice_warning("net test: invalid values, latency %" PRIu64 + " roundtrip %" PRIu64 ". assuming high" + "bandwidth", mcc->priv->latency, roundtrip); mcc->priv->latency = 0; mcc->priv->net_test_stage = NET_TEST_STAGE_INVALID; red_channel_client_start_connectivity_monitoring(rcc, @@ -514,19 +514,19 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping, mcc->priv->bitrate_per_sec = (uint64_t)(NET_TEST_BYTES * 8) * 1000000 / (roundtrip - mcc->priv->latency); mcc->priv->net_test_stage = NET_TEST_STAGE_COMPLETE; - spice_printerr("net test: latency %f ms, bitrate %"PRIu64" bps (%f Mbps)%s", - (double)mcc->priv->latency / 1000, - mcc->priv->bitrate_per_sec, - (double)mcc->priv->bitrate_per_sec / 1024 / 1024, - main_channel_client_is_low_bandwidth(mcc) ? " LOW BANDWIDTH" : ""); + spice_debug("net test: latency %f ms, bitrate %"PRIu64" bps (%f Mbps)%s", + (double)mcc->priv->latency / 1000, + mcc->priv->bitrate_per_sec, + (double)mcc->priv->bitrate_per_sec / 1024 / 1024, + main_channel_client_is_low_bandwidth(mcc) ? " LOW BANDWIDTH" : ""); red_channel_client_start_connectivity_monitoring(rcc, CLIENT_CONNECTIVITY_TIMEOUT); break; default: - spice_printerr("invalid net test stage, ping id %d test id %d stage %d", - ping->id, - mcc->priv->net_test_id, - mcc->priv->net_test_stage); + spice_warning("invalid net test stage, ping id %d test id %d stage %d", + ping->id, + mcc->priv->net_test_id, + mcc->priv->net_test_stage); mcc->priv->net_test_stage = NET_TEST_STAGE_INVALID; } } @@ -535,13 +535,13 @@ void main_channel_client_handle_migrate_end(MainChannelClient *mcc) { RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc)); if (!red_client_during_migrate_at_target(client)) { - spice_printerr("unexpected SPICE_MSGC_MIGRATE_END"); + spice_warning("unexpected SPICE_MSGC_MIGRATE_END"); return; } if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(mcc), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) { - spice_printerr("unexpected SPICE_MSGC_MIGRATE_END, " - "client does not support semi-seamless migration"); + spice_warning("unexpected SPICE_MSGC_MIGRATE_END, " + "client does not support semi-seamless migration"); return; } red_client_semi_seamless_migrate_complete(client); @@ -550,8 +550,8 @@ void main_channel_client_handle_migrate_end(MainChannelClient *mcc) void main_channel_client_migrate_cancel_wait(MainChannelClient *mcc) { if (mcc->priv->mig_wait_connect) { - spice_printerr("client %p cancel wait connect", - red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc))); + spice_debug("client %p cancel wait connect", + red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc))); mcc->priv->mig_wait_connect = FALSE; mcc->priv->mig_connect_ok = FALSE; } @@ -585,18 +585,18 @@ gboolean main_channel_client_migrate_src_complete(MainChannelClient *mcc, SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE); if (semi_seamless_support && mcc->priv->mig_connect_ok) { if (success) { - spice_printerr("client %p MIGRATE_END", client); + spice_debug("client %p MIGRATE_END", client); red_channel_client_pipe_add_empty_msg(rcc, SPICE_MSG_MAIN_MIGRATE_END); ret = TRUE; } else { - spice_printerr("client %p MIGRATE_CANCEL", client); + spice_debug("client %p MIGRATE_CANCEL", client); red_channel_client_pipe_add_empty_msg(rcc, SPICE_MSG_MAIN_MIGRATE_CANCEL); } } else { if (success) { - spice_printerr("client %p SWITCH_HOST", client); + spice_debug("client %p SWITCH_HOST", client); red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST); } @@ -661,7 +661,7 @@ gboolean main_channel_client_connect_semi_seamless(MainChannelClient *mcc) SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) { RedClient *client = red_channel_client_get_client(rcc); if (red_client_during_migrate_at_target(client)) { - spice_printerr("client %p: wait till previous migration completes", client); + spice_debug("client %p: wait till previous migration completes", client); mcc->priv->mig_wait_prev_complete = TRUE; mcc->priv->mig_wait_prev_try_seamless = FALSE; } else { @@ -682,7 +682,7 @@ void main_channel_client_connect_seamless(MainChannelClient *mcc) spice_assert(red_channel_client_test_remote_cap(rcc, SPICE_MAIN_CAP_SEAMLESS_MIGRATE)); if (red_client_during_migrate_at_target(client)) { - spice_printerr("client %p: wait till previous migration completes", client); + spice_debug("client %p: wait till previous migration completes", client); mcc->priv->mig_wait_prev_complete = TRUE; mcc->priv->mig_wait_prev_try_seamless = TRUE; } else { @@ -889,7 +889,7 @@ static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelC MainChannel *main_ch; const RedsMigSpice *mig_target; - spice_printerr(""); + spice_debug(NULL); red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST); main_ch = MAIN_CHANNEL(channel); mig_target = main_channel_get_migration_target(main_ch); @@ -930,9 +930,9 @@ void main_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *base) if (!mcc->priv->init_sent && !mcc->priv->seamless_mig_dst && base->type != RED_PIPE_ITEM_TYPE_MAIN_INIT) { - spice_printerr("Init msg for client %p was not sent yet " - "(client is probably during semi-seamless migration). Ignoring msg type %d", - red_channel_client_get_client(rcc), base->type); + spice_warning("Init msg for client %p was not sent yet " + "(client is probably during semi-seamless migration). Ignoring msg type %d", + red_channel_client_get_client(rcc), base->type); return; } switch (base->type) { diff --git a/server/main-channel.c b/server/main-channel.c index e9fef7c..96e2213 100644 --- a/server/main-channel.c +++ b/server/main-channel.c @@ -55,7 +55,7 @@ int main_channel_is_connected(MainChannel *main_chan) static void main_channel_client_on_disconnect(RedChannelClient *rcc) { RedsState *reds = red_channel_get_server(red_channel_client_get_channel(rcc)); - spice_printerr("rcc=%p", rcc); + spice_debug("rcc=%p", rcc); main_dispatcher_client_disconnect(reds_get_main_dispatcher(reds), red_channel_client_get_client(rcc)); } @@ -78,8 +78,8 @@ static void main_channel_push_channels(MainChannelClient *mcc) { RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc); if (red_client_during_migrate_at_target(red_channel_client_get_client(rcc))) { - spice_printerr("warning: ignoring unexpected SPICE_MSGC_MAIN_ATTACH_CHANNELS" - "during migration"); + spice_warning("warning: ignoring unexpected SPICE_MSGC_MAIN_ATTACH_CHANNELS" + "during migration"); return; } red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST); @@ -133,7 +133,7 @@ static bool main_channel_handle_migrate_data(RedChannelClient *rcc, spice_assert(red_channel_get_n_clients(channel) == 1); if (size < sizeof(SpiceMigrateDataHeader) + sizeof(SpiceMigrateDataMain)) { - spice_printerr("bad message size %u", size); + spice_warning("bad message size %u", size); return FALSE; } if (!migration_protocol_validate_header(header, @@ -190,7 +190,7 @@ static bool main_channel_handle_message(RedChannelClient *rcc, uint16_t type, case SPICE_MSGC_MAIN_AGENT_START: { SpiceMsgcMainAgentStart *tokens; - spice_printerr("agent start"); + spice_debug("agent start"); if (!main_chan) { return FALSE; } @@ -266,7 +266,7 @@ MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client, // TODO - migration - I removed it from channel creation, now put it // into usage somewhere (not an issue until we return migration to it's // former glory) - spice_printerr("add main channel client"); + spice_debug("add main channel client"); mcc = main_channel_client_create(channel, client, stream, connection_id, caps); return mcc; } @@ -398,10 +398,10 @@ int main_channel_migrate_src_complete(MainChannel *main_chan, int success) int semi_seamless_count = 0; RedChannelClient *rcc; - spice_printerr(""); + spice_debug(NULL); if (!red_channel_get_clients(RED_CHANNEL(main_chan))) { - spice_printerr("no peer connected"); + spice_warning("no peer connected"); return 0; } diff --git a/server/net-utils.c b/server/net-utils.c index 06fb8b1..7e9bcee 100644 --- a/server/net-utils.c +++ b/server/net-utils.c @@ -44,7 +44,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout) if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) == -1) { if (errno != ENOTSUP) { - spice_printerr("setsockopt for keepalive failed, %s", strerror(errno)); + spice_warning("setsockopt for keepalive failed, %s", strerror(errno)); return false; } } @@ -56,7 +56,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout) #ifdef HAVE_TCP_KEEPIDLE if (setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) { if (errno != ENOTSUP) { - spice_printerr("setsockopt for keepalive timeout failed, %s", strerror(errno)); + spice_warning("setsockopt for keepalive timeout failed, %s", strerror(errno)); return false; } } diff --git a/server/red-channel-client.c b/server/red-channel-client.c index f1042dd..e79d16f 100644 --- a/server/red-channel-client.c +++ b/server/red-channel-client.c @@ -690,7 +690,7 @@ static void red_channel_client_ping_timer(void *opaque) /* retrieving the occupied size of the socket's tcp snd buffer (unacked + unsent) */ if (ioctl(rcc->priv->stream->socket, SIOCOUTQ, &so_unsent_size) == -1) { - spice_printerr("ioctl(SIOCOUTQ) failed, %s", strerror(errno)); + spice_warning("ioctl(SIOCOUTQ) failed, %s", strerror(errno)); } if (so_unsent_size > 0) { /* tcp snd buffer is still occupied. rescheduling ping */ @@ -1072,7 +1072,7 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc) red_channel_client_disconnect(rcc); return; default: - spice_printerr("%s", strerror(errno)); + spice_warning("%s", strerror(errno)); red_channel_client_disconnect(rcc); return; } @@ -1114,7 +1114,7 @@ static int red_peer_receive(RedsStream *stream, uint8_t *buf, uint32_t size) } else if (errno == EPIPE) { return -1; } else { - spice_printerr("%s", strerror(errno)); + spice_warning("%s", strerror(errno)); return -1; } } else { @@ -1193,7 +1193,7 @@ static void red_channel_client_handle_incoming(RedChannelClient *rcc) if (!buffer->msg) { buffer->msg = red_channel_client_alloc_msg_buf(rcc, msg_type, msg_size); if (buffer->msg == NULL) { - spice_printerr("ERROR: channel refused to allocate buffer."); + spice_warning("ERROR: channel refused to allocate buffer."); red_channel_client_disconnect(rcc); return; } @@ -1221,7 +1221,7 @@ static void red_channel_client_handle_incoming(RedChannelClient *rcc) msg_type, &parsed_size, &parsed_free); if (parsed == NULL) { - spice_printerr("failed to parse message type %d", msg_type); + spice_warning("failed to parse message type %d", msg_type); red_channel_client_release_msg_buf(rcc, msg_type, msg_size, buffer->msg); @@ -1287,7 +1287,7 @@ void red_channel_client_push(RedChannelClient *rcc) if (!red_channel_client_no_item_being_sent(rcc) && !red_channel_client_is_blocked(rcc)) { red_channel_client_set_blocked(rcc); - spice_printerr("ERROR: an item waiting to be sent and not blocked"); + spice_warning("ERROR: an item waiting to be sent and not blocked"); } while ((pipe_item = red_channel_client_pipe_item_get(rcc))) { @@ -1414,7 +1414,7 @@ bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type, switch (type) { case SPICE_MSGC_ACK_SYNC: if (size != sizeof(uint32_t)) { - spice_printerr("bad message size"); + spice_warning("bad message size"); return FALSE; } rcc->priv->ack_data.client_generation = *(uint32_t *)(message); @@ -1442,7 +1442,7 @@ bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type, red_channel_client_handle_pong(rcc, message); break; default: - spice_printerr("invalid message type %u", type); + spice_warning("invalid message type %u", type); return FALSE; } return TRUE; @@ -1461,7 +1461,7 @@ void red_channel_client_begin_send_message(RedChannelClient *rcc) // TODO - better check: type in channel_allowed_types. Better: type in channel_allowed_types(channel_state) if (rcc->priv->send_data.header.get_msg_type(&rcc->priv->send_data.header) == 0) { - spice_printerr("BUG: header->type == 0"); + spice_warning("BUG: header->type == 0"); return; } @@ -1675,8 +1675,8 @@ void red_channel_client_disconnect(RedChannelClient *rcc) return; } g_object_get(channel, "channel-type", &type, "id", &id, NULL); - spice_printerr("rcc=%p (channel=%p type=%d id=%d)", rcc, channel, - type, id); + spice_debug("rcc=%p (channel=%p type=%d id=%d)", rcc, channel, + type, id); red_channel_client_pipe_clear(rcc); if (rcc->priv->stream->watch) { core->watch_remove(core, rcc->priv->stream->watch); diff --git a/server/red-client.c b/server/red-client.c index 6dd1860..264f1c9 100644 --- a/server/red-client.c +++ b/server/red-client.c @@ -177,7 +177,7 @@ void red_client_migrate(RedClient *client) RedChannelClient *rcc; RedChannel *channel; - spice_printerr("migrate client with #channels %d", g_list_length(client->channels)); + spice_debug("migrate client with #channels %d", g_list_length(client->channels)); if (!pthread_equal(pthread_self(), client->thread_id)) { spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)." "If one of the threads is != io-thread && != vcpu-thread," @@ -197,7 +197,7 @@ void red_client_destroy(RedClient *client) GListIter iter; RedChannelClient *rcc; - spice_printerr("destroy client %p with #channels=%d", client, g_list_length(client->channels)); + spice_debug("destroy client %p with #channels=%d", client, g_list_length(client->channels)); if (!pthread_equal(pthread_self(), client->thread_id)) { spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)." "If one of the threads is != io-thread && != vcpu-thread," diff --git a/server/red-qxl.c b/server/red-qxl.c index 53f3338..9447d6b 100644 --- a/server/red-qxl.c +++ b/server/red-qxl.c @@ -105,7 +105,7 @@ static void red_qxl_disconnect_display_peer(RedChannelClient *rcc) dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher"); - spice_printerr(""); + spice_debug(NULL); payload.rcc = rcc; // TODO: we turned it to be sync, due to client_destroy . Should we support async? - for this we will need ref count @@ -127,7 +127,7 @@ static void red_qxl_display_migrate(RedChannelClient *rcc) } g_object_get(channel, "channel-type", &type, "id", &id, NULL); dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher"); - spice_printerr("channel type %u id %u", type, id); + spice_debug("channel type %u id %u", type, id); payload.rcc = rcc; dispatcher_send_message(dispatcher, RED_WORKER_MESSAGE_DISPLAY_MIGRATE, @@ -140,7 +140,7 @@ static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, Reds { RedWorkerMessageCursorConnect payload = {0,}; Dispatcher *dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher"); - spice_printerr(""); + spice_debug(NULL); payload.client = client; payload.stream = stream; payload.migration = migration; @@ -162,7 +162,7 @@ static void red_qxl_disconnect_cursor_peer(RedChannelClient *rcc) } dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher"); - spice_printerr(""); + spice_debug(NULL); payload.rcc = rcc; dispatcher_send_message(dispatcher, @@ -182,7 +182,7 @@ static void red_qxl_cursor_migrate(RedChannelClient *rcc) } g_object_get(channel, "channel-type", &type, "id", &id, NULL); dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher"); - spice_printerr("channel type %u id %u", type, id); + spice_debug("channel type %u id %u", type, id); payload.rcc = rcc; dispatcher_send_message(dispatcher, RED_WORKER_MESSAGE_CURSOR_MIGRATE, @@ -638,7 +638,7 @@ static void red_qxl_loadvm_commands(QXLState *qxl_state, { RedWorkerMessageLoadvmCommands payload; - spice_printerr(""); + spice_debug(NULL); payload.count = count; payload.ext = ext; dispatcher_send_message(qxl_state->dispatcher, diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c index 6915f00..77699a8 100644 --- a/server/red-replay-qxl.c +++ b/server/red-replay-qxl.c @@ -474,7 +474,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags) } else { size = red_replay_data_chunks(replay, "bitmap.data", (uint8_t**)&qxl->bitmap.data, 0); if (size != bitmap_size) { - spice_printerr("bad image, %zu != %zu", size, bitmap_size); + spice_warning("bad image, %zu != %zu", size, bitmap_size); return NULL; } } @@ -1135,7 +1135,7 @@ static QXLSurfaceCmd *red_replay_surface_cmd(SpiceReplay *replay) if ((qxl->flags & QXL_SURF_FLAG_KEEP_DATA) != 0) { read_binary(replay, "data", &read_size, (uint8_t**)&qxl->u.surface_create.data, 0); if (read_size != size) { - spice_printerr("mismatch %zu != %zu", size, read_size); + spice_warning("mismatch %zu != %zu", size, read_size); } } else { qxl->u.surface_create.data = QXLPHYSICAL_FROM_PTR(replay_malloc(replay, size)); @@ -1238,7 +1238,7 @@ static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay) uint8_t *mem = NULL; if (replay->created_primary) { - spice_printerr( + spice_warning( "WARNING: %d: original recording event not preceded by a destroy primary", replay->counter); worker->destroy_primary_surface(worker, 0); diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c index e934b2e..3a7256f 100644 --- a/server/smartcard-channel-client.c +++ b/server/smartcard-channel-client.c @@ -316,8 +316,8 @@ bool smartcard_channel_client_handle_message(RedChannelClient *rcc, /* todo: fix */ if (vheader->reader_id >= smartcard_get_n_readers()) { - spice_printerr("ERROR: received message for non existing reader: %d, %d, %d", vheader->reader_id, - vheader->type, vheader->length); + spice_warning("ERROR: received message for non existing reader: %d, %d, %d", vheader->reader_id, + vheader->type, vheader->length); return FALSE; } spice_assert(scc->priv->write_buf->buf == msg); diff --git a/server/smartcard.c b/server/smartcard.c index ac2fc1e..1a5e3df 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -213,7 +213,7 @@ static void smartcard_remove_client(RedCharDevice *self, RedClient *client) RedCharDeviceSmartcard *dev = RED_CHAR_DEVICE_SMARTCARD(self); RedChannelClient *rcc = RED_CHANNEL_CLIENT(dev->priv->scc); - spice_printerr("smartcard dev %p, client %p", dev, client); + spice_debug("smartcard dev %p, client %p", dev, client); spice_assert(dev->priv->scc && red_channel_client_get_client(rcc) == client); red_channel_client_shutdown(rcc); @@ -236,7 +236,7 @@ RedMsgItem *smartcard_char_device_on_message_from_device(RedCharDeviceSmartcard } /* We pass any VSC_Error right now - might need to ignore some? */ if (dev->priv->reader_id == VSCARD_UNDEFINED_READER_ID && vheader->type != VSC_Init) { - spice_printerr("error: reader_id not assigned for message of type %d", vheader->type); + spice_warning("error: reader_id not assigned for message of type %d", vheader->type); } if (dev->priv->scc) { sent_header = spice_memdup(vheader, sizeof(*vheader) + vheader->length); @@ -545,7 +545,7 @@ static void smartcard_connect_client(RedChannel *channel, RedClient *client, if (char_device) { smartcard_char_device_attach_client(char_device, scc); } else { - spice_printerr("char dev unavailable"); + spice_warning("char dev unavailable"); } } diff --git a/server/sound.c b/server/sound.c index be7e607..38b2bc2 100644 --- a/server/sound.c +++ b/server/sound.c @@ -354,12 +354,12 @@ record_channel_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t siz SND_CODEC_DECODE) == SND_CODEC_OK) { record_client->mode = mode->mode; } else { - spice_printerr("create decoder failed"); + spice_warning("create decoder failed"); return false; } } else { - spice_printerr("unsupported mode %d", record_client->mode); + spice_warning("unsupported mode %d", record_client->mode); return false; } } @@ -599,7 +599,7 @@ static bool snd_playback_send_write(PlaybackChannelClient *playback_client) if (snd_codec_encode(playback_client->codec, (uint8_t *) frame->samples, snd_codec_frame_size(playback_client->codec) * sizeof(frame->samples[0]), playback_client->encode_buf, &n) != SND_CODEC_OK) { - spice_printerr("encode failed"); + spice_warning("encode failed"); red_channel_client_disconnect(rcc); return false; } @@ -686,7 +686,7 @@ static void playback_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedP if (snd_playback_send_write(playback_client)) { break; } - spice_printerr("snd_send_playback_write failed"); + spice_warning("snd_send_playback_write failed"); } if (client->command & SND_CTRL_MASK) { client->command &= ~SND_CTRL_MASK; @@ -772,7 +772,7 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc) if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) == -1) { if (errno != ENOTSUP) { - spice_printerr("setsockopt failed, %s", strerror(errno)); + spice_warning("setsockopt failed, %s", strerror(errno)); } } #endif @@ -780,7 +780,7 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc) tos = IPTOS_LOWDELAY; if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) { if (errno != ENOTSUP) { - spice_printerr("setsockopt failed, %s", strerror(errno)); + spice_warning("setsockopt failed, %s", strerror(errno)); } } @@ -1068,7 +1068,7 @@ playback_channel_client_constructed(GObject *object) SND_CODEC_ENCODE) == SND_CODEC_OK) { playback_client->mode = desired_mode; } else { - spice_printerr("create encoder failed"); + spice_warning("create encoder failed"); } } diff --git a/server/spicevmc.c b/server/spicevmc.c index 34d5c6e..1c9bb7c 100644 --- a/server/spicevmc.c +++ b/server/spicevmc.c @@ -460,7 +460,7 @@ static void spicevmc_char_dev_send_tokens_to_client(RedCharDevice *self, RedClient *client, uint32_t tokens) { - spice_printerr("Not implemented!"); + spice_warning("Not implemented!"); } static void spicevmc_char_dev_remove_client(RedCharDevice *self, @@ -469,7 +469,7 @@ static void spicevmc_char_dev_remove_client(RedCharDevice *self, RedCharDeviceSpiceVmc *vmc = RED_CHAR_DEVICE_SPICEVMC(self); RedVmcChannel *channel = RED_VMC_CHANNEL(vmc->channel); - spice_printerr("vmc channel %p, client %p", channel, client); + spice_debug("vmc channel %p, client %p", channel, client); spice_assert(channel->rcc && red_channel_client_get_client(channel->rcc) == client); @@ -491,8 +491,8 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc) if (red_char_device_client_exists(channel->chardev, client)) { red_char_device_client_remove(channel->chardev, client); } else { - spice_printerr("client %p have already been removed from char dev %p", - client, channel->chardev); + spice_warning("client %p have already been removed from char dev %p", + client, channel->chardev); } } @@ -808,8 +808,8 @@ static void spicevmc_connect(RedChannel *channel, RedClient *client, g_object_get(channel, "channel-type", &type, "id", &id, NULL); if (vmc_channel->rcc) { - spice_printerr("channel client %d:%d (%p) already connected, refusing second connection", - type, id, vmc_channel->rcc); + spice_warning("channel client %d:%d (%p) already connected, refusing second connection", + type, id, vmc_channel->rcc); // TODO: notify client in advance about the in use channel using // SPICE_MSG_MAIN_CHANNEL_IN_USE (for example) reds_stream_free(stream); diff --git a/server/zlib-encoder.c b/server/zlib-encoder.c index 1579ed7..6645443 100644 --- a/server/zlib-encoder.c +++ b/server/zlib-encoder.c @@ -51,7 +51,7 @@ ZlibEncoder* zlib_encoder_create(ZlibEncoderUsrContext *usr, int level) z_ret = deflateInit(&enc->strm, level); enc->last_level = level; if (z_ret != Z_OK) { - spice_printerr("zlib error"); + spice_warning("zlib error"); free(enc); return NULL; } -- 2.9.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel