[Spice-devel] [PATCH spice-vdagent v7 3/3] file-xfer: change error log messages

Jakub Janků janku.jakub.jj at gmail.com
Sun Jun 4 20:30:03 UTC 2017


Add prefix "file-xfer #id" prefix to log message in send_file_xfer_status(),
so the message doesn't have to include file-xfer task id and it's always clear,
what task is the message concerning.
---
 src/vdagentd/vdagentd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
index 6e06edf..46dfb4e 100644
--- a/src/vdagentd/vdagentd.c
+++ b/src/vdagentd/vdagentd.c
@@ -325,7 +325,7 @@ static void send_file_xfer_status(struct vdagent_virtio_port *vport,
         memcpy(status->data, data, data_size);
 
     if (msg)
-        syslog(LOG_WARNING, msg, id);
+        syslog(LOG_WARNING, "file-xfer %u: %s", id, msg);
 
     if (vport)
         vdagent_virtio_port_write(vport, VDP_CLIENT_PORT,
@@ -348,14 +348,14 @@ static void do_client_file_xfer(struct vdagent_virtio_port *vport,
         if (!active_session_conn) {
             send_file_xfer_status(vport,
                "Could not find an agent connection belonging to the "
-               "active session, cancelling client file-xfer request %u",
+               "active session, cancelling file-xfer",
                s->id, VD_AGENT_FILE_XFER_STATUS_CANCELLED, NULL, 0);
             return;
         } else if (session_info_session_is_locked(session_info)) {
             syslog(LOG_DEBUG, "Session is locked, skipping file-xfer-start");
             send_file_xfer_status(vport,
                "User's session is locked and cannot start file transfer. "
-               "Cancelling client file-xfer request %u",
+               "Cancelling file-xfer",
                s->id, VD_AGENT_FILE_XFER_STATUS_ERROR, NULL, 0);
             return;
         }
@@ -826,7 +826,7 @@ static gboolean remove_active_xfers(gpointer key, gpointer value, gpointer conn)
 {
     if (value == conn) {
         send_file_xfer_status(virtio_port,
-                              "Agent disc; cancelling file-xfer %u",
+                              "Agent disc; cancelling file-xfer",
                               GPOINTER_TO_UINT(key),
                               VD_AGENT_FILE_XFER_STATUS_CANCELLED, NULL, 0);
         return 1;
@@ -925,7 +925,7 @@ static void agent_read_complete(struct udscs_connection **connp,
         switch (header->arg2) {
             case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE: {
                 uint64_t free_space = GUINT64_TO_LE(*((uint64_t*)data));
-                send_file_xfer_status(virtio_port, "Not enough free space. Cancelling file-xfer %u",
+                send_file_xfer_status(virtio_port, "Not enough free space. Cancelling file-xfer",
                                       header->arg1, header->arg2,
                                       (uint8_t*)&free_space, sizeof(uint64_t));
                 break;
-- 
2.9.4



More information about the Spice-devel mailing list