events.h API const-ness
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 6 May 2021 20:42:52 +0000 (16:42 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 6 May 2021 20:44:47 +0000 (16:44 -0400)
Ensure events.h definitions, fields, and arguments referring to const
arrays of pointers are const.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id1f9a736de72220f7576d9780b82ab7879eac300

include/lttng/events.h
include/lttng/tracepoint-event-impl.h
src/lttng-bytecode.c
src/lttng-syscalls.h

index 1eda3aca197fa5c69c197f09616e50198572a65a..0f6b5ab9d4e2b09e8e2742dc3fab9d4ffe3b4b0b 100644 (file)
@@ -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;
index fdc3d5cf13be5c5ed430e1740c7034b14bfd606a..ce41fcb688d37102dc4e755f9c6aca9e530c264a 100644 (file)
@@ -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)
 };
 
index f094b0091a819cb53cc8877541ddae1cca5ab988..b1437774b96a063256024b66b5c3089b1fc808ce 100644 (file)
@@ -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;
index d221dfb7c7d2a4424d3086c548a4a928dc297bb8..01416f4fa01a44f52a7ea2f56f70babbaa8cd25e 100644 (file)
@@ -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;
 };
 
This page took 0.02853 seconds and 4 git commands to generate.