[Spice-devel] [spice-server v5 4/5] Change some spice_printerr() to spice_debug()

Christophe Fergeau cfergeau at redhat.com
Tue Feb 28 12:21:55 UTC 2017


Some debug messages were using spice_printerr(), which should be limited
to actual errors.

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 server/inputs-channel.c      |  4 ++--
 server/main-channel-client.c | 28 ++++++++++++++--------------
 server/main-channel.c        | 10 +++++-----
 server/red-channel-client.c  |  4 ++--
 server/red-client.c          |  4 ++--
 server/red-qxl.c             | 12 ++++++------
 server/smartcard.c           |  2 +-
 server/spicevmc.c            |  2 +-
 8 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index ed92e71..33520b5 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -496,7 +496,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, FALSE,
                                        num_common_caps, common_caps,
                                        num_caps, caps);
@@ -693,7 +693,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 6aace29..feea3ad 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -445,7 +445,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);
@@ -455,7 +455,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);
         }
@@ -517,11 +517,11 @@ 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(RED_CHANNEL_CLIENT(mcc),
                                                          CLIENT_CONNECTIVITY_TIMEOUT);
         break;
@@ -588,18 +588,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);
         }
@@ -615,7 +615,7 @@ static void do_ping_client(MainChannelClient *mcc,
     const char *opt, int has_interval, int interval)
 {
     RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
-    spice_printerr("");
+    spice_debug(NULL);
     if (!opt) {
         main_channel_client_push_ping(mcc, 0);
     } else if (!strcmp(opt, "on")) {
@@ -722,7 +722,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 {
@@ -743,7 +743,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 {
@@ -950,7 +950,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);
diff --git a/server/main-channel.c b/server/main-channel.c
index 3a6e6cd..7e4a4ec 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -60,7 +60,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));
 }
@@ -84,7 +84,7 @@ 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");
+                       "during migration");
         return;
     }
     red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(mcc), RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
@@ -191,7 +191,7 @@ static int 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;
         }
@@ -297,7 +297,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,
                                      num_common_caps, common_caps,
                                      num_caps, caps);
@@ -433,7 +433,7 @@ 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");
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index cd4b64e..c6e2851 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1770,8 +1770,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 de40acf..2918911 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 b6b3770..3c71075 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -112,7 +112,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
@@ -134,7 +134,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,
@@ -148,7 +148,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;
@@ -176,7 +176,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,
@@ -196,7 +196,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,
@@ -652,7 +652,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/smartcard.c b/server/smartcard.c
index 8f12fd9..4bc1eec 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);
diff --git a/server/spicevmc.c b/server/spicevmc.c
index e705bc7..cc88344 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -433,7 +433,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);
 
-- 
2.9.3



More information about the Spice-devel mailing list