[PATCH 05/13] daemon, src: Use new tracepoint function calls to replace old PROBE macro calls to support multiple trace function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Xinghai Yu <yuxinghai@xxxxxxxxxxxxxx>

Remove the macro PROBE's definition in 'internal.h' and repalce 
the old 'PROBE' calls with new tracepoint function in source codes.

Preprocess judgement by 'WITH_TRACE_PROBES' is to avoid the 
undefined errors which come from 'virt-login-shell' which code 
containing tracepoints but will not link tracepoints definition 
target file since 'virt-login-shell' will be setuid.

Signed-off-by: Xinghai Yu <yuxinghai@xxxxxxxxxxxxxx>
---
 daemon/remote.c              | 77 +++++++++++++++++++++++---------------------
 src/internal.h               | 69 +-----------------------------------------
 src/qemu/qemu_monitor.c      | 42 ++++++++++++------------
 src/qemu/qemu_monitor_json.c | 12 ++++---
 src/qemu/qemu_monitor_text.c |  8 ++---
 src/rpc/virkeepalive.c       | 42 ++++++++++++------------
 src/rpc/virnetclient.c       | 43 +++++++++++++------------
 src/rpc/virnetserverclient.c | 31 +++++++++---------
 src/rpc/virnetsocket.c       | 22 +++++++------
 src/rpc/virnettlscontext.c   | 42 +++++++++++++-----------
 src/util/vireventpoll.c      | 66 ++++++++++++++++++-------------------
 src/util/virobject.c         | 16 ++++++---
 12 files changed, 213 insertions(+), 263 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index b48d456..77e1f84 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -2752,9 +2752,9 @@ authfail:
     virReportError(VIR_ERR_AUTH_FAILED, "%s",
                    _("authentication failed"));
     virNetMessageSaveError(rerr);
-    PROBE(RPC_SERVER_CLIENT_AUTH_FAIL,
-          "client=%p auth=%d",
-          client, REMOTE_AUTH_SASL);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_fail(client, REMOTE_AUTH_SASL);
+#endif
     virObjectUnref(sasl);
     virMutexUnlock(&priv->lock);
     return -1;
@@ -2793,10 +2793,9 @@ remoteSASLFinish(virNetServerClientPtr client)
 
     VIR_DEBUG("Authentication successful %d", virNetServerClientGetFD(client));
 
-    PROBE(RPC_SERVER_CLIENT_AUTH_ALLOW,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_SASL, identity);
-
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_allow(client, REMOTE_AUTH_SASL, identity);
+#endif
     virObjectUnref(priv->sasl);
     priv->sasl = NULL;
 
@@ -2823,7 +2822,9 @@ remoteDispatchAuthSaslStart(virNetServerPtr server ATTRIBUTE_UNUSED,
     int rv = -1;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);
+#ifdef WITH_TRACE_PROBES
     const char *identity;
+#endif
 
     virMutexLock(&priv->lock);
 
@@ -2882,16 +2883,16 @@ remoteDispatchAuthSaslStart(virNetServerPtr server ATTRIBUTE_UNUSED,
     return 0;
 
 authfail:
-    PROBE(RPC_SERVER_CLIENT_AUTH_FAIL,
-          "client=%p auth=%d",
-          client, REMOTE_AUTH_SASL);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_fail(client, REMOTE_AUTH_SASL);
+#endif
     goto error;
 
 authdeny:
+#ifdef WITH_TRACE_PROBES
     identity = virNetSASLSessionGetIdentity(priv->sasl);
-    PROBE(RPC_SERVER_CLIENT_AUTH_DENY,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_SASL, identity);
+    trace_rpc_server_client_auth_deny(client, REMOTE_AUTH_SASL, identity);
+#endif
     goto error;
 
 error:
@@ -2921,7 +2922,9 @@ remoteDispatchAuthSaslStep(virNetServerPtr server ATTRIBUTE_UNUSED,
     int rv = -1;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);
+#ifdef WITH_TRACE_PROBES
     const char *identity;
+#endif
 
     virMutexLock(&priv->lock);
 
@@ -2980,16 +2983,16 @@ remoteDispatchAuthSaslStep(virNetServerPtr server ATTRIBUTE_UNUSED,
     return 0;
 
 authfail:
-    PROBE(RPC_SERVER_CLIENT_AUTH_FAIL,
-          "client=%p auth=%d",
-          client, REMOTE_AUTH_SASL);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_fail(client, REMOTE_AUTH_SASL);
+#endif
     goto error;
 
 authdeny:
+#ifdef WITH_TRACE_PROBES
     identity = virNetSASLSessionGetIdentity(priv->sasl);
-    PROBE(RPC_SERVER_CLIENT_AUTH_DENY,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_SASL, identity);
+    trace_rpc_server_client_auth_deny(client, REMOTE_AUTH_SASL, identity);
+#endif
     goto error;
 
 error:
@@ -3134,9 +3137,9 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
                   action, (long long) callerPid, callerUid, status);
         goto authdeny;
     }
