From: Mathieu Desnoyers Date: Thu, 6 May 2021 20:42:52 +0000 (-0400) Subject: events.h API const-ness X-Git-Url: https://git.lttng.org/?p=lttng-modules.git;a=commitdiff_plain;h=4f1d1ee53c08ab61f0208aeed80303a0dfec2c48 events.h API const-ness Ensure events.h definitions, fields, and arguments referring to const arrays of pointers are const. Signed-off-by: Mathieu Desnoyers Change-Id: Id1f9a736de72220f7576d9780b82ab7879eac300 --- diff --git a/include/lttng/events.h b/include/lttng/events.h index 1eda3aca..0f6b5ab9 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -109,21 +109,21 @@ struct lttng_kernel_type_sequence { struct lttng_kernel_type_struct { struct lttng_kernel_type_common parent; unsigned int nr_fields; - const struct lttng_kernel_event_field **fields; /* Array of pointers to fields. */ + const struct lttng_kernel_event_field * const *fields; /* Array of pointers to fields. */ unsigned int alignment; }; struct lttng_kernel_type_variant { struct lttng_kernel_type_common parent; const char *tag_name; /* Tag field name. If NULL, use previous field. */ - const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */ + const struct lttng_kernel_event_field * const *choices; /* Array of pointers to fields. */ unsigned int nr_choices; unsigned int alignment; }; struct lttng_kernel_enum_desc { const char *name; - const struct lttng_kernel_enum_entry **entries; + const struct lttng_kernel_enum_entry * const *entries; unsigned int nr_entries; const struct lttng_kernel_probe_desc *probe_desc; }; @@ -300,7 +300,7 @@ struct lttng_kernel_probe_ctx { struct lttng_kernel_tracepoint_class { void (*probe_callback)(void); - const struct lttng_kernel_event_field **fields; /* event payload */ + const struct lttng_kernel_event_field * const *fields; /* event payload */ unsigned int nr_fields; const struct lttng_kernel_probe_desc *probe_desc; }; @@ -315,7 +315,7 @@ struct lttng_kernel_event_desc { struct lttng_kernel_probe_desc { const char *provider_name; - const struct lttng_kernel_event_desc **event_desc; + const struct lttng_kernel_event_desc * const *event_desc; unsigned int nr_events; struct list_head head; /* chain registered probes */ struct list_head lazy_init_head; diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h index fdc3d5cf..ce41fcb6 100644 --- a/include/lttng/tracepoint-event-impl.h +++ b/include/lttng/tracepoint-event-impl.h @@ -201,7 +201,7 @@ void __event_template_proto___##_name(void); #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN # undef LTTNG_TRACEPOINT_ENUM # define LTTNG_TRACEPOINT_ENUM(_name, _values) \ - static const struct lttng_kernel_enum_entry *__enum_values__##_name[] = { \ + static const struct lttng_kernel_enum_entry * const __enum_values__##_name[] = { \ _values \ }; #endif @@ -341,7 +341,7 @@ static __used struct lttng_kernel_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \ - static const struct lttng_kernel_event_field *__event_fields___##_name[] = { \ + static const struct lttng_kernel_event_field * const __event_fields___##_name[] = { \ _fields \ }; \ static const struct lttng_kernel_tracepoint_class lttng_kernel__event_class___##_name = { \ @@ -1245,7 +1245,7 @@ static const struct lttng_kernel_event_desc __event_desc___##_map = { \ #define TP_ID1(_token, _system) _token##_system #define TP_ID(_token, _system) TP_ID1(_token, _system) -static const struct lttng_kernel_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = { +static const struct lttng_kernel_event_desc * const TP_ID(__event_desc___, TRACE_SYSTEM)[] = { #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) }; diff --git a/src/lttng-bytecode.c b/src/lttng-bytecode.c index f094b009..b1437774 100644 --- a/src/lttng-bytecode.c +++ b/src/lttng-bytecode.c @@ -175,7 +175,7 @@ int apply_field_reloc(const struct lttng_kernel_event_desc *event_desc, const char *field_name, enum bytecode_op bytecode_op) { - const struct lttng_kernel_event_field **fields, *field = NULL; + const struct lttng_kernel_event_field * const *fields, *field = NULL; unsigned int nr_fields, i; struct load_op *op; uint32_t field_offset = 0; diff --git a/src/lttng-syscalls.h b/src/lttng-syscalls.h index d221dfb7..01416f4f 100644 --- a/src/lttng-syscalls.h +++ b/src/lttng-syscalls.h @@ -45,7 +45,7 @@ typedef __kernel_old_time_t time_t; struct trace_syscall_entry { void *event_func; const struct lttng_kernel_event_desc *desc; - const struct lttng_kernel_event_field **fields; + const struct lttng_kernel_event_field * const *fields; unsigned int nrargs; };