trace: remove 'trace_event_get_state' wrapper

The 'trace_event_get_state' macro is a wrapper around the
'trace_event_get_state_dynamic_by_id' macro, which is a direct
check of the _TRACE_...._DSTATE global variable.

The only code that should be using this is the generated trace
probes, but the name looks rather appealing causing it to be
mistakenly used in other places, instead of the recommended
'trace_event_get_state_dynamic_backends'.

Removing the 'trace_event_get_state' macro reduces the potential
for confusion.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20261102142844.3464712-26-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Daniel P. Berrangé authored and Stefan Hajnoczi committed 2026-11-04 13:19:12 -05:00
1 parent 6d9f20e060
commit ddfa19c506
9 files changed
+16 -24

No files matched your search

+2 -1
View File
@@ -26,7 +26,8 @@ PUBLIC If exists and is set to 'True', the backend is
considered "public".
CHECK_TRACE_EVENT_GET_STATE If exists and is set to 'True', the backend-specific
code inside the tracepoint is emitted within an
``if trace_event_get_state()`` conditional.
``if trace_event_get_state_dynamic_by_id()``
conditional.
=========================== ====================================================
+1 -1
View File
@@ -28,7 +28,7 @@ def generate_h(event, group):
if len(event.args) > 0:
argnames = ", " + argnames
out(' if (trace_event_get_state(%(event_id)s) &&',
out(' if (trace_event_get_state_dynamic_by_id(%(event_id)s) &&',
' qemu_loglevel_mask(LOG_TRACE)) {',
'#line %(event_lineno)d "%(event_filename)s"',
' qemu_log("%(name)s " %(fmt)s "\\n"%(argnames)s);',
+1 -1
View File
@@ -66,7 +66,7 @@ def generate(events, backend, group):
if backend.check_trace_event_get_state:
event_id = 'TRACE_' + e.name.upper()
cond = "trace_event_get_state(%s)" % event_id
cond = "trace_event_get_state_dynamic_by_id(%s)" % event_id
out(' if (%(cond)s) {',
cond=cond)
backend.generate(e, group, check_trace_event_get_state=True)
+4 -4
View File
@@ -51,14 +51,14 @@ void _simple_trace_test_wibble(void *context, int value);
static inline void trace_test_blah(void *context, const char *filename)
{
QEMU_TEST_BLAH(context, filename);
if (trace_event_get_state(TRACE_TEST_BLAH) &&
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) &&
qemu_loglevel_mask(LOG_TRACE)) {
#line 4 "trace-events"
qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
#line 59 "all.h"
}
tracepoint(qemu, test_blah, context, filename);
if (trace_event_get_state(TRACE_TEST_BLAH)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
#line 4 "trace-events"
ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
#line 65 "all.h"
@@ -80,14 +80,14 @@ static inline void trace_test_blah(void *context, const char *filename)
static inline void trace_test_wibble(void *context, int value)
{
QEMU_TEST_WIBBLE(context, value);
if (trace_event_get_state(TRACE_TEST_WIBBLE) &&
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) &&
qemu_loglevel_mask(LOG_TRACE)) {
#line 5 "trace-events"
qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
#line 88 "all.h"
}
tracepoint(qemu, test_wibble, context, value);
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
#line 5 "trace-events"
ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
#line 94 "all.h"
+2 -2
View File
@@ -19,7 +19,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
static inline void trace_test_blah(void *context, const char *filename)
{
if (trace_event_get_state(TRACE_TEST_BLAH)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
#line 4 "trace-events"
ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
#line 26 "ftrace.h"
@@ -32,7 +32,7 @@ static inline void trace_test_blah(void *context, const char *filename)
static inline void trace_test_wibble(void *context, int value)
{
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
#line 5 "trace-events"
ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
#line 39 "ftrace.h"
+2 -2
View File
@@ -20,7 +20,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
static inline void trace_test_blah(void *context, const char *filename)
{
if (trace_event_get_state(TRACE_TEST_BLAH) &&
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) &&
qemu_loglevel_mask(LOG_TRACE)) {
#line 4 "trace-events"
qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
@@ -35,7 +35,7 @@ static inline void trace_test_blah(void *context, const char *filename)
static inline void trace_test_wibble(void *context, int value)
{
if (trace_event_get_state(TRACE_TEST_WIBBLE) &&
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) &&
qemu_loglevel_mask(LOG_TRACE)) {
#line 5 "trace-events"
qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
+2 -2
View File
@@ -20,7 +20,7 @@ void _simple_trace_test_wibble(void *context, int value);
static inline void trace_test_blah(void *context, const char *filename)
{
if (trace_event_get_state(TRACE_TEST_BLAH)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
_simple_trace_test_blah(context, filename);
}
}
@@ -31,7 +31,7 @@ static inline void trace_test_blah(void *context, const char *filename)
static inline void trace_test_wibble(void *context, int value)
{
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
_simple_trace_test_wibble(context, value);
}
}
+2 -2
View File
@@ -19,7 +19,7 @@ extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
static inline void trace_test_blah(void *context, const char *filename)
{
if (trace_event_get_state(TRACE_TEST_BLAH)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH)) {
#line 4 "trace-events"
syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
#line 26 "syslog.h"
@@ -32,7 +32,7 @@ static inline void trace_test_blah(void *context, const char *filename)
static inline void trace_test_wibble(void *context, int value)
{
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
if (trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE)) {
#line 5 "trace-events"
syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
#line 39 "syslog.h"
-9
View File
@@ -97,15 +97,6 @@ static uint32_t trace_event_get_id(TraceEvent *ev);
*/
static const char * trace_event_get_name(TraceEvent *ev);
/**
* trace_event_get_state:
* @id: Event identifier name.
*
* Get the tracing state of an event, both static and the QEMU dynamic state.
*/
#define trace_event_get_state(id) \
(trace_event_get_state_dynamic_by_id(id))
/**
* trace_event_get_state_backends:
* @id: Event identifier name.