[Spice-commits] 4 commits - server/reds.c server/red_worker.c spice-common

Alon Levy alon at kemper.freedesktop.org
Sun Jul 8 06:53:22 PDT 2012


 server/red_worker.c |  130 +++++++++++-----------
 server/reds.c       |  294 +++++++++++++++++++++++++---------------------------
 spice-common        |    2 
 3 files changed, 212 insertions(+), 214 deletions(-)

New commits:
commit d2c99b59b0bd6205e86353b13e70dd654feeab04
Author: Alon Levy <alevy at redhat.com>
Date:   Thu Jul 5 19:38:30 2012 +0300

    server/reds.c: spice_printerr cleanup
    
    Rules for replacing spice_printerr:
    * if it's a client drop / agent drop, spice_error
    * if it's important, spice_warning
    * else, spice_info.
    
    The fourth rule is spice_debug if it's going to fill up the log, but
    nothing of the sort here.
    
    Other things this patch does:
    * changed reds_show_new_channel to reds_info_new_channel in an attempt to
    advertise it doesn't always show anything, unless SPICE_DEBUG_LOG_LEVEL
    >= SPICE_DEVUG_LOG_INFO (==3)
    * removes two lines of whitespace.
    * added "crashy" to multiple client warning (only warning introduced,
      the rest are errors).

diff --git a/server/reds.c b/server/reds.c
index 9488237..c8b5fc4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -547,7 +547,7 @@ void reds_unregister_channel(RedChannel *channel)
         ring_remove(&channel->link);
         reds->num_of_channels--;
     } else {
-        spice_printerr("not found");
+        spice_error("not found");
     }
 }
 
@@ -634,7 +634,7 @@ void reds_client_disconnect(RedClient *client)
         return;
     }
 
-    spice_printerr("");
+    spice_info(NULL);
     /* disconnecting is set to prevent recursion because of the following:
      * main_channel_client_on_disconnect->
      *  reds_client_disconnect->red_client_destroy->main_channel...
@@ -683,7 +683,7 @@ static void reds_disconnect(void)
 {
     RingItem *link, *next;
 
-    spice_printerr("");
+    spice_info(NULL);
     RING_FOREACH_SAFE(link, next, &reds->clients) {
         reds_client_disconnect(SPICE_CONTAINEROF(link, RedClient, link));
     }
@@ -789,7 +789,7 @@ static int vdi_port_read_buf_process(int port, VDIReadBuf *buf)
     case VDP_SERVER_PORT:
         return FALSE;
     default:
-        spice_printerr("invalid port");
+        spice_error("invalid port");
         reds_agent_remove();
         return FALSE;
     }
@@ -1037,7 +1037,7 @@ void reds_fill_channels(SpiceMsgChannels *channels_info)
 
     channels_info->num_of_channels = used_channels;
     if (used_channels != reds->num_of_channels) {
-        spice_printerr("sent %d out of %d", used_channels, reds->num_of_channels);
+        spice_error("sent %d out of %d", used_channels, reds->num_of_channels);
     }
 }
 
@@ -1160,14 +1160,14 @@ void reds_on_main_mouse_mode_request(void *message, size_t size)
         if (reds->is_client_mouse_allowed) {
             reds_set_mouse_mode(SPICE_MOUSE_MODE_CLIENT);
         } else {
-            spice_printerr("client mouse is disabled");
+            spice_info("client mouse is disabled");
         }
         break;
     case SPICE_MOUSE_MODE_SERVER:
         reds_set_mouse_mode(SPICE_MOUSE_MODE_SERVER);
         break;
     default:
-        spice_printerr("unsupported mouse mode");
+        spice_error("unsupported mouse mode");
     }
 }
 
@@ -1249,12 +1249,12 @@ static int reds_send_link_ack(RedLinkInfo *link)
     ack.caps_offset = sizeof(SpiceLinkReply);
 
     if (!(link->tiTicketing.rsa = RSA_new())) {
-        spice_printerr("RSA nes failed");
+        spice_error("RSA nes failed");
         return FALSE;
     }
 
     if (!(bio = BIO_new(BIO_s_mem()))) {
-        spice_printerr("BIO new failed");
+        spice_error("BIO new failed");
         return FALSE;
     }
 
@@ -1297,9 +1297,9 @@ static int reds_send_link_error(RedLinkInfo *link, uint32_t error)
                                                                          sizeof(reply));
 }
 
-static void reds_show_new_channel(RedLinkInfo *link, int connection_id)
+static void reds_info_new_channel(RedLinkInfo *link, int connection_id)
 {
-    spice_printerr("channel %d:%d, connected successfully, over %s link",
+    spice_info("channel %d:%d, connected successfully, over %s link",
                link->link_mess->channel_type,
                link->link_mess->channel_id,
                link->stream->ssl == NULL ? "Non Secure" : "Secure");
@@ -1320,7 +1320,7 @@ static void reds_send_link_result(RedLinkInfo *link, uint32_t error)
 
 int reds_expects_link_id(uint32_t connection_id)
 {
-    spice_printerr("TODO: keep a list of connection_id's from migration, compare to them");
+    spice_info("TODO: keep a list of connection_id's from migration, compare to them");
     return 1;
 }
 
@@ -1329,7 +1329,7 @@ static void reds_mig_target_client_add(RedClient *client)
     RedsMigTargetClient *mig_client;
 
     spice_assert(reds);
-    spice_printerr("");
+    spice_info(NULL);
     mig_client = spice_malloc0(sizeof(RedsMigTargetClient));
     mig_client->client = client;
     ring_init(&mig_client->pending_links);
@@ -1405,7 +1405,7 @@ static void reds_handle_main_link(RedLinkInfo *link)
     MainChannelClient *mcc;
     int mig_target = FALSE;
 
-    spice_printerr("");
+    spice_info(NULL);
     spice_assert(reds->main_channel);
 
     link_mess = link->link_mess;
@@ -1429,7 +1429,7 @@ static void reds_handle_main_link(RedLinkInfo *link)
     reds->mig_wait_connect = FALSE;
     reds->mig_wait_disconnect = FALSE;
 
-    reds_show_new_channel(link, connection_id);
+    reds_info_new_channel(link, connection_id);
     stream = link->stream;
     reds_stream_remove_watch(stream);
     link->stream = NULL;
@@ -1444,7 +1444,7 @@ static void reds_handle_main_link(RedLinkInfo *link)
                             link_mess->num_common_caps,
                             link_mess->num_common_caps ? caps : NULL, link_mess->num_channel_caps,
                             link_mess->num_channel_caps ? caps + link_mess->num_common_caps : NULL);
-    spice_printerr("NEW Client %p mcc %p connect-id %d", client, mcc, connection_id);
+    spice_info("NEW Client %p mcc %p connect-id %d", client, mcc, connection_id);
     free(link_mess);
     red_client_set_main(client, mcc);
 
@@ -1534,11 +1534,11 @@ void reds_on_client_migrate_complete(RedClient *client)
     MainChannelClient *mcc;
     RingItem *item;
 
-    spice_printerr("%p", client);
+    spice_info("%p", client);
     mcc = red_client_get_main(client);
     mig_client = reds_mig_target_client_find(client);
     if (!mig_client) {
-        spice_printerr("Error: mig target client was not found");
+        spice_error("mig target client was not found");
         return;
     }
 
@@ -1556,10 +1556,10 @@ void reds_on_client_migrate_complete(RedClient *client)
         channel = reds_find_channel(mig_link->link_msg->channel_type,
                                     mig_link->link_msg->channel_id);
         if (!channel) {
-            spice_printerr("warning: client %p channel (%d, %d) (type, id) wasn't found",
-                       client,
-                       mig_link->link_msg->channel_type,
-                       mig_link->link_msg->channel_id);
+            spice_error("client %p channel (%d, %d) (type, id) wasn't found",
+                        client,
+                        mig_link->link_msg->channel_type,
+                        mig_link->link_msg->channel_id);
             continue;
         }
         reds_channel_do_link(channel, client, mig_link->link_msg, mig_link->stream);
@@ -1599,7 +1599,7 @@ static void reds_handle_other_links(RedLinkInfo *link)
     }
 
     reds_send_link_result(link, SPICE_LINK_ERR_OK);
-    reds_show_new_channel(link, link_mess->connection_id);
+    reds_info_new_channel(link, link_mess->connection_id);
     reds_stream_remove_watch(link->stream);
 
     mig_client = reds_mig_target_client_find(client);
@@ -1642,17 +1642,17 @@ static void reds_handle_ticket(void *opaque)
 
         if (strlen(taTicket.password) == 0) {
             reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
-            spice_printerr("Ticketing is enabled, but no password is set. "
-                       "please set a ticket first");
+            spice_error("Ticketing is enabled, but no password is set. "
+                        "please set a ticket first");
             reds_link_free(link);
             return;
         }
 
         if (expired || strncmp(password, taTicket.password, SPICE_MAX_PASSWORD_LENGTH) != 0) {
             if (expired) {
-                spice_printerr("Ticket has expired");
+                spice_error("Ticket has expired");
             } else {
-                spice_printerr("Invalid password");
+                spice_error("Invalid password");
             }
             reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
             reds_link_free(link);
@@ -1693,7 +1693,7 @@ static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nby
                           (const char **)&s->sasl.encoded,
                           &s->sasl.encodedLength);
         if (err != SASL_OK) {
-            spice_printerr("sasl_encode error: %d", err);
+            spice_error("sasl_encode error: %d", err);
             return -1;
         }
 
@@ -1702,7 +1702,7 @@ static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nby
         }
 
         if (!s->sasl.encoded) {
-            spice_printerr("sasl_encode didn't return a buffer!");
+            spice_error("sasl_encode didn't return a buffer!");
             return 0;
         }
 
@@ -1754,7 +1754,7 @@ static ssize_t reds_stream_sasl_read(RedsStream *s, uint8_t *buf, size_t nbyte)
                       (char *)encoded, n,
                       &decoded, &decodedlen);
     if (err != SASL_OK) {
-        spice_printerr("sasl_decode error: %d", err);
+        spice_error("sasl_decode error: %d", err);
         return -1;
     }
 
@@ -1836,8 +1836,8 @@ static char *addr_to_string(const char *format,
                            host, sizeof(host),
                            serv, sizeof(serv),
                            NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
-        spice_printerr("Cannot resolve address %d: %s",
-                   err, gai_strerror(err));
+        spice_error("Cannot resolve address %d: %s",
+                    err, gai_strerror(err));
         return NULL;
     }
 
@@ -1867,7 +1867,7 @@ static int auth_sasl_check_ssf(RedsSASL *sasl, int *runSSF)
     }
 
     ssf = *(const int *)val;
-    spice_printerr("negotiated an SSF of %d", ssf);
+    spice_info("negotiated an SSF of %d", ssf);
     if (ssf < 56) {
         return 0; /* 56 is good for Kerberos */
     }