-    PROBE(RPC_SERVER_CLIENT_AUTH_ALLOW,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_POLKIT, ident);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_allow(client,REMOTE_AUTH_POLKIT, ident);
+#endif
     VIR_INFO("Policy allowed action %s from pid %lld, uid %d",
              action, (long long) callerPid, callerUid);
     ret->complete = 1;
@@ -3169,15 +3172,15 @@ error:
     return -1;
 
 authfail:
-    PROBE(RPC_SERVER_CLIENT_AUTH_FAIL,
-          "client=%p auth=%d",
-          client, REMOTE_AUTH_POLKIT);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_fail(client, REMOTE_AUTH_POLKIT);
+#endif
     goto error;
 
 authdeny:
-    PROBE(RPC_SERVER_CLIENT_AUTH_DENY,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_POLKIT, ident);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_deny(client, REMOTE_AUTH_POLKIT, ident);
+#endif
     goto error;
 }
 #elif WITH_POLKIT0
@@ -3288,9 +3291,9 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
                   polkit_result_to_string_representation(pkresult));
         goto authdeny;
     }
-    PROBE(RPC_SERVER_CLIENT_AUTH_ALLOW,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_POLKIT, ident);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_allow(client, REMOTE_AUTH_POLKIT, identity);
+#endif
     VIR_INFO("Policy allowed action %s from pid %lld, uid %d, result %s",
              action, (long long) callerPid, callerUid,
              polkit_result_to_string_representation(pkresult));
@@ -3311,15 +3314,15 @@ error:
     return -1;
 
 authfail:
-    PROBE(RPC_SERVER_CLIENT_AUTH_FAIL,
-          "client=%p auth=%d",
-          client, REMOTE_AUTH_POLKIT);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_fail(client, REMOTE_AUTH_POLKIT);
+#endif
     goto error;
 
 authdeny:
-    PROBE(RPC_SERVER_CLIENT_AUTH_DENY,
-          "client=%p auth=%d identity=%s",
-          client, REMOTE_AUTH_POLKIT, ident);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_auth_deny(client, REMOTE_AUTH_POLKIT, identity);
+#endif
     goto error;
 }
 
diff --git a/src/internal.h b/src/internal.h
index 5a38448..042c896 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -366,75 +366,10 @@
 # define VIR_ROUND_UP(value, size) (VIR_DIV_UP(value, size) * (size))
 
 
-# if WITH_DTRACE_PROBES
+#ifdef WITH_TRACE_PROBES
 #  ifndef LIBVIRT_PROBES_H
 #   define LIBVIRT_PROBES_H
 #   include "libvirt_probes.h"
 #  endif /* LIBVIRT_PROBES_H */
-
-/* Systemtap 1.2 headers have a bug where they cannot handle a
- * variable declared with array type.  Work around this by casting all
- * arguments.  This is some gross use of the preprocessor because
- * PROBE is a var-arg macro, but it is better than the alternative of
- * making all callers to PROBE have to be aware of the issues.  And
- * hopefully, if we ever add a call to PROBE with other than 9
- * end arguments, you can figure out the pattern to extend this hack.
- */
-#  define VIR_COUNT_ARGS(...) VIR_ARG11(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
-#  define VIR_ARG11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) _11
-#  define VIR_ADD_CAST_EXPAND(a, b, ...) VIR_ADD_CAST_PASTE(a, b, __VA_ARGS__)
-#  define VIR_ADD_CAST_PASTE(a, b, ...) a##b(__VA_ARGS__)
-
-/* The double cast is necessary to silence gcc warnings; any pointer
- * can safely go to intptr_t and back to void *, which collapses
- * arrays into pointers; while any integer can be widened to intptr_t
- * then cast to void *.  */
-#  define VIR_ADD_CAST(a) ((void *)(intptr_t)(a))
-#  define VIR_ADD_CAST1(a)                                  \
-    VIR_ADD_CAST(a)
-#  define VIR_ADD_CAST2(a, b)                               \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b)
-#  define VIR_ADD_CAST3(a, b, c)                            \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c)
-#  define VIR_ADD_CAST4(a, b, c, d)                         \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c),      \
-    VIR_ADD_CAST(d)
-#  define VIR_ADD_CAST5(a, b, c, d, e)                      \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c),      \
-    VIR_ADD_CAST(d), VIR_ADD_CAST(e)
-#  define VIR_ADD_CAST6(a, b, c, d, e, f)                   \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c),      \
-    VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f)
-#  define VIR_ADD_CAST7(a, b, c, d, e, f, g)                \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c),      \
-    VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f),      \
-    VIR_ADD_CAST(g)
-#  define VIR_ADD_CAST8(a, b, c, d, e, f, g, h)             \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c),      \
-    VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f),      \
-    VIR_ADD_CAST(g), VIR_ADD_CAST(h)
-#  define VIR_ADD_CAST9(a, b, c, d, e, f, g, h, i)          \
-    VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c),      \
-    VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f),      \
-    VIR_ADD_CAST(g), VIR_ADD_CAST(h), VIR_ADD_CAST(i)
-
-#  define VIR_ADD_CASTS(...)                                            \
-    VIR_ADD_CAST_EXPAND(VIR_ADD_CAST, VIR_COUNT_ARGS(__VA_ARGS__),      \
-                        __VA_ARGS__)
-
-#  define PROBE_EXPAND(NAME, ARGS) NAME(ARGS)
-#  define PROBE(NAME, FMT, ...)                              \
-    VIR_DEBUG_INT(VIR_LOG_FROM_TRACE,                        \
-                  __FILE__, __LINE__, __func__,              \
-                  #NAME ": " FMT, __VA_ARGS__);              \
-    if (LIBVIRT_ ## NAME ## _ENABLED()) {                    \
-        PROBE_EXPAND(LIBVIRT_ ## NAME,                       \
-                     VIR_ADD_CASTS(__VA_ARGS__));            \
-    }
-# else
-#  define PROBE(NAME, FMT, ...)                              \
-    VIR_DEBUG_INT(VIR_LOG_FROM_TRACE,                        \
-                  __FILE__, __LINE__, __func__,              \
-                  #NAME ": " FMT, __VA_ARGS__);
 # endif
 
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a2769db..d874710 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -42,7 +42,7 @@
 #include "virobject.h"
 #include "virstring.h"
 
-#ifdef WITH_DTRACE_PROBES
+#ifdef WITH_TRACE_PROBES
 # include "libvirt_qemu_probes.h"
 #endif
 
@@ -392,8 +392,9 @@ qemuMonitorIOProcess(qemuMonitorPtr mon)
 # endif
 #endif
 
-    PROBE(QEMU_MONITOR_IO_PROCESS,
-          "mon=%p buf=%s len=%zu", mon, mon->buffer, mon->bufferOffset);
+#ifdef WITH_TRACE_PROBES
+    trace_qemu_monitor_io_process(mon, mon->buffer, mon->bufferOffset);
+#endif
 
     if (mon->json)
         len = qemuMonitorJSONIOProcess(mon,
@@ -496,17 +497,17 @@ qemuMonitorIOWrite(qemuMonitorPtr mon)
                                         mon->msg->txLength - mon->msg->txOffset,
                                         mon->msg->txFD);
 
-    PROBE(QEMU_MONITOR_IO_WRITE,
-          "mon=%p buf=%s len=%d ret=%d errno=%d",
-          mon,
-          mon->msg->txBuffer + mon->msg->txOffset,
-          mon->msg->txLength - mon->msg->txOffset,
-          done, errno);
+#ifdef WITH_TRACE_PROBES
+    trace_qemu_monitor_io_write(mon,
+                                mon->msg->txBuffer + mon->msg->txOffset,
+                                mon->msg->txLength - mon->msg->txOffset,
+                                done, errno);
+#endif
 
     if (mon->msg->txFD != -1)
-        PROBE(QEMU_MONITOR_IO_SEND_FD,
-              "mon=%p fd=%d ret=%d errno=%d",
-              mon, mon->msg->txFD, done, errno);
+#ifdef WITH_TRACE_PROBES
+        trace_qemu_monitor_io_send_fd(mon, mon->msg->txFD, done, errno);
+#endif
 
     if (done < 0) {
         if (errno == EAGAIN)
@@ -819,9 +820,9 @@ qemuMonitorOpenInternal(virDomainObjPtr vm,
         goto cleanup;
     }
 
-    PROBE(QEMU_MONITOR_NEW,
-          "mon=%p refs=%d fd=%d",
-          mon, mon->parent.parent.u.s.refs, mon->fd);
+#ifdef WITH_TRACE_PROBES
+    trace_qemu_monitor_new(mon, mon->parent.parent.u.s.refs, mon->fd);
+#endif
     virObjectUnlock(mon);
 
     return mon;
@@ -892,8 +893,9 @@ void qemuMonitorClose(qemuMonitorPtr mon)
         return;
 
     virObjectLock(mon);
-    PROBE(QEMU_MONITOR_CLOSE,
-          "mon=%p refs=%d", mon, mon->parent.parent.u.s.refs);
+#ifdef WITH_TRACE_PROBES
+    trace_qemu_monitor_close(mon, mon->parent.parent.u.s.refs);
+#endif
 
     if (mon->fd >= 0) {
         if (mon->watch) {
@@ -954,9 +956,9 @@ int qemuMonitorSend(qemuMonitorPtr mon,
     mon->msg = msg;
     qemuMonitorUpdateWatch(mon);
 
-    PROBE(QEMU_MONITOR_SEND_MSG,
-          "mon=%p msg=%s fd=%d",
-          mon, mon->msg->txBuffer, mon->msg->txFD);
+#ifdef WITH_TRACE_PROBES
+    trace_qemu_monitor_send_msg(mon, mon->msg->txBuffer, mon->msg->txFD);
+#endif
 
     while (!mon->msg->finished) {
         if (virCondWait(&mon->notify, &mon->parent.lock) < 0) {
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 9a5b812..3cf5e1a 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -44,7 +44,7 @@
 #include "virstring.h"
 #include "cpu/cpu_x86.h"
 
-#ifdef WITH_DTRACE_PROBES
+#ifdef WITH_TRACE_PROBES
 # include "libvirt_qemu_probes.h"
 #endif
 
@@ -168,13 +168,15 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
     if (virJSONValueObjectHasKey(obj, "QMP") == 1) {
         ret = 0;
     } else if (virJSONValueObjectHasKey(obj, "event") == 1) {
-        PROBE(QEMU_MONITOR_RECV_EVENT,
-              "mon=%p event=%s", mon, line);
+#ifdef WITH_TRACE_PROBES
+        trace_qemu_monitor_recv_event(mon, line);
+#endif
         ret = qemuMonitorJSONIOProcessEvent(mon, obj);
     } else if (virJSONValueObjectHasKey(obj, "error") == 1 ||
                virJSONValueObjectHasKey(obj, "return") == 1) {
-        PROBE(QEMU_MONITOR_RECV_REPLY,
-              "mon=%p reply=%s", mon, line);
+#ifdef WITH_TRACE_PROBES
+        trace_qemu_monitor_recv_reply(mon, line);
+#endif
         if (msg) {
             msg->rxObject = obj;
             msg->finished = 1;
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 7b81079..9b3d772 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -42,7 +42,7 @@
 #include "virbuffer.h"
 #include "virstring.h"
 
-#ifdef WITH_DTRACE_PROBES
+#ifdef WITH_TRACE_PROBES
 # include "libvirt_qemu_probes.h"
 #endif
 
@@ -201,9 +201,9 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                 VIR_DEBUG("Finished 0 byte reply");
 #endif
             }
-            PROBE(QEMU_MONITOR_RECV_REPLY,
-                  "mon=%p reply=%s",
-                  mon, msg->rxBuffer);
+#ifdef WITH_TRACE_PROBES
+            trace_qemu_monitor_recv_reply(mon, msg->rxBuffer);
+#endif
             msg->finished = 1;
             used += end - (data + used);
             used += strlen(BASIC_PROMPT);
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index 8ae5c6c..265b7a6 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -99,9 +99,9 @@ virKeepAliveMessage(virKeepAlivePtr ka, int proc)
     }
 
     VIR_DEBUG("Sending keepalive %s to client %p", procstr, ka->client);
-    PROBE(RPC_KEEPALIVE_SEND,
-          "ka=%p client=%p prog=%d vers=%d proc=%d",
-          ka, ka->client, msg->header.prog, msg->header.vers, msg->header.proc);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_keepalive_send(ka, ka->client, msg->header.prog, msg->header.vers, msg->header.proc);
+#endif
 
     return msg;
 
@@ -128,9 +128,9 @@ virKeepAliveTimerInternal(virKeepAlivePtr ka,
     }
 
     timeval = now - ka->lastPacketReceived;
-    PROBE(RPC_KEEPALIVE_TIMEOUT,
-          "ka=%p client=%p countToDeath=%d idle=%d",
-          ka, ka->client, ka->countToDeath, timeval);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_keepalive_timeout(ka, ka->client, ka->countToDeath, timeval);
+#endif
 
     if (ka->countToDeath == 0) {
         VIR_WARN("No response from client %p after %d keepalive messages in"
@@ -210,9 +210,9 @@ virKeepAliveNew(int interval,
     ka->deadCB = deadCB;
     ka->freeCB = freeCB;
 
-    PROBE(RPC_KEEPALIVE_NEW,
-          "ka=%p client=%p",
-          ka, ka->client);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_keepalive_new(ka, ka->client);
+#endif
 
     return ka;
 }
@@ -223,8 +223,9 @@ virKeepAliveDispose(void *obj)
 {
     virKeepAlivePtr ka = obj;
 
-    PROBE(RPC_KEEPALIVE_DISPOSE,
-          "ka=%p", ka);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_keepalive_dispose(ka);
+#endif
 
     ka->freeCB(ka->client);
 }
@@ -271,9 +272,9 @@ virKeepAliveStart(virKeepAlivePtr ka,
         goto cleanup;
     }
 
-    PROBE(RPC_KEEPALIVE_START,
-          "ka=%p client=%p interval=%d count=%u",
-          ka, ka->client, interval, count);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_keepalive_start(ka, ka->client, interval, count);
+#endif
 
     now = time(NULL);
     delay = now - ka->lastPacketReceived;
@@ -302,9 +303,9 @@ virKeepAliveStop(virKeepAlivePtr ka)
 {
     virObjectLock(ka);
 
-    PROBE(RPC_KEEPALIVE_STOP,
-          "ka=%p client=%p",
-          ka, ka->client);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_keepalive_stop(ka, ka->client);
+#endif
 
     if (ka->timer > 0) {
         virEventRemoveTimeout(ka->timer);
@@ -385,10 +386,9 @@ virKeepAliveCheckMessage(virKeepAlivePtr ka,
     if (msg->header.prog == KEEPALIVE_PROGRAM &&
         msg->header.vers == KEEPALIVE_PROTOCOL_VERSION &&
         msg->header.type == VIR_NET_MESSAGE) {
-        PROBE(RPC_KEEPALIVE_RECEIVED,
-              "ka=%p client=%p prog=%d vers=%d proc=%d",
-              ka, ka->client, msg->header.prog,
-              msg->header.vers, msg->header.proc);
+#ifdef WITH_TRACE_PROBES
+        trace_rpc_keepalive_received(ka, ka->client, msg->header.prog, msg->header.vers, msg->header.proc);
+#endif
         ret = true;
         switch (msg->header.proc) {
         case KEEPALIVE_PROC_PING:
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 9deec9e..51799cd 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -321,9 +321,9 @@ static virNetClientPtr virNetClientNew(virNetSocketPtr sock,
     if (VIR_STRDUP(client->hostname, hostname) < 0)
         goto error;
 
-    PROBE(RPC_CLIENT_NEW,
-          "client=%p sock=%p",
-          client, client->sock);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_client_new(client, client->sock);
+#endif
     return client;
 
 error:
@@ -595,8 +595,9 @@ void virNetClientDispose(void *obj)
     virNetClientPtr client = obj;
     size_t i;
 
-    PROBE(RPC_CLIENT_DISPOSE,
-          "client=%p", client);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_client_dispose(client);
+#endif
 
     if (client->closeFf)
         client->closeFf(client->closeOpaque);
@@ -1116,11 +1117,12 @@ virNetClientCallDispatch(virNetClientPtr client)
 {
     virNetMessagePtr response = NULL;
 
-    PROBE(RPC_CLIENT_MSG_RX,
-          "client=%p len=%zu prog=%u vers=%u proc=%u type=%u status=%u serial=%u",
-          client, client->msg.bufferLength,
-          client->msg.header.prog, client->msg.header.vers, client->msg.header.proc,
-          client->msg.header.type, client->msg.header.status, client->msg.header.serial);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_client_msg_rx(client, client->msg.bufferLength, client->msg.header.prog,
+                            client->msg.header.vers, client->msg.header.proc,
+                            client->msg.header.type, client->msg.header.status,
+                            client->msg.header.serial);
+#endif
 
     if (virKeepAliveCheckMessage(client->keepalive, &client->msg, &response)) {
         if (response &&
@@ -1918,12 +1920,11 @@ virNetClientQueueNonBlocking(virNetClientPtr client,
 {
     virNetClientCallPtr call;
 
-    PROBE(RPC_CLIENT_MSG_TX_QUEUE,
-          "client=%p len=%zu prog=%u vers=%u proc=%u"
-          " type=%u status=%u serial=%u",
-          client, msg->bufferLength,
-          msg->header.prog, msg->header.vers, msg->header.proc,
-          msg->header.type, msg->header.status, msg->header.serial);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_client_msg_tx_queue(client, msg->bufferLength,
+                                  msg->header.prog, msg->header.vers, msg->header.proc,
+                                  msg->header.type, msg->header.status, msg->header.serial);
+#endif
 
     if (!(call = virNetClientCallNew(msg, false, true)))
         return -1;
@@ -1945,11 +1946,11 @@ static int virNetClientSendInternal(virNetClientPtr client,
     virNetClientCallPtr call;
     int ret = -1;
 
-    PROBE(RPC_CLIENT_MSG_TX_QUEUE,
-          "client=%p len=%zu prog=%u vers=%u proc=%u type=%u status=%u serial=%u",
-          client, msg->bufferLength,
-          msg->header.prog, msg->header.vers, msg->header.proc,
-          msg->header.type, msg->header.status, msg->header.serial);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_client_msg_tx_queue(client, msg->bufferLength,
+                                  msg->header.prog, msg->header.vers, msg->header.proc,
+                                  msg->header.type, msg->header.status, msg->header.serial);
+#endif
 
     if (!client->sock || client->wantClose) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 52b4941..5a4bc8e 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -379,9 +379,9 @@ virNetServerClientNewInternal(virNetSocketPtr sock,
         goto error;
     client->nrequests = 1;
 
-    PROBE(RPC_SERVER_CLIENT_NEW,
-          "client=%p sock=%p",
-          client, client->sock);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_new(client, client->sock);
+#endif
 
     return client;
 
@@ -907,8 +907,9 @@ void virNetServerClientDispose(void *obj)
 {
     virNetServerClientPtr client = obj;
 
-    PROBE(RPC_SERVER_CLIENT_DISPOSE,
-          "client=%p", client);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_server_client_dispose(client);
+#endif
 
     virObjectUnref(client->identity);
 
@@ -1201,11 +1202,11 @@ readmore:
 
         /* Definitely finished reading, so remove from queue */
         virNetMessageQueueServe(&client->rx);
-        PROBE(RPC_SERVER_CLIENT_MSG_RX,
-              "client=%p len=%zu prog=%u vers=%u proc=%u type=%u status=%u serial=%u",
-              client, msg->bufferLength,
-              msg->header.prog, msg->header.vers, msg->header.proc,
-              msg->header.type, msg->header.status, msg->header.serial);
+#ifdef WITH_TRACE_PROBES
+        trace_rpc_server_client_msg_rx(client, msg->bufferLength,
+                                       msg->header.prog,msg->header.vers, msg->header.proc,
+                                       msg->header.type, msg->header.status, msg->header.serial);
+#endif
 
         if (virKeepAliveCheckMessage(client->keepalive, msg, &response)) {
             virNetMessageFree(msg);
@@ -1458,11 +1459,11 @@ virNetServerClientSendMessageLocked(virNetServerClientPtr client,
 
     msg->donefds = 0;
     if (client->sock && !client->wantClose) {
-        PROBE(RPC_SERVER_CLIENT_MSG_TX_QUEUE,
-              "client=%p len=%zu prog=%u vers=%u proc=%u type=%u status=%u serial=%u",
-              client, msg->bufferLength,
-              msg->header.prog, msg->header.vers, msg->header.proc,
-              msg->header.type, msg->header.status, msg->header.serial);
+#ifdef WITH_TRACE_PROBES
+        trace_rpc_server_client_msg_tx_queue(client, msg->bufferLength,
+                                             msg->header.prog, msg->header.vers, msg->header.proc,
+                                             msg->header.type, msg->header.status, msg->header.serial);
+#endif
         virNetMessageQueuePush(&client->tx, msg);
 
         virNetServerClientUpdateEvent(client);
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 04bf25a..f18059a 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -199,10 +199,9 @@ static virNetSocketPtr virNetSocketNew(virSocketAddrPtr localAddr,
 
     sock->client = isClient;
 
-    PROBE(RPC_SOCKET_NEW,
-          "sock=%p fd=%d errfd=%d pid=%lld localAddr=%s, remoteAddr=%s",
-          sock, fd, errfd, (long long) pid,
-          NULLSTR(sock->localAddrStr), NULLSTR(sock->remoteAddrStr));
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_socket_new(sock, fd, errfd, (long long)pid, NULLSTR(sock->localAddrStr), NULLSTR(sock->remoteAddrStr));
+#endif
 
     return sock;
 
@@ -1016,8 +1015,9 @@ void virNetSocketDispose(void *obj)
 {
     virNetSocketPtr sock = obj;
 
-    PROBE(RPC_SOCKET_DISPOSE,
-          "sock=%p", sock);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_socket_dispose(sock);
+#endif
 
     if (sock->watch > 0) {
         virEventRemoveHandle(sock->watch);
@@ -1640,8 +1640,9 @@ int virNetSocketSendFD(virNetSocketPtr sock, int fd)
         return -1;
     }
     virObjectLock(sock);
-    PROBE(RPC_SOCKET_SEND_FD,
-          "sock=%p fd=%d", sock, fd);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_socket_send_fd(sock, fd);
+#endif
     if (sendfd(sock->fd, fd) < 0) {
         if (errno == EAGAIN)
             ret = 0;
@@ -1683,8 +1684,9 @@ int virNetSocketRecvFD(virNetSocketPtr sock, int *fd)
                                  _("Failed to recv file descriptor"));
         goto cleanup;
     }
-    PROBE(RPC_SOCKET_RECV_FD,
-          "sock=%p fd=%d", sock, *fd);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_socket_recv_fd( sock, *fd);
+#endif
     ret = 1;
 
 cleanup:
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index cd69794..7716dd2 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -773,9 +773,9 @@ static virNetTLSContextPtr virNetTLSContextNew(const char *cacert,
     ctxt->x509dnWhitelist = x509dnWhitelist;
     ctxt->isServer = isServer;
 
-    PROBE(RPC_TLS_CONTEXT_NEW,
-          "ctxt=%p cacert=%s cacrl=%s cert=%s key=%s sanityCheckCert=%d requireValidCert=%d isServer=%d",
-          ctxt, cacert, NULLSTR(cacrl), cert, key, sanityCheckCert, requireValidCert, isServer);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_context_new(ctxt, cacert, NULLSTR(cacrl), cert, key, sanityCheckCert, requireValidCert, isServer);
+#endif
 
     return ctxt;
 
@@ -993,7 +993,9 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt,
     unsigned int nCerts;
     size_t i;
     char dname[256];
+#ifdef WITH_TRACE_PROBES
     char *dnameptr = dname;
+#endif
     size_t dnamesize = sizeof(dname);
 
     memset(dname, 0, dnamesize);
@@ -1107,23 +1109,23 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt,
         gnutls_x509_crt_deinit(cert);
     }
 
-    PROBE(RPC_TLS_CONTEXT_SESSION_ALLOW,
-          "ctxt=%p sess=%p dname=%s",
-          ctxt, sess, dnameptr);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_context_session_allow(ctxt, sess, dnameptr);
+#endif
 
     return 0;
 
 authdeny:
-    PROBE(RPC_TLS_CONTEXT_SESSION_DENY,
-          "ctxt=%p sess=%p dname=%s",
-          ctxt, sess, dnameptr);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_context_session_deny(ctxt, sess, dnameptr);
+#endif
 
     return -1;
 
 authfail:
-    PROBE(RPC_TLS_CONTEXT_SESSION_FAIL,
-          "ctxt=%p sess=%p",
-          ctxt, sess);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_context_session_fail(ctxt, sess);
+#endif
 
     return -1;
 }
@@ -1160,8 +1162,9 @@ void virNetTLSContextDispose(void *obj)
 {
     virNetTLSContextPtr ctxt = obj;
 
-    PROBE(RPC_TLS_CONTEXT_DISPOSE,
-          "ctxt=%p", ctxt);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_context_dispose(ctxt);
+#endif
 
     gnutls_dh_params_deinit(ctxt->dhParams);
     gnutls_certificate_free_credentials(ctxt->x509cred);
@@ -1254,9 +1257,9 @@ virNetTLSSessionPtr virNetTLSSessionNew(virNetTLSContextPtr ctxt,
 
     sess->isServer = ctxt->isServer;
 
-    PROBE(RPC_TLS_SESSION_NEW,
-          "sess=%p ctxt=%p hostname=%s isServer=%d",
-          sess, ctxt, hostname, sess->isServer);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_session_new(sess, ctxt, hostname, sess->isServer);
+#endif
 
     return sess;
 
@@ -1424,8 +1427,9 @@ void virNetTLSSessionDispose(void *obj)
 {
     virNetTLSSessionPtr sess = obj;
 
-    PROBE(RPC_TLS_SESSION_DISPOSE,
-          "sess=%p", sess);
+#ifdef WITH_TRACE_PROBES
+    trace_rpc_tls_session_dispose( sess);
+#endif
 
     VIR_FREE(sess->x509dname);
     VIR_FREE(sess->hostname);
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index 8a4c8bc..89db91c 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -131,9 +131,9 @@ int virEventPollAddHandle(int fd, int events,
 
     virEventPollInterruptLocked();
 
-    PROBE(EVENT_POLL_ADD_HANDLE,
-          "watch=%d fd=%d events=%d cb=%p opaque=%p ff=%p",
-          watch, fd, events, cb, opaque, ff);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_add_handle(watch, fd, events, cb, opaque, ff);
+#endif
     virMutexUnlock(&eventLoop.lock);
 
     return watch;
@@ -142,9 +142,9 @@ int virEventPollAddHandle(int fd, int events,
 void virEventPollUpdateHandle(int watch, int events) {
     size_t i;
     bool found = false;
-    PROBE(EVENT_POLL_UPDATE_HANDLE,
-          "watch=%d events=%d",
-          watch, events);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_update_handle(watch, events);
+#endif
 
     if (watch <= 0) {
         VIR_WARN("Ignoring invalid update watch %d", watch);
@@ -175,9 +175,9 @@ void virEventPollUpdateHandle(int watch, int events) {
  */
 int virEventPollRemoveHandle(int watch) {
     size_t i;
-    PROBE(EVENT_POLL_REMOVE_HANDLE,
-          "watch=%d",
-          watch);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_remove_handle(watch);
+#endif
 
     if (watch <= 0) {
         VIR_WARN("Ignoring invalid remove watch %d", watch);
@@ -243,9 +243,9 @@ int virEventPollAddTimeout(int frequency,
     ret = nextTimer-1;
     virEventPollInterruptLocked();
 
-    PROBE(EVENT_POLL_ADD_TIMEOUT,
-          "timer=%d frequency=%d cb=%p opaque=%p ff=%p",
-          ret, frequency, cb, opaque, ff);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_add_timeout(ret, frequency, cb, opaque, ff);
+#endif
     virMutexUnlock(&eventLoop.lock);
     return ret;
 }
@@ -255,9 +255,9 @@ void virEventPollUpdateTimeout(int timer, int frequency)
     unsigned long long now;
     size_t i;
     bool found = false;
-    PROBE(EVENT_POLL_UPDATE_TIMEOUT,
-          "timer=%d frequency=%d",
-          timer, frequency);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_update_timeout(timer, frequency);
+#endif
 
     if (timer <= 0) {
         VIR_WARN("Ignoring invalid update timer %d", timer);
@@ -295,9 +295,9 @@ void virEventPollUpdateTimeout(int timer, int frequency)
  */
 int virEventPollRemoveTimeout(int timer) {
     size_t i;
-    PROBE(EVENT_POLL_REMOVE_TIMEOUT,
-          "timer=%d",
-          timer);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_remove_timeout(timer);
+#endif
 
     if (timer <= 0) {
         VIR_WARN("Ignoring invalid remove timer %d", timer);
@@ -444,9 +444,9 @@ static int virEventPollDispatchTimeouts(void)
             eventLoop.timeouts[i].expiresAt =
                 now + eventLoop.timeouts[i].frequency;
 
-            PROBE(EVENT_POLL_DISPATCH_TIMEOUT,
-                  "timer=%d",
-                  timer);
+#ifdef WITH_TRACE_PROBES
+            trace_event_poll_dispatch_timeout(timer);
+#endif
             virMutexUnlock(&eventLoop.lock);
             (cb)(timer, opaque);
             virMutexLock(&eventLoop.lock);
@@ -494,9 +494,9 @@ static int virEventPollDispatchHandles(int nfds, struct pollfd *fds) {
             int watch = eventLoop.handles[i].watch;
             void *opaque = eventLoop.handles[i].opaque;
             int hEvents = virEventPollFromNativeEvents(fds[n].revents);
-            PROBE(EVENT_POLL_DISPATCH_HANDLE,
-                  "watch=%d events=%d",
-                  watch, hEvents);
+#ifdef WITH_TRACE_PROBES
+            trace_event_poll_dispatch_handle( watch, hEvents);
+#endif
             virMutexUnlock(&eventLoop.lock);
             (cb)(watch, fds[n].fd, hEvents, opaque);
             virMutexLock(&eventLoop.lock);
@@ -525,9 +525,9 @@ static void virEventPollCleanupTimeouts(void) {
             continue;
         }
 
-        PROBE(EVENT_POLL_PURGE_TIMEOUT,
-              "timer=%d",
-              eventLoop.timeouts[i].timer);
+#ifdef WITH_TRACE_PROBES
+        trace_event_poll_purge_timeout(eventLoop.timeouts[i].timer);
+#endif
         if (eventLoop.timeouts[i].ff) {
             virFreeCallback ff = eventLoop.timeouts[i].ff;
             void *opaque = eventLoop.timeouts[i].opaque;
@@ -573,9 +573,9 @@ static void virEventPollCleanupHandles(void) {
             continue;
         }
 
-        PROBE(EVENT_POLL_PURGE_HANDLE,
-              "watch=%d",
-              eventLoop.handles[i].watch);
+#ifdef WITH_TRACE_PROBES
+        trace_event_poll_purge_handle(eventLoop.handles[i].watch);
+#endif
         if (eventLoop.handles[i].ff) {
             virFreeCallback ff = eventLoop.handles[i].ff;
             void *opaque = eventLoop.handles[i].opaque;
@@ -625,9 +625,9 @@ int virEventPollRunOnce(void) {
     virMutexUnlock(&eventLoop.lock);
 
  retry:
-    PROBE(EVENT_POLL_RUN,
-          "nhandles=%d timeout=%d",
-          nfds, timeout);
+#ifdef WITH_TRACE_PROBES
+    trace_event_poll_run(nfds, timeout);
+#endif
     ret = poll(fds, nfds, timeout);
     if (ret < 0) {
         EVENT_DEBUG("Poll got error event %d", errno);
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 4f83bc1..349bd6a 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -196,7 +196,9 @@ void *virObjectNew(virClassPtr klass)
     obj->klass = klass;
     virAtomicIntSet(&obj->u.s.refs, 1);
 
-    PROBE(OBJECT_NEW, "obj=%p classname=%s", obj, obj->klass->name);
+#ifdef WITH_TRACE_PROBES
+    trace_object_new( obj, obj->klass->name);
+#endif
 
     return obj;
 }
@@ -253,9 +255,13 @@ bool virObjectUnref(void *anyobj)
         return false;
 
     bool lastRef = virAtomicIntDecAndTest(&obj->u.s.refs);
-    PROBE(OBJECT_UNREF, "obj=%p", obj);
+#ifdef WITH_TRACE_PROBES
+    trace_object_unref(obj);
+#endif
     if (lastRef) {
-        PROBE(OBJECT_DISPOSE, "obj=%p", obj);
+#ifdef WITH_TRACE_PROBES
+        trace_object_dispose(obj);
+#endif
         virClassPtr klass = obj->klass;
         while (klass) {
             if (klass->dispose)
@@ -290,7 +296,9 @@ void *virObjectRef(void *anyobj)
     if (!obj)
         return NULL;
     virAtomicIntInc(&obj->u.s.refs);
-    PROBE(OBJECT_REF, "obj=%p", obj);
+#ifdef WITH_TRACE_PROBES
+    trace_object_ref(obj);
+#endif
     return anyobj;
 }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]