@@ -1914,7 +1914,7 @@ static void reds_handle_auth_sasl_step(void *opaque)
         datalen--; /* Don't count NULL byte when passing to _start() */
     }
 
-    spice_printerr("Step using SASL Data %p (%d bytes)",
+    spice_info("Step using SASL Data %p (%d bytes)",
                clientdata, datalen);
     err = sasl_server_step(sasl->conn,
                            clientdata,
@@ -1923,18 +1923,18 @@ static void reds_handle_auth_sasl_step(void *opaque)
                            &serveroutlen);
     if (err != SASL_OK &&
         err != SASL_CONTINUE) {
-        spice_printerr("sasl step failed %d (%s)",
-                   err, sasl_errdetail(sasl->conn));
+        spice_error("sasl step failed %d (%s)",
+                    err, sasl_errdetail(sasl->conn));
         goto authabort;
     }
 
     if (serveroutlen > SASL_DATA_MAX_LEN) {
-        spice_printerr("sasl step reply data too long %d",
-                   serveroutlen);
+        spice_error("sasl step reply data too long %d",
+                    serveroutlen);
         goto authabort;
     }
 
-    spice_printerr("SASL return data %d bytes, %p", serveroutlen, serverout);
+    spice_info("SASL return data %d bytes, %p", serveroutlen, serverout);
 
     if (serveroutlen) {
         serveroutlen += 1;
@@ -1948,7 +1948,7 @@ static void reds_handle_auth_sasl_step(void *opaque)
     sync_write_u8(link->stream, err == SASL_CONTINUE ? 0 : 1);
 
     if (err == SASL_CONTINUE) {
-        spice_printerr("%s", "Authentication must continue (step)");
+        spice_info("%s", "Authentication must continue (step)");
         /* Wait for step length */
         obj->now = (uint8_t *)&sasl->len;
         obj->end = obj->now + sizeof(uint32_t);
@@ -1958,11 +1958,11 @@ static void reds_handle_auth_sasl_step(void *opaque)
         int ssf;
 
         if (auth_sasl_check_ssf(sasl, &ssf) == 0) {
-            spice_printerr("Authentication rejected for weak SSF");
+            spice_error("Authentication rejected for weak SSF");
             goto authreject;
         }
 
-        spice_printerr("Authentication successful");
+        spice_info("Authentication successful");
         sync_write_u32(link->stream, SPICE_LINK_ERR_OK); /* Accept auth */
 
         /*
@@ -1992,9 +1992,9 @@ static void reds_handle_auth_sasl_steplen(void *opaque)
     AsyncRead *obj = &link->asyc_read;
     RedsSASL *sasl = &link->stream->sasl;
 
-    spice_printerr("Got steplen %d", sasl->len);
+    spice_info("Got steplen %d", sasl->len);
     if (sasl->len > SASL_DATA_MAX_LEN) {
-        spice_printerr("Too much SASL data %d", sasl->len);
+        spice_error("Too much SASL data %d", sasl->len);
         reds_link_free(link);
         return;
     }
@@ -2044,8 +2044,8 @@ static void reds_handle_auth_sasl_start(void *opaque)
         datalen--; /* Don't count NULL byte when passing to _start() */
     }
 
-    spice_printerr("Start SASL auth with mechanism %s. Data %p (%d bytes)",
-              sasl->mechlist, clientdata, datalen);
+    spice_info("Start SASL auth with mechanism %s. Data %p (%d bytes)",
+               sasl->mechlist, clientdata, datalen);
     err = sasl_server_start(sasl->conn,
                             sasl->mechlist,
                             clientdata,
@@ -2054,18 +2054,18 @@ static void reds_handle_auth_sasl_start(void *opaque)
                             &serveroutlen);
     if (err != SASL_OK &&
         err != SASL_CONTINUE) {
-        spice_printerr("sasl start failed %d (%s)",
-                   err, sasl_errdetail(sasl->conn));
+        spice_error("sasl start failed %d (%s)",
+                    err, sasl_errdetail(sasl->conn));
         goto authabort;
     }
 
     if (serveroutlen > SASL_DATA_MAX_LEN) {
-        spice_printerr("sasl start reply data too long %d",
-                   serveroutlen);
+        spice_error("sasl start reply data too long %d",
+                    serveroutlen);
         goto authabort;
     }
 
-    spice_printerr("SASL return data %d bytes, %p", serveroutlen, serverout);
+    spice_info("SASL return data %d bytes, %p", serveroutlen, serverout);
 
     if (serveroutlen) {
         serveroutlen += 1;
@@ -2079,7 +2079,7 @@ static void reds_handle_auth_sasl_start(void *opaque)
     sync_write_u8(link->stream, err == SASL_CONTINUE ? 0 : 1);
 
     if (err == SASL_CONTINUE) {
-        spice_printerr("%s", "Authentication must continue (start)");
+        spice_info("%s", "Authentication must continue (start)");
         /* Wait for step length */
         obj->now = (uint8_t *)&sasl->len;
         obj->end = obj->now + sizeof(uint32_t);
@@ -2089,11 +2089,11 @@ static void reds_handle_auth_sasl_start(void *opaque)
         int ssf;
 
         if (auth_sasl_check_ssf(sasl, &ssf) == 0) {
-            spice_printerr("Authentication rejected for weak SSF");
+            spice_error("Authentication rejected for weak SSF");
             goto authreject;
         }
 
-        spice_printerr("Authentication successful");
+        spice_info("Authentication successful");
         sync_write_u32(link->stream, SPICE_LINK_ERR_OK); /* Accept auth */
 
         /*
@@ -2123,9 +2123,9 @@ static void reds_handle_auth_startlen(void *opaque)
     AsyncRead *obj = &link->asyc_read;
     RedsSASL *sasl = &link->stream->sasl;
 
-    spice_printerr("Got client start len %d", sasl->len);
+    spice_info("Got client start len %d", sasl->len);
     if (sasl->len > SASL_DATA_MAX_LEN) {
-        spice_printerr("Too much SASL data %d", sasl->len);
+        spice_error("Too much SASL data %d", sasl->len);
         reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
         reds_link_free(link);
         return;
@@ -2150,24 +2150,24 @@ static void reds_handle_auth_mechname(void *opaque)
     RedsSASL *sasl = &link->stream->sasl;
 
     sasl->mechname[sasl->len] = '\0';
-    spice_printerr("Got client mechname '%s' check against '%s'",
+    spice_info("Got client mechname '%s' check against '%s'",
                sasl->mechname, sasl->mechlist);
 
     if (strncmp(sasl->mechlist, sasl->mechname, sasl->len) == 0) {
         if (sasl->mechlist[sasl->len] != '\0' &&
             sasl->mechlist[sasl->len] != ',') {
-            spice_printerr("One %d", sasl->mechlist[sasl->len]);
+            spice_info("One %d", sasl->mechlist[sasl->len]);
             reds_link_free(link);
             return;
         }
     } else {
         char *offset = strstr(sasl->mechlist, sasl->mechname);
-        spice_printerr("Two %p", offset);
+        spice_info("Two %p", offset);
         if (!offset) {
             reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
             return;
         }
-        spice_printerr("Two '%s'", offset);
+        spice_info("Two '%s'", offset);
         if (offset[-1] != ',' ||
             (offset[sasl->len] != '\0'&&
              offset[sasl->len] != ',')) {
@@ -2179,7 +2179,7 @@ static void reds_handle_auth_mechname(void *opaque)
     free(sasl->mechlist);
     sasl->mechlist = spice_strdup(sasl->mechname);
 
-    spice_printerr("Validated mechname '%s'", sasl->mechname);
+    spice_info("Validated mechname '%s'", sasl->mechname);
 
     obj->now = (uint8_t *)&sasl->len;
     obj->end = obj->now + sizeof(uint32_t);
@@ -2196,14 +2196,14 @@ static void reds_handle_auth_mechlen(void *opaque)
     RedsSASL *sasl = &link->stream->sasl;
 
     if (sasl->len < 1 || sasl->len > 100) {
-        spice_printerr("Got bad client mechname len %d", sasl->len);
+        spice_error("Got bad client mechname len %d", sasl->len);
         reds_link_free(link);
         return;
     }
 
     sasl->mechname = spice_malloc(sasl->len + 1);
 
-    spice_printerr("Wait for client mechname");
+    spice_info("Wait for client mechname");
     obj->now = (uint8_t *)sasl->mechname;
     obj->end = obj->now + sasl->len;
     obj->done = reds_handle_auth_mechname;
@@ -2245,8 +2245,8 @@ static void reds_start_auth_sasl(RedLinkInfo *link)
     localAddr = remoteAddr = NULL;
 
     if (err != SASL_OK) {
-        spice_printerr("sasl context setup failed %d (%s)",
-                   err, sasl_errstring(err, NULL, NULL));
+        spice_error("sasl context setup failed %d (%s)",
+                    err, sasl_errstring(err, NULL, NULL));
         sasl->conn = NULL;
         goto error;
     }
@@ -2258,8 +2258,8 @@ static void reds_start_auth_sasl(RedLinkInfo *link)
         ssf = SSL_get_cipher_bits(link->stream->ssl, NULL);
         err = sasl_setprop(sasl->conn, SASL_SSF_EXTERNAL, &ssf);
         if (err != SASL_OK) {
-            spice_printerr("cannot set SASL external SSF %d (%s)",
-                       err, sasl_errstring(err, NULL, NULL));
+            spice_error("cannot set SASL external SSF %d (%s)",
+                        err, sasl_errstring(err, NULL, NULL));
             goto error_dispose;
         }
     } else {
@@ -2286,8 +2286,8 @@ static void reds_start_auth_sasl(RedLinkInfo *link)
 
     err = sasl_setprop(sasl->conn, SASL_SEC_PROPS, &secprops);
     if (err != SASL_OK) {
-        spice_printerr("cannot set SASL security props %d (%s)",
-                   err, sasl_errstring(err, NULL, NULL));
+        spice_error("cannot set SASL security props %d (%s)",
+                    err, sasl_errstring(err, NULL, NULL));
         goto error_dispose;
     }
 
@@ -2300,23 +2300,23 @@ static void reds_start_auth_sasl(RedLinkInfo *link)
                         NULL,
                         NULL);
     if (err != SASL_OK || mechlist == NULL) {
-        spice_printerr("cannot list SASL mechanisms %d (%s)",
-                   err, sasl_errdetail(sasl->conn));
+        spice_error("cannot list SASL mechanisms %d (%s)",
+                    err, sasl_errdetail(sasl->conn));
         goto error_dispose;
     }
 
-    spice_printerr("Available mechanisms for client: '%s'", mechlist);
+    spice_info("Available mechanisms for client: '%s'", mechlist);
 
     sasl->mechlist = spice_strdup(mechlist);
 
     mechlistlen = strlen(mechlist);
     if (!sync_write(link->stream, &mechlistlen, sizeof(uint32_t))
         || !sync_write(link->stream, sasl->mechlist, mechlistlen)) {
-        spice_printerr("SASL mechanisms write error");
+        spice_error("SASL mechanisms write error");
         goto error;
     }
 
-    spice_printerr("Wait for client mechname length");
+    spice_info("Wait for client mechname length");
     obj->now = (uint8_t *)&sasl->len;
     obj->end = obj->now + sizeof(uint32_t);
     obj->done = reds_handle_auth_mechlen;
@@ -2337,7 +2337,7 @@ static void reds_handle_auth_mechanism(void *opaque)
 {
     RedLinkInfo *link = (RedLinkInfo *)opaque;
 
-    spice_printerr("Auth method: %d", link->auth_mechanism.auth_mechanism);
+    spice_info("Auth method: %d", link->auth_mechanism.auth_mechanism);
 
     if (link->auth_mechanism.auth_mechanism == SPICE_COMMON_CAP_AUTH_SPICE
         && !sasl_enabled
@@ -2345,13 +2345,13 @@ static void reds_handle_auth_mechanism(void *opaque)
         reds_get_spice_ticket(link);
 #if HAVE_SASL
     } else if (link->auth_mechanism.auth_mechanism == SPICE_COMMON_CAP_AUTH_SASL) {
-        spice_printerr("Starting SASL");
+        spice_info("Starting SASL");
         reds_start_auth_sasl(link);
 #endif
     } else {
-        spice_printerr("Unknown auth method, disconnecting");
+        spice_error("Unknown auth method, disconnecting");
         if (sasl_enabled) {
-            spice_printerr("Your client doesn't handle SASL?");
+            spice_error("Your client doesn't handle SASL?");
         }
         reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
         reds_link_free(link);
@@ -2388,10 +2388,10 @@ static void reds_handle_read_link_done(void *opaque)
 
     if (!reds_security_check(link)) {
         if (link->stream->ssl) {
-            spice_printerr("spice channels %d should not be encrypted", link_mess->channel_type);
+            spice_error("spice channels %d should not be encrypted", link_mess->channel_type);
             reds_send_link_error(link, SPICE_LINK_ERR_NEED_UNSECURED);
         } else {
-            spice_printerr("spice channels %d should be encrypted", link_mess->channel_type);
+            spice_error("spice channels %d should be encrypted", link_mess->channel_type);
             reds_send_link_error(link, SPICE_LINK_ERR_NEED_SECURED);
         }
         reds_link_free(link);
@@ -2405,11 +2405,11 @@ static void reds_handle_read_link_done(void *opaque)
 
     if (!auth_selection) {
         if (sasl_enabled && !link->skip_auth) {
-            spice_printerr("SASL enabled, but peer supports only spice authentication");
+            spice_error("SASL enabled, but peer supports only spice authentication");
             reds_send_link_error(link, SPICE_LINK_ERR_VERSION_MISMATCH);
             return;
         }
-        spice_printerr("Peer doesn't support AUTH selection");
+        spice_error("Peer doesn't support AUTH selection");
         reds_get_spice_ticket(link);
     } else {
         obj->now = (uint8_t *)&link->auth_mechanism;
@@ -2427,7 +2427,7 @@ static void reds_handle_link_error(void *opaque, int err)
     case EPIPE:
         break;
     default:
-        spice_printerr("%s", strerror(errno));
+        spice_error("%s", strerror(errno));
         break;
     }
     reds_link_free(link);
@@ -2450,7 +2450,7 @@ static void reds_handle_read_header_done(void *opaque)
             reds_send_link_error(link, SPICE_LINK_ERR_VERSION_MISMATCH);
         }
 
-        spice_printerr("version mismatch");
+        spice_error("version mismatch");
         reds_link_free(link);
         return;
     }
@@ -2459,7 +2459,7 @@ static void reds_handle_read_header_done(void *opaque)
 
     if (header->size < sizeof(SpiceLinkMess)) {
         reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
-        spice_printerr("bad size %u", header->size);
+        spice_error("bad size %u", header->size);
         reds_link_free(link);
         return;
     }
@@ -2492,7 +2492,7 @@ static void reds_handle_ssl_accept(int fd, int event, void *data)
     if ((return_code = SSL_accept(link->stream->ssl)) != 1) {
         int ssl_error = SSL_get_error(link->stream->ssl, return_code);
         if (ssl_error != SSL_ERROR_WANT_READ && ssl_error != SSL_ERROR_WANT_WRITE) {
-            spice_printerr("SSL_accept failed, error=%d", ssl_error);
+            spice_error("SSL_accept failed, error=%d", ssl_error);
             reds_link_free(link);
         } else {
             if (ssl_error == SSL_ERROR_WANT_READ) {
@@ -2515,18 +2515,18 @@ static RedLinkInfo *reds_init_client_connection(int socket)
     int flags;
 
     if ((flags = fcntl(socket, F_GETFL)) == -1) {
-        spice_printerr("accept failed, %s", strerror(errno));
+        spice_error("accept failed, %s", strerror(errno));
         goto error;
     }
 
     if (fcntl(socket, F_SETFL, flags | O_NONBLOCK) == -1) {
-        spice_printerr("accept failed, %s", strerror(errno));
+        spice_error("accept failed, %s", strerror(errno));
         goto error;
     }
 
     if (setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) {
         if (errno != ENOTSUP) {
-            spice_printerr("setsockopt failed, %s", strerror(errno));
+            spice_error("setsockopt failed, %s", strerror(errno));
         }
     }
 
@@ -2576,13 +2576,13 @@ static RedLinkInfo *reds_init_client_ssl_connection(int socket)
 
     // Handle SSL handshaking
     if (!(sbio = BIO_new_socket(link->stream->socket, BIO_NOCLOSE))) {
-        spice_printerr("could not allocate ssl bio socket");
+        spice_error("could not allocate ssl bio socket");
         goto error;
     }
 
     link->stream->ssl = SSL_new(reds->ctx);
     if (!link->stream->ssl) {
-        spice_printerr("could not allocate ssl context");
+        spice_error("could not allocate ssl context");
         BIO_free(sbio);
         goto error;
     }
@@ -2610,7 +2610,7 @@ static RedLinkInfo *reds_init_client_ssl_connection(int socket)
     }
 
     ERR_print_errors_fp(stderr);
-    spice_printerr("SSL_accept failed, error=%d", ssl_error);
+    spice_error("SSL_accept failed, error=%d", ssl_error);
     SSL_free(link->stream->ssl);
 
 error:
@@ -2626,7 +2626,7 @@ static void reds_accept_ssl_connection(int fd, int event, void *data)
     int socket;
 
     if ((socket = accept(reds->secure_listen_socket, NULL, 0)) == -1) {
-        spice_printerr("accept failed, %s", strerror(errno));
+        spice_error("accept failed, %s", strerror(errno));
         return;
     }
 
@@ -2642,7 +2642,7 @@ static void reds_accept(int fd, int event, void *data)
     int socket;
 
     if ((socket = accept(reds->listen_socket, NULL, 0)) == -1) {
-        spice_printerr("accept failed, %s", strerror(errno));
+        spice_error("accept failed, %s", strerror(errno));
         return;
     }
 
@@ -2658,7 +2658,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_client(SpiceServer *s, int socket, int s
 
     spice_assert(reds == s);
     if (!(link = reds_init_client_connection(socket))) {
-        spice_printerr("accept failed");
+        spice_error("accept failed");
         return -1;
     }
 
@@ -2731,8 +2731,8 @@ static int reds_init_socket(const char *addr, int portnr, int family)
         }
         close(slisten);
     }
-    spice_printerr("%s: binding socket to %s:%d failed", __FUNCTION__,
-               addr, portnr);
+    spice_error("%s: binding socket to %s:%d failed", __FUNCTION__,
+                addr, portnr);
     freeaddrinfo(res);
     return -1;
 
@@ -2884,7 +2884,7 @@ static void reds_init_ssl(void)
     /* Load our keys and certificates*/
     return_code = SSL_CTX_use_certificate_chain_file(reds->ctx, ssl_parameters.certs_file);
     if (return_code == 1) {
-        spice_printerr("Loaded certificates from %s", ssl_parameters.certs_file);
+        spice_info("Loaded certificates from %s", ssl_parameters.certs_file);
     } else {
         spice_error("Could not load certificates from %s", ssl_parameters.certs_file);
     }
@@ -2894,7 +2894,7 @@ static void reds_init_ssl(void)
     return_code = SSL_CTX_use_PrivateKey_file(reds->ctx, ssl_parameters.private_key_file,
                                               SSL_FILETYPE_PEM);
     if (return_code == 1) {
-        spice_printerr("Using private key from %s", ssl_parameters.private_key_file);
+        spice_info("Using private key from %s", ssl_parameters.private_key_file);
     } else {
         spice_error("Could not use private key file");
     }
@@ -2902,7 +2902,7 @@ static void reds_init_ssl(void)
     /* Load the CAs we trust*/
     return_code = SSL_CTX_load_verify_locations(reds->ctx, ssl_parameters.ca_certificate_file, 0);
     if (return_code == 1) {
-        spice_printerr("Loaded CA certificates from %s", ssl_parameters.ca_certificate_file);
+        spice_info("Loaded CA certificates from %s", ssl_parameters.ca_certificate_file);
     } else {
         spice_error("Could not use CA file %s", ssl_parameters.ca_certificate_file);
     }
@@ -2975,7 +2975,7 @@ enum {
 static inline void on_activating_ticketing(void)
 {
     if (!ticketing_enabled && reds_main_channel_connected()) {
-        spice_printerr("disconnecting");
+        spice_error("disconnecting");
         reds_disconnect();
     }
 }
@@ -3027,7 +3027,7 @@ static void reds_mig_release(void)
 
 static void reds_mig_started(void)
 {
-    spice_printerr("");
+    spice_info(NULL);
     spice_assert(reds->mig_spice);
 
     reds->mig_inprogress = TRUE;
@@ -3037,10 +3037,10 @@ static void reds_mig_started(void)
 
 static void reds_mig_finished(int completed)
 {
-    spice_printerr("");
+    spice_info(NULL);
 
     if (!reds_main_channel_connected()) {
-        spice_printerr("no peer connected");
+        spice_error("no peer connected");
         return;
     }
     reds->mig_inprogress = TRUE;
@@ -3057,7 +3057,7 @@ static void reds_mig_finished(int completed)
 static void reds_mig_switch(void)
 {
     if (!reds->mig_spice) {
-        spice_printerr("warning: reds_mig_switch called without migrate_info set");
+        spice_error("reds_mig_switch called without migrate_info set");
         return;
     }
     main_channel_migrate_switch(reds->main_channel, reds->mig_spice);
@@ -3066,7 +3066,7 @@ static void reds_mig_switch(void)
 
 static void migrate_timeout(void *opaque)
 {
-    spice_printerr("");
+    spice_info(NULL);
     spice_assert(reds->mig_wait_connect || reds->mig_wait_disconnect);
     if (reds->mig_wait_connect) {
         /* we will fall back to the switch host scheme when migration completes */
@@ -3190,10 +3190,10 @@ static int spice_server_char_device_add_interface(SpiceServer *s,
             SPICE_CONTAINEROF(sin, SpiceCharDeviceInstance, base);
     SpiceCharDeviceState *dev_state = NULL;
 
-    spice_printerr("CHAR_DEVICE %s", char_device->subtype);
+    spice_info("CHAR_DEVICE %s", char_device->subtype);
     if (strcmp(char_device->subtype, SUBTYPE_VDAGENT) == 0) {
         if (vdagent) {
-            spice_printerr("vdagent already attached");
+            spice_error("vdagent already attached");
             return -1;
         }
         dev_state = attach_to_red_agent(char_device);
@@ -3224,7 +3224,7 @@ static void spice_server_char_device_remove_interface(SpiceBaseInstance *sin)
     SpiceCharDeviceInstance* char_device =
             SPICE_CONTAINEROF(sin, SpiceCharDeviceInstance, base);
 
-    spice_printerr("remove CHAR_DEVICE %s", char_device->subtype);
+    spice_info("remove CHAR_DEVICE %s", char_device->subtype);
     if (strcmp(char_device->subtype, SUBTYPE_VDAGENT) == 0) {
         if (vdagent) {
             reds_agent_remove();
@@ -3249,20 +3249,20 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
     spice_assert(reds == s);
 
     if (strcmp(interface->type, SPICE_INTERFACE_KEYBOARD) == 0) {
-        spice_printerr("SPICE_INTERFACE_KEYBOARD");
+        spice_info("SPICE_INTERFACE_KEYBOARD");
         if (interface->major_version != SPICE_INTERFACE_KEYBOARD_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_KEYBOARD_MINOR) {
-            spice_printerr("unsupported keyboard interface");
+            spice_error("unsupported keyboard interface");
             return -1;
         }
         if (inputs_set_keyboard(SPICE_CONTAINEROF(sin, SpiceKbdInstance, base)) != 0) {
             return -1;
         }
     } else if (strcmp(interface->type, SPICE_INTERFACE_MOUSE) == 0) {
-        spice_printerr("SPICE_INTERFACE_MOUSE");
+        spice_info("SPICE_INTERFACE_MOUSE");
         if (interface->major_version != SPICE_INTERFACE_MOUSE_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_MOUSE_MINOR) {
-            spice_printerr("unsupported mouse interface");
+            spice_error("unsupported mouse interface");
             return -1;
         }
         if (inputs_set_mouse(SPICE_CONTAINEROF(sin, SpiceMouseInstance, base)) != 0) {
@@ -3271,10 +3271,10 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
     } else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
         QXLInstance *qxl;
 
-        spice_printerr("SPICE_INTERFACE_QXL");
+        spice_info("SPICE_INTERFACE_QXL");
         if (interface->major_version != SPICE_INTERFACE_QXL_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_QXL_MINOR) {
-            spice_printerr("unsupported qxl interface");
+            spice_error("unsupported qxl interface");
             return -1;
         }
 
@@ -3284,10 +3284,10 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
         qxl->st->dispatcher = red_dispatcher_init(qxl);
 
     } else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
-        spice_printerr("SPICE_INTERFACE_TABLET");
+        spice_info("SPICE_INTERFACE_TABLET");
         if (interface->major_version != SPICE_INTERFACE_TABLET_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_TABLET_MINOR) {
-            spice_printerr("unsupported tablet interface");
+            spice_error("unsupported tablet interface");
             return -1;
         }
         if (inputs_set_tablet(SPICE_CONTAINEROF(sin, SpiceTabletInstance, base)) != 0) {
@@ -3299,19 +3299,19 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
         }
 
     } else if (strcmp(interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
-        spice_printerr("SPICE_INTERFACE_PLAYBACK");
+        spice_info("SPICE_INTERFACE_PLAYBACK");
         if (interface->major_version != SPICE_INTERFACE_PLAYBACK_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_PLAYBACK_MINOR) {
-            spice_printerr("unsupported playback interface");
+            spice_error("unsupported playback interface");
             return -1;
         }
         snd_attach_playback(SPICE_CONTAINEROF(sin, SpicePlaybackInstance, base));
 
     } else if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
-        spice_printerr("SPICE_INTERFACE_RECORD");
+        spice_info("SPICE_INTERFACE_RECORD");
         if (interface->major_version != SPICE_INTERFACE_RECORD_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_RECORD_MINOR) {
-            spice_printerr("unsupported record interface");
+            spice_error("unsupported record interface");
             return -1;
         }
         snd_attach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
@@ -3319,7 +3319,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
     } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
         if (interface->major_version != SPICE_INTERFACE_CHAR_DEVICE_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_CHAR_DEVICE_MINOR) {
-            spice_printerr("unsupported char device interface");
+            spice_error("unsupported char device interface");
             return -1;
         }
         spice_server_char_device_add_interface(s, sin);
@@ -3327,33 +3327,33 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
     } else if (strcmp(interface->type, SPICE_INTERFACE_NET_WIRE) == 0) {
 #ifdef USE_TUNNEL
         SpiceNetWireInstance *net;
-        spice_printerr("SPICE_INTERFACE_NET_WIRE");
+        spice_info("SPICE_INTERFACE_NET_WIRE");
         if (red_tunnel) {
-            spice_printerr("net wire already attached");
+            spice_error("net wire already attached");
             return -1;
         }
         if (interface->major_version != SPICE_INTERFACE_NET_WIRE_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_NET_WIRE_MINOR) {
-            spice_printerr("unsupported net wire interface");
+            spice_error("unsupported net wire interface");
             return -1;
         }
         net = SPICE_CONTAINEROF(sin, SpiceNetWireInstance, base);
         net->st = spice_new0(SpiceNetWireState, 1);
         red_tunnel = red_tunnel_attach(core, net);
 #else
-        spice_printerr("unsupported net wire interface");
+        spice_error("unsupported net wire interface");
         return -1;
 #endif
     } else if (strcmp(interface->type, SPICE_INTERFACE_MIGRATION) == 0) {
-        spice_printerr("SPICE_INTERFACE_MIGRATION");
+        spice_info("SPICE_INTERFACE_MIGRATION");
         if (migration_interface) {
-            spice_printerr("already have migration");
+            spice_error("already have migration");
             return -1;
         }
 
         if (interface->major_version != SPICE_INTERFACE_MIGRATION_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_MIGRATION_MINOR) {
-            spice_printerr("unsupported migration interface");
+            spice_error("unsupported migration interface");
             return -1;
         }
         migration_interface = SPICE_CONTAINEROF(sin, SpiceMigrateInstance, base);
@@ -3368,17 +3368,15 @@ SPICE_GNUC_VISIBLE int spice_server_remove_interface(SpiceBaseInstance *sin)
     const SpiceBaseInterface *interface = sin->sif;
 
     if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
-        spice_printerr("remove SPICE_INTERFACE_TABLET");
+        spice_info("remove SPICE_INTERFACE_TABLET");
         inputs_detach_tablet(SPICE_CONTAINEROF(sin, SpiceTabletInstance, base));
         reds_update_mouse_mode();
     } else if (strcmp(interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
-        spice_printerr("remove SPICE_INTERFACE_PLAYBACK");
+        spice_info("remove SPICE_INTERFACE_PLAYBACK");
         snd_detach_playback(SPICE_CONTAINEROF(sin, SpicePlaybackInstance, base));
-
     } else if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
-        spice_printerr("remove SPICE_INTERFACE_RECORD");
+        spice_info("remove SPICE_INTERFACE_RECORD");
         snd_detach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
-
     } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
         spice_server_char_device_remove_interface(sin);
     } else {
@@ -3413,10 +3411,10 @@ const char *version_string = VERSION;
 
 static int do_spice_init(SpiceCoreInterface *core_interface)
 {
-    spice_printerr("starting %s", version_string);
+    spice_info("starting %s", version_string);
 
     if (core_interface->base.major_version != SPICE_INTERFACE_CORE_MAJOR) {
-        spice_printerr("bad core interface version");
+        spice_error("bad core interface version");
         goto err;
     }
     core = core_interface;
@@ -3486,7 +3484,7 @@ static int do_spice_init(SpiceCoreInterface *core_interface)
     reds->mouse_mode = SPICE_MOUSE_MODE_SERVER;
     reds->allow_multiple_clients = getenv(SPICE_DEBUG_ALLOW_MC_ENV) != NULL;
     if (reds->allow_multiple_clients) {
-        spice_printerr("spice: allowing multiple client connections");
+        spice_warning("spice: allowing multiple client connections (crashy)");
     }
     atexit(reds_exit);
     return 0;
@@ -3704,7 +3702,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_jpeg_compression(SpiceServer *s, spice_w
 {
     spice_assert(reds == s);
     if (comp == SPICE_WAN_COMPRESSION_INVALID) {
-        spice_printerr("invalid jpeg state");
+        spice_error("invalid jpeg state");
         return -1;
     }
     // todo: support dynamically changing the state
@@ -3716,7 +3714,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_zlib_glz_compression(SpiceServer *s, spi
 {
     spice_assert(reds == s);
     if (comp == SPICE_WAN_COMPRESSION_INVALID) {
-        spice_printerr("invalid zlib_glz state");
+        spice_error("invalid zlib_glz state");
         return -1;
     }
     // todo: support dynamically changing the state
@@ -3866,12 +3864,12 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *s, const char*
 {
     SpiceMigrateInterface *sif;
 
-    spice_printerr("");
+    spice_info(NULL);
     spice_assert(migration_interface);
     spice_assert(reds == s);
 
     if (reds->expect_migrate) {
-        spice_printerr("warning: consecutive calls without migration. Canceling previous call");
+        spice_error("consecutive calls without migration. Canceling previous call");
         main_channel_migrate_complete(reds->main_channel, FALSE);
     }
 
@@ -3890,7 +3888,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *s, const char*
     } else {
         if (reds->num_clients == 0) {
             reds_mig_release();
-            spice_printerr("no client connected");
+            spice_error("no client connected");
         }
         sif->migrate_connect_complete(migration_interface);
     }
@@ -3902,7 +3900,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *s, const char* des
                                           int port, int secure_port,
                                           const char* cert_subject)
 {
-    spice_printerr("");
+    spice_info(NULL);
     spice_assert(!migration_interface);
     spice_assert(reds == s);
 
@@ -3915,7 +3913,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *s, const char* des
 SPICE_GNUC_VISIBLE int spice_server_migrate_start(SpiceServer *s)
 {
     spice_assert(reds == s);
-    spice_printerr("");
+    spice_info(NULL);
     if (!reds->mig_spice) {
         return -1;
     }
@@ -3941,14 +3939,14 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_end(SpiceServer *s, int completed)
     SpiceMigrateInterface *sif;
     int ret = 0;
 
-    spice_printerr("");
+    spice_info(NULL);
 
     spice_assert(migration_interface);
     spice_assert(reds == s);
 
     sif = SPICE_CONTAINEROF(migration_interface->base.sif, SpiceMigrateInterface, base);
     if (!reds->expect_migrate && reds->num_clients) {
-        spice_printerr("spice_server_migrate_info was not called, disconnecting clients");
+        spice_error("spice_server_migrate_info was not called, disconnecting clients");
         reds_disconnect();
         ret = -1;
         goto complete;
@@ -3968,7 +3966,7 @@ complete:
 SPICE_GNUC_VISIBLE int spice_server_migrate_switch(SpiceServer *s)
 {
     spice_assert(reds == s);
-    spice_printerr("");
+    spice_info(NULL);
     if (!reds->num_clients) {
        return 0;
     }
@@ -4052,7 +4050,7 @@ void reds_stream_free(RedsStream *s)
     }
 
     reds_stream_remove_watch(s);
-    spice_printerr("close socket fd %d", s->socket);
+    spice_info("close socket fd %d", s->socket);
     close(s->socket);
 
     free(s);
commit 706232a81aeb1663983617500960c76a8aca5d09
Author: Alon Levy <alevy at redhat.com>
Date:   Thu Jul 5 19:03:09 2012 +0300

    server/red_worker: elevate some spice_debugs to spice_info
    
    Specifically all those that the previous patch converted to spice_debug.
    spice_debug contains very verbose stuff like update_area that drowns out
    those relatively rare (client connect / disconnect generated) messages.

diff --git a/server/red_worker.c b/server/red_worker.c
index 3092218..c492443 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1130,46 +1130,46 @@ static void print_compress_stats(DisplayChannel *display_channel)
                        display_channel->zlib_glz_stat.comp_size :
                        display_channel->glz_stat.comp_size;
 
-    spice_debug("==> Compression stats for display %u", display_channel->common.id);
-    spice_debug("Method   \t  count  \torig_size(MB)\tenc_size(MB)\tenc_time(s)");
-    spice_debug("QUIC     \t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("==> Compression stats for display %u", display_channel->common.id);
+    spice_info("Method   \t  count  \torig_size(MB)\tenc_size(MB)\tenc_time(s)");
+    spice_info("QUIC     \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->quic_stat.count,
                stat_byte_to_mega(display_channel->quic_stat.orig_size),
                stat_byte_to_mega(display_channel->quic_stat.comp_size),
                stat_cpu_time_to_sec(display_channel->quic_stat.total)
                );
-    spice_debug("GLZ      \t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("GLZ      \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->glz_stat.count,
                stat_byte_to_mega(display_channel->glz_stat.orig_size),
                stat_byte_to_mega(display_channel->glz_stat.comp_size),
                stat_cpu_time_to_sec(display_channel->glz_stat.total)
                );
-    spice_debug("ZLIB GLZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("ZLIB GLZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->zlib_glz_stat.count,
                stat_byte_to_mega(display_channel->zlib_glz_stat.orig_size),
                stat_byte_to_mega(display_channel->zlib_glz_stat.comp_size),
                stat_cpu_time_to_sec(display_channel->zlib_glz_stat.total)
                );
-    spice_debug("LZ       \t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("LZ       \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->lz_stat.count,
                stat_byte_to_mega(display_channel->lz_stat.orig_size),
                stat_byte_to_mega(display_channel->lz_stat.comp_size),
                stat_cpu_time_to_sec(display_channel->lz_stat.total)
                );
-    spice_debug("JPEG     \t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("JPEG     \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->jpeg_stat.count,
                stat_byte_to_mega(display_channel->jpeg_stat.orig_size),
                stat_byte_to_mega(display_channel->jpeg_stat.comp_size),
                stat_cpu_time_to_sec(display_channel->jpeg_stat.total)
                );
-    spice_debug("JPEG-RGBA\t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("JPEG-RGBA\t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->jpeg_alpha_stat.count,
                stat_byte_to_mega(display_channel->jpeg_alpha_stat.orig_size),
                stat_byte_to_mega(display_channel->jpeg_alpha_stat.comp_size),
                stat_cpu_time_to_sec(display_channel->jpeg_alpha_stat.total)
                );
-    spice_debug("-------------------------------------------------------------------");
-    spice_debug("Total    \t%8d\t%13.2f\t%12.2f\t%12.2f",
+    spice_info("-------------------------------------------------------------------");
+    spice_info("Total    \t%8d\t%13.2f\t%12.2f\t%12.2f",
                display_channel->lz_stat.count + display_channel->glz_stat.count +
                                                 display_channel->quic_stat.count +
                                                 display_channel->jpeg_stat.count +
@@ -2106,7 +2106,7 @@ void __show_current(TreeItem *item, void *data)
 static void show_current(RedWorker *worker, Ring *ring)
 {
     if (ring_is_empty(ring)) {
-        spice_debug("TEST: TREE: EMPTY");
+        spice_info("TEST: TREE: EMPTY");
         return;
     }
     current_tree_for_each(ring, __show_current, NULL);
@@ -3331,7 +3331,7 @@ static void red_reset_stream_trace(RedWorker *worker)
         if (!stream->current) {
             red_stop_stream(worker, stream);
         } else {
-            spice_debug("attached stream");
+            spice_info("attached stream");
         }
     }
 
@@ -3585,17 +3585,17 @@ static inline int red_current_add_qxl(RedWorker *worker, Ring *ring, Drawable *d
 #ifdef RED_WORKER_STAT
     if ((++worker->add_count % 100) == 0) {
         stat_time_t total = worker->add_stat.total;
-        spice_debug("add with shadow count %u",
+        spice_info("add with shadow count %u",
                    worker->add_with_shadow_count);
         worker->add_with_shadow_count = 0;
-        spice_debug("add[%u] %f exclude[%u] %f __exclude[%u] %f",
+        spice_info("add[%u] %f exclude[%u] %f __exclude[%u] %f",
                    worker->add_stat.count,
                    stat_cpu_time_to_sec(total),
                    worker->exclude_stat.count,
                    stat_cpu_time_to_sec(worker->exclude_stat.total),
                    worker->__exclude_stat.count,
                    stat_cpu_time_to_sec(worker->__exclude_stat.total));
-        spice_debug("add %f%% exclude %f%% exclude2 %f%% __exclude %f%%",
+        spice_info("add %f%% exclude %f%% exclude2 %f%% __exclude %f%%",
                    (double)(total - worker->exclude_stat.total) / total * 100,
                    (double)(worker->exclude_stat.total) / total * 100,
                    (double)(worker->exclude_stat.total -
@@ -6319,7 +6319,7 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
 
     if (quic_compress) {
 #ifdef COMPRESS_DEBUG
-        spice_debug("QUIC compress");
+        spice_info("QUIC compress");
 #endif
         // if bitmaps is picture-like, compress it using jpeg
         if (can_lossy && display_channel->enable_jpeg &&
@@ -6366,12 +6366,12 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
             ret = red_lz_compress_image(dcc, dest, src, o_comp_data,
                                         drawable->group_id);
 #ifdef COMPRESS_DEBUG
-            spice_debug("LZ LOCAL compress");
+            spice_info("LZ LOCAL compress");
 #endif
         }
 #ifdef COMPRESS_DEBUG
         else {
-            spice_debug("LZ global compress fmt=%d", src->format);
+            spice_info("LZ global compress fmt=%d", src->format);
         }
 #endif
         return ret;
@@ -8731,7 +8731,7 @@ static void display_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item
         red_marshall_verb(rcc, ((VerbItem*)pipe_item)->verb);
         break;
     case PIPE_ITEM_TYPE_MIGRATE:
-        spice_debug("PIPE_ITEM_TYPE_MIGRATE");
+        spice_info("PIPE_ITEM_TYPE_MIGRATE");
         display_channel_marshall_migrate(rcc, m);
         break;
     case PIPE_ITEM_TYPE_MIGRATE_DATA:
@@ -8790,7 +8790,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
         red_marshall_verb(rcc, ((VerbItem*)pipe_item)->verb);
         break;
     case PIPE_ITEM_TYPE_MIGRATE:
-        spice_debug("PIPE_ITEM_TYPE_MIGRATE");
+        spice_info("PIPE_ITEM_TYPE_MIGRATE");
         cursor_channel_marshall_migrate(rcc, m);
         break;
     case PIPE_ITEM_TYPE_CURSOR_INIT:
@@ -8896,7 +8896,7 @@ static void display_channel_client_on_disconnect(RedChannelClient *rcc)
     if (!rcc) {
         return;
     }
-    spice_debug(NULL);
+    spice_info(NULL);
     common = SPICE_CONTAINEROF(rcc->channel, CommonChannel, base);
     worker = common->worker;
     display_channel = (DisplayChannel *)rcc->channel;
@@ -9279,7 +9279,7 @@ static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
         if (dcc->pixmap_cache && dcc->glz_dict) {
             dcc->pixmap_cache_generation = dcc->pixmap_cache->generation;
             /* TODO: move common.id? if it's used for a per client structure.. */
-            spice_debug("creating encoder with id == %d", dcc->common.id);
+            spice_info("creating encoder with id == %d", dcc->common.id);
             dcc->glz = glz_encoder_create(dcc->common.id, dcc->glz_dict->dict, &dcc->glz_data.usr);
             if (!dcc->glz) {
                 spice_critical("create global lz failed");
@@ -9361,7 +9361,7 @@ static GlzSharedDictionary *red_create_glz_dictionary(DisplayChannelClient *dcc,
                                                             MAX_LZ_ENCODERS,
                                                             &dcc->glz_data.usr);
 #ifdef COMPRESS_DEBUG
-    spice_debug("Lz Window %d Size=%d", id, window_size);
+    spice_info("Lz Window %d Size=%d", id, window_size);
 #endif
     if (!glz_dict) {
         spice_critical("failed creating lz dictionary");
@@ -10014,7 +10014,7 @@ static void display_channel_create(RedWorker *worker, int migrate)
         return;
     }
 
-    spice_debug("create display channel");
+    spice_info("create display channel");
     if (!(worker->display_channel = (DisplayChannel *)__new_channel(
             worker, sizeof(*display_channel),
             SPICE_CHANNEL_DISPLAY, migrate,
@@ -10066,14 +10066,14 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
         return;
     }
     display_channel = worker->display_channel;
-    spice_debug("add display channel client");
+    spice_info("add display channel client");
     dcc = display_channel_client_create(&display_channel->common, client, stream,
                                         common_caps, num_common_caps,
                                         caps, num_caps);
     if (!dcc) {
         return;
     }
-    spice_debug("New display (client %p) dcc %p stream %p", client, dcc, stream);
+    spice_info("New display (client %p) dcc %p stream %p", client, dcc, stream);
     stream_buf_size = 32*1024;
     dcc->send_data.stream_outbuf = spice_malloc(stream_buf_size);
     dcc->send_data.stream_outbuf_size = stream_buf_size;
@@ -10100,8 +10100,8 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
                                                  SPICE_WAN_COMPRESSION_ALWAYS);
     }
 
-    spice_debug("jpeg %s", display_channel->enable_jpeg ? "enabled" : "disabled");
-    spice_debug("zlib-over-glz %s", display_channel->enable_zlib_glz_wrap ? "enabled" : "disabled");
+    spice_info("jpeg %s", display_channel->enable_jpeg ? "enabled" : "disabled");
+    spice_info("zlib-over-glz %s", display_channel->enable_zlib_glz_wrap ? "enabled" : "disabled");
 
     // todo: tune level according to bandwidth
     display_channel->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
@@ -10220,7 +10220,7 @@ static void cursor_channel_create(RedWorker *worker, int migrate)
     if (worker->cursor_channel != NULL) {
         return;
     }
-    spice_debug("create cursor channel");
+    spice_info("create cursor channel");
     worker->cursor_channel = (CursorChannel *)__new_channel(
         worker, sizeof(*worker->cursor_channel),
         SPICE_CHANNEL_CURSOR, migrate,
@@ -10247,7 +10247,7 @@ static void red_connect_cursor(RedWorker *worker, RedClient *client, RedsStream
         return;
     }
     channel = worker->cursor_channel;
-    spice_debug("add cursor channel client");
+    spice_info("add cursor channel client");
     ccc = cursor_channel_create_rcc(&channel->common, client, stream,
                                     common_caps, num_common_caps,
                                     caps, num_caps);
@@ -10279,7 +10279,7 @@ static void red_wait_outgoing_item(RedChannelClient *rcc)
         return;
     }
     end_time = red_now() + DETACH_TIMEOUT;
-    spice_debug("blocked");
+    spice_info("blocked");
 
     do {
         usleep(DETACH_SLEEP_DURATION);
@@ -10316,7 +10316,7 @@ static void red_wait_outgoing_items(RedChannel *channel)
     }
 
     end_time = red_now() + DETACH_TIMEOUT;
-    spice_debug("blocked");
+    spice_info("blocked");
 
     do {
         usleep(DETACH_SLEEP_DURATION);
@@ -10339,7 +10339,7 @@ static void red_wait_pipe_item_sent(RedChannelClient *rcc, PipeItem *item)
     uint64_t end_time;
     int item_in_pipe;
 
-    spice_debug(NULL);
+    spice_info(NULL);
     dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, dpi_pipe_item);
     ref_drawable_pipe_item(dpi);
 
@@ -10693,7 +10693,7 @@ void handle_dev_stop(void *opaque, void *payload)
 {
     RedWorker *worker = opaque;
 
-    spice_debug("stop");
+    spice_info("stop");
     spice_assert(worker->running);
     worker->running = FALSE;
     red_display_clear_glz_drawables(worker->display_channel);
@@ -10817,7 +10817,7 @@ void handle_dev_display_connect(void *opaque, void *payload)
     RedClient *client = msg->client;
     int migration = msg->migration;
 
-    spice_debug("connect");
+    spice_info("connect");
     handle_new_display_channel(worker, client, stream, migration,
                                msg->common_caps, msg->num_common_caps,
                                msg->caps, msg->num_caps);
@@ -10830,7 +10830,7 @@ void handle_dev_display_disconnect(void *opaque, void *payload)
     RedWorkerMessageDisplayDisconnect *msg = payload;
     RedChannelClient *rcc = msg->rcc;
 
-    spice_debug("disconnect display client");
+    spice_info("disconnect display client");
     spice_assert(rcc);
     red_channel_client_disconnect(rcc);
 }
@@ -10841,7 +10841,7 @@ void handle_dev_display_migrate(void *opaque, void *payload)
     RedWorker *worker = opaque;
 
     RedChannelClient *rcc = msg->rcc;
-    spice_debug("migrate display client");
+    spice_info("migrate display client");
     spice_assert(rcc);
     red_migrate_display(worker, rcc);
 }
@@ -10866,7 +10866,7 @@ void handle_dev_cursor_connect(void *opaque, void *payload)
     RedClient *client = msg->client;
     int migration = msg->migration;
 
-    spice_debug("cursor connect");
+    spice_info("cursor connect");
     red_connect_cursor(worker, client, stream, migration,
                        msg->common_caps, msg->num_common_caps,
                        msg->caps, msg->num_caps);
@@ -10879,7 +10879,7 @@ void handle_dev_cursor_disconnect(void *opaque, void *payload)
     RedWorkerMessageCursorDisconnect *msg = payload;
     RedChannelClient *rcc = msg->rcc;
 
-    spice_debug("disconnect cursor client");
+    spice_info("disconnect cursor client");
     spice_assert(rcc);
     red_channel_client_disconnect(rcc);
 }
@@ -10890,7 +10890,7 @@ void handle_dev_cursor_migrate(void *opaque, void *payload)
     RedWorker *worker = opaque;
     RedChannelClient *rcc = msg->rcc;
 
-    spice_debug("migrate cursor client");
+    spice_info("migrate cursor client");
     spice_assert(rcc);
     red_migrate_cursor(worker, rcc);
 }
@@ -10903,22 +10903,22 @@ void handle_dev_set_compression(void *opaque, void *payload)
     worker->image_compression = msg->image_compression;
     switch (worker->image_compression) {
     case SPICE_IMAGE_COMPRESS_AUTO_LZ:
-        spice_debug("ic auto_lz");
+        spice_info("ic auto_lz");
         break;
     case SPICE_IMAGE_COMPRESS_AUTO_GLZ:
-        spice_debug("ic auto_glz");
+        spice_info("ic auto_glz");
         break;
     case SPICE_IMAGE_COMPRESS_QUIC:
-        spice_debug("ic quic");
+        spice_info("ic quic");
         break;
     case SPICE_IMAGE_COMPRESS_LZ:
-        spice_debug("ic lz");
+        spice_info("ic lz");
         break;
     case SPICE_IMAGE_COMPRESS_GLZ:
-        spice_debug("ic glz");
+        spice_info("ic glz");
         break;
     case SPICE_IMAGE_COMPRESS_OFF:
-        spice_debug("ic off");
+        spice_info("ic off");
         break;
     default:
         spice_error("ic invalid");
@@ -10945,13 +10945,13 @@ void handle_dev_set_streaming_video(void *opaque, void *payload)
     spice_assert(worker->streaming_video != STREAM_VIDEO_INVALID);
     switch(worker->streaming_video) {
         case STREAM_VIDEO_ALL:
-            spice_debug("sv all");
+            spice_info("sv all");
             break;
         case STREAM_VIDEO_FILTER:
-            spice_debug("sv filter");
+            spice_info("sv filter");
             break;
         case STREAM_VIDEO_OFF:
-            spice_debug("sv off");
+            spice_info("sv off");
             break;
         default:
             spice_error("sv invalid");
@@ -10964,7 +10964,7 @@ void handle_dev_set_mouse_mode(void *opaque, void *payload)
     RedWorker *worker = opaque;
 
     worker->mouse_mode = msg->mode;
-    spice_debug("mouse mode %u", worker->mouse_mode);
+    spice_info("mouse mode %u", worker->mouse_mode);
 }
 
 void handle_dev_add_memslot_async(void *opaque, void *payload)
@@ -10992,7 +10992,7 @@ void handle_dev_loadvm_commands(void *opaque, void *payload)
     uint32_t count = msg->count;
     QXLCommandExt *ext = msg->ext;
 
-    spice_debug("loadvm_commands");
+    spice_info("loadvm_commands");
     for (i = 0 ; i < count ; ++i) {
         switch (ext[i].cmd.type) {
         case QXL_CMD_CURSOR:
@@ -11289,7 +11289,7 @@ SPICE_GNUC_NORETURN void *red_worker_main(void *arg)
 {
     RedWorker *worker = spice_malloc(sizeof(RedWorker));
 
-    spice_debug("begin");
+    spice_info("begin");
     spice_assert(MAX_PIPE_SIZE > WIDE_CLIENT_ACK_WINDOW &&
            MAX_PIPE_SIZE > NARROW_CLIENT_ACK_WINDOW); //ensure wakeup by ack message
 
commit 981f76a11d8fcc0b6d07dcf755b9925d5184d288
Author: Alon Levy <alevy at redhat.com>
Date:   Thu Jul 5 19:22:47 2012 +0300

    update spice-common for spice_info

diff --git a/spice-common b/spice-common
index f8f6231..2449260 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit f8f6231ecdb99595a07e6c3933dedd7438ef4f1d
+Subproject commit 2449260c81a6f5344214ee2a80c5566bec48aeee
commit 8ee952ef45c0eb69385264ffbc0083f27d419e22
Author: Alon Levy <alevy at redhat.com>
Date:   Thu Jul 5 19:04:22 2012 +0300

    server/red_worker: cleanup lines starting with 5 spaces

diff --git a/server/red_worker.c b/server/red_worker.c
index ef1b1b1..3092218 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -6132,22 +6132,22 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
         return TRUE;
     }
 
-     lz_data->data.bufs_head = jpeg_data->data.bufs_tail;
-     lz_data->data.bufs_tail = lz_data->data.bufs_head;
+    lz_data->data.bufs_head = jpeg_data->data.bufs_tail;
+    lz_data->data.bufs_tail = lz_data->data.bufs_head;
 
-     comp_head_filled = jpeg_size % sizeof(lz_data->data.bufs_head->buf);
-     comp_head_left = sizeof(lz_data->data.bufs_head->buf) - comp_head_filled;
-     lz_out_start_byte = ((uint8_t *)lz_data->data.bufs_head->buf) + comp_head_filled;
+    comp_head_filled = jpeg_size % sizeof(lz_data->data.bufs_head->buf);
+    comp_head_left = sizeof(lz_data->data.bufs_head->buf) - comp_head_filled;
+    lz_out_start_byte = ((uint8_t *)lz_data->data.bufs_head->buf) + comp_head_filled;
 
-     lz_data->data.dcc = dcc;
+    lz_data->data.dcc = dcc;
 
-     lz_data->data.u.lines_data.chunks = src->data;
-     lz_data->data.u.lines_data.stride = src->stride;
-     lz_data->data.u.lines_data.next = 0;
-     lz_data->data.u.lines_data.reverse = 0;
-     lz_data->usr.more_lines = lz_usr_more_lines;
+    lz_data->data.u.lines_data.chunks = src->data;
+    lz_data->data.u.lines_data.stride = src->stride;
+    lz_data->data.u.lines_data.next = 0;
+    lz_data->data.u.lines_data.reverse = 0;
+    lz_data->usr.more_lines = lz_usr_more_lines;
 
-     alpha_lz_size = lz_encode(lz, LZ_IMAGE_TYPE_XXXA, src->x, src->y,
+    alpha_lz_size = lz_encode(lz, LZ_IMAGE_TYPE_XXXA, src->x, src->y,
                                !!(src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN),
                                NULL, 0, src->stride,
                                lz_out_start_byte,
@@ -7838,7 +7838,7 @@ static void red_lossy_marshall_qxl_drawable(RedWorker *worker, RedChannelClient
     case QXL_DRAW_BLACKNESS:
         red_lossy_marshall_qxl_draw_blackness(worker, rcc, base_marshaller, dpi);
         break;
-     case QXL_DRAW_WHITENESS:
+    case QXL_DRAW_WHITENESS:
         red_lossy_marshall_qxl_draw_whiteness(worker, rcc, base_marshaller, dpi);
         break;
     case QXL_DRAW_INVERS:


More information about the Spice-commits mailing list