Refactoring: context structures
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 16 Mar 2021 18:51:18 +0000 (14:51 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 16 Mar 2021 19:05:38 +0000 (15:05 -0400)
The context structures are now hidden in headers which are not
installed, but those are still part of the UST ABI. Therefore, we need
to update them to make sure those are extensible.

- Namespace theses structures with lttng_ust_ prefix,
- Use struct_size extensibility scheme. There was no prior padding, so
  extensibility was an issue in the past.
- Remove padding.
- This requires that none of those structures can be nested. It also
  requires that all arrays of structures must be replaced by arrays of
  pointers to structures.
- Replace struct lttng_perf_counter_field pointer by a private data
  pointer.

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

40 files changed:
include/lttng/ust-events.h
include/ust-comm.h
include/ust-context-provider.h
liblttng-ust-comm/lttng-ust-comm.c
liblttng-ust-java-agent/jni/common/lttng_ust_context.c
liblttng-ust/context-internal.h
liblttng-ust/context-provider-internal.h
liblttng-ust/lttng-bytecode-interpreter.c
liblttng-ust/lttng-bytecode-specialize.c
liblttng-ust/lttng-bytecode.c
liblttng-ust/lttng-context-cgroup-ns.c
liblttng-ust/lttng-context-cpu-id.c
liblttng-ust/lttng-context-ip.c
liblttng-ust/lttng-context-ipc-ns.c
liblttng-ust/lttng-context-mnt-ns.c
liblttng-ust/lttng-context-net-ns.c
liblttng-ust/lttng-context-perf-counters.c
liblttng-ust/lttng-context-pid-ns.c
liblttng-ust/lttng-context-procname.c
liblttng-ust/lttng-context-provider.c
liblttng-ust/lttng-context-pthread-id.c
liblttng-ust/lttng-context-time-ns.c
liblttng-ust/lttng-context-user-ns.c
liblttng-ust/lttng-context-uts-ns.c
liblttng-ust/lttng-context-vegid.c
liblttng-ust/lttng-context-veuid.c
liblttng-ust/lttng-context-vgid.c
liblttng-ust/lttng-context-vpid.c
liblttng-ust/lttng-context-vsgid.c
liblttng-ust/lttng-context-vsuid.c
liblttng-ust/lttng-context-vtid.c
liblttng-ust/lttng-context-vuid.c
liblttng-ust/lttng-context.c
liblttng-ust/lttng-events.c
liblttng-ust/lttng-ring-buffer-client.h
liblttng-ust/lttng-tracer-core.h
liblttng-ust/lttng-ust-abi.c
liblttng-ust/ust-core.c
liblttng-ust/ust-events-internal.h
tests/compile/test-app-ctx/hello.c

index 650784272ac3618abc03f930791b47c79ea16f25..18e4cd5541cf69985182c9006dbb58dd37ab18cf 100644 (file)
@@ -343,7 +343,7 @@ struct lttng_ust_bytecode_runtime {
  * removed.
  */
 
-struct lttng_ctx;
+struct lttng_ust_ctx;
 struct lttng_ust_event_common_private;
 
 enum lttng_ust_event_type {
@@ -404,7 +404,7 @@ struct lttng_ust_event_recorder {
 
        unsigned int id;
        struct lttng_channel *chan;
-       struct lttng_ctx *ctx;
+       struct lttng_ust_ctx *ctx;
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
 };
@@ -499,7 +499,7 @@ struct lttng_channel {
         */
        struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
        int enabled;
-       struct lttng_ctx *ctx;
+       struct lttng_ust_ctx *ctx;
        /* Event ID management */
        struct lttng_session *session;
        int objd;                       /* Object associated to channel */
@@ -528,8 +528,8 @@ struct lttng_ust_stack_ctx {
        uint32_t struct_size;                   /* Size of this structure */
 
        struct lttng_ust_event_recorder *event_recorder;
-       struct lttng_ctx *chan_ctx;     /* RCU dereferenced. */
-       struct lttng_ctx *event_ctx;    /* RCU dereferenced. */
+       struct lttng_ust_ctx *chan_ctx; /* RCU dereferenced. */
+       struct lttng_ust_ctx *event_ctx;        /* RCU dereferenced. */
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
 };
index da10b4085895e0f342d1acabd64b2369e6dd0a7b..b45797ef93e064ce763548c1af74cd28063d0628 100644 (file)
@@ -42,7 +42,7 @@
 #define LTTNG_UST_COMM_REG_MSG_PADDING                 64
 
 struct lttng_ust_event_field;
-struct lttng_ctx_field;
+struct lttng_ust_ctx_field;
 struct lttng_ust_enum_entry;
 struct lttng_integer_type;
 struct lttng_session;
@@ -318,7 +318,7 @@ int ustcomm_register_channel(int sock,
        int session_objd,               /* session descriptor */
        int channel_objd,               /* channel descriptor */
        size_t nr_ctx_fields,
-       const struct lttng_ctx_field *ctx_fields,
+       struct lttng_ust_ctx_field **ctx_fields,
        uint32_t *chan_id,              /* channel id (output) */
        int *header_type);              /* header type (output) */
 
index 670c38633b18120d746382610053c9c26af90462..3b41a66e5322f610dac233565b9a912dab54afec 100644 (file)
 
 #include "ust-dynamic-type.h"
 
-struct lttng_ctx_value {
+/*
+ * Context value
+ *
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+
+struct lttng_ust_ctx_value {
+       uint32_t struct_size;
+
        enum lttng_ust_dynamic_type sel;
        union {
                int64_t s64;
@@ -25,66 +39,108 @@ struct lttng_ctx_value {
                const char *str;
                double d;
        } u;
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
-struct lttng_perf_counter_field;
+/*
+ * Context field
+ *
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+
+struct lttng_ust_ctx_field {
+       uint32_t struct_size;
+       void *priv;
 
-#define LTTNG_UST_CTX_FIELD_PADDING    40
-struct lttng_ctx_field {
-       struct lttng_ust_event_field event_field;
-       size_t (*get_size)(struct lttng_ctx_field *field, size_t offset);
-       void (*record)(struct lttng_ctx_field *field,
+       struct lttng_ust_event_field *event_field;
+       size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset);
+       void (*record)(struct lttng_ust_ctx_field *field,
                       struct lttng_ust_lib_ring_buffer_ctx *ctx,
                       struct lttng_channel *chan);
-       void (*get_value)(struct lttng_ctx_field *field,
-                        struct lttng_ctx_value *value);
-       union {
-               struct lttng_perf_counter_field *perf_counter;
-               char padding[LTTNG_UST_CTX_FIELD_PADDING];
-       } u;
-       void (*destroy)(struct lttng_ctx_field *field);
+       void (*get_value)(struct lttng_ust_ctx_field *field,
+                        struct lttng_ust_ctx_value *value);
+       void (*destroy)(struct lttng_ust_ctx_field *field);
        char *field_name;       /* Has ownership, dynamically allocated. */
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
-#define LTTNG_UST_CTX_PADDING  20
-struct lttng_ctx {
-       struct lttng_ctx_field *fields;
+/*
+ * All context fields for a given event/channel
+ *
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+
+struct lttng_ust_ctx {
+       uint32_t struct_size;
+
+       struct lttng_ust_ctx_field **fields;
        unsigned int nr_fields;
        unsigned int allocated_fields;
        unsigned int largest_align;
-       char padding[LTTNG_UST_CTX_PADDING];
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
+/*
+ * Context provider
+ *
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+
 struct lttng_ust_context_provider {
+       uint32_t struct_size;
+
        char *name;
-       size_t (*get_size)(struct lttng_ctx_field *field, size_t offset);
-       void (*record)(struct lttng_ctx_field *field,
+       size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset);
+       void (*record)(struct lttng_ust_ctx_field *field,
                       struct lttng_ust_lib_ring_buffer_ctx *ctx,
                       struct lttng_channel *chan);
-       void (*get_value)(struct lttng_ctx_field *field,
-                        struct lttng_ctx_value *value);
+       void (*get_value)(struct lttng_ust_ctx_field *field,
+                        struct lttng_ust_ctx_value *value);
        struct cds_hlist_node node;
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
 int lttng_ust_context_provider_register(struct lttng_ust_context_provider *provider);
 void lttng_ust_context_provider_unregister(struct lttng_ust_context_provider *provider);
 
 void lttng_ust_context_set_session_provider(const char *name,
-               size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
-               void (*record)(struct lttng_ctx_field *field,
+               size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
+               void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan),
-               void (*get_value)(struct lttng_ctx_field *field,
-                       struct lttng_ctx_value *value));
+               void (*get_value)(struct lttng_ust_ctx_field *field,
+                       struct lttng_ust_ctx_value *value));
 
-int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ctx **ctx);
-int lttng_ust_context_set_provider_rcu(struct lttng_ctx **_ctx,
+int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ust_ctx **ctx);
+int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
                const char *name,
-               size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
-               void (*record)(struct lttng_ctx_field *field,
+               size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
+               void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan),
-               void (*get_value)(struct lttng_ctx_field *field,
-                       struct lttng_ctx_value *value));
+               void (*get_value)(struct lttng_ust_ctx_field *field,
+                       struct lttng_ust_ctx_value *value));
 
 #endif /* _LTTNG_UST_CONTEXT_PROVIDER_H */
index 656e170b100a8f0694b1ff3c37d2b324079204f2..6a801b5c62df5e5e064f57ec36516eb898902bac 100644 (file)
@@ -929,7 +929,7 @@ ssize_t count_fields_recursive(size_t nr_fields,
 
 static
 ssize_t count_ctx_fields_recursive(size_t nr_fields,
-               const struct lttng_ctx_field *lttng_fields)
+               struct lttng_ust_ctx_field **lttng_fields)
 {
        int i;
        ssize_t ret, count = 0;
@@ -937,7 +937,7 @@ ssize_t count_ctx_fields_recursive(size_t nr_fields,
        for (i = 0; i < nr_fields; i++) {
                const struct lttng_ust_event_field *lf;
 
-               lf = &lttng_fields[i].event_field;
+               lf = lttng_fields[i]->event_field;
                /* skip 'nowrite' fields */
                if (lf->nowrite)
                        continue;
@@ -1340,7 +1340,7 @@ int serialize_ctx_fields(struct lttng_session *session,
                size_t *_nr_write_fields,
                struct ustctl_field **ustctl_fields,
                size_t nr_fields,
-               const struct lttng_ctx_field *lttng_fields)
+               struct lttng_ust_ctx_field **lttng_fields)
 {
        struct ustctl_field *fields;
        int ret;
@@ -1359,7 +1359,7 @@ int serialize_ctx_fields(struct lttng_session *session,
 
        for (i = 0; i < nr_fields; i++) {
                ret = serialize_one_field(session, fields, &iter_output,
-                               &lttng_fields[i].event_field);
+                               lttng_fields[i]->event_field);
                if (ret)
                        goto error_type;
        }
@@ -1628,7 +1628,7 @@ int ustcomm_register_channel(int sock,
        int session_objd,               /* session descriptor */
        int channel_objd,               /* channel descriptor */
        size_t nr_ctx_fields,
-       const struct lttng_ctx_field *ctx_fields,
+       struct lttng_ust_ctx_field **ctx_fields,
        uint32_t *chan_id,              /* channel id (output) */
        int *header_type)               /* header type (output) */
 {
index bda3b6ee1fafdbc8f552f4cac70a8bf6cbb5ad0f..52097896de82904de1bcb73f1f2eb8f3fa50d454 100644 (file)
@@ -73,7 +73,7 @@ static struct lttng_ust_jni_ctx_entry *lookup_ctx_by_name(const char *ctx_name)
        return NULL;
 }
 
-static size_t get_size_cb(struct lttng_ctx_field *field, size_t offset)
+static size_t get_size_cb(struct lttng_ust_ctx_field *field, size_t offset)
 {
        struct lttng_ust_jni_ctx_entry *jctx;
        size_t size = 0;
@@ -135,7 +135,7 @@ static size_t get_size_cb(struct lttng_ctx_field *field, size_t offset)
 
 }
 
-static void record_cb(struct lttng_ctx_field *field,
+static void record_cb(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -256,8 +256,8 @@ static void record_cb(struct lttng_ctx_field *field,
        }
 }
 
-static void get_value_cb(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+static void get_value_cb(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        struct lttng_ust_jni_ctx_entry *jctx;
        const char *ctx_name = field->event_field.name;
@@ -354,6 +354,7 @@ JNIEXPORT jlong JNICALL Java_org_lttng_ust_agent_context_LttngContextApi_registe
        if (!provider) {
                goto error_provider;
        }
+       provider->struct_size = sizeof(*provider);
        provider->name = provider_name_cstr;
        provider->get_size = get_size_cb;
        provider->record = record_cb;
index f31d8a245ab7941a6efce07c7e67b20ede9696bd..7060e281fd734ee2a91cfcc3974dea79ec4f56bc 100644 (file)
 #include "ust-context-provider.h"
 
 __attribute__((visibility("hidden")))
-int lttng_context_init_all(struct lttng_ctx **ctx);
+int lttng_context_init_all(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
 int lttng_attach_context(struct lttng_ust_abi_context *context_param,
                union lttng_ust_abi_args *uargs,
-               struct lttng_ctx **ctx, struct lttng_session *session);
+               struct lttng_ust_ctx **ctx, struct lttng_session *session);
 
 __attribute__((visibility("hidden")))
-int lttng_find_context(struct lttng_ctx *ctx, const char *name);
+int lttng_find_context(struct lttng_ust_ctx *ctx, const char *name);
 
 __attribute__((visibility("hidden")))
-int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
+int lttng_get_context_index(struct lttng_ust_ctx *ctx, const char *name);
 
 __attribute__((visibility("hidden")))
-struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p);
+struct lttng_ust_ctx_field *lttng_append_context(struct lttng_ust_ctx **ctx_p);
 
 __attribute__((visibility("hidden")))
-void lttng_context_update(struct lttng_ctx *ctx);
+void lttng_context_update(struct lttng_ust_ctx *ctx);
 
 __attribute__((visibility("hidden")))
-void lttng_remove_context_field(struct lttng_ctx **ctx_p,
-                               struct lttng_ctx_field *field);
+void lttng_remove_context_field(struct lttng_ust_ctx **ctx_p,
+                               struct lttng_ust_ctx_field *field);
 
 __attribute__((visibility("hidden")))
-void lttng_destroy_context(struct lttng_ctx *ctx);
+void lttng_destroy_context(struct lttng_ust_ctx *ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_context_add_rcu(struct lttng_ctx **ctx_p,
-               const struct lttng_ctx_field *f);
+int lttng_context_add_rcu(struct lttng_ust_ctx **ctx_p,
+               struct lttng_ust_ctx_field *f);
 
 __attribute__((visibility("hidden")))
 int lttng_context_is_app(const char *name);
@@ -94,66 +94,66 @@ __attribute__((visibility("hidden")))
 void lttng_context_vsgid_reset(void);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vtid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vpid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_pthread_id_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_procname_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_ip_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_ip_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_cpu_id_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_dyntest_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_dyntest_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_cgroup_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_ipc_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_mnt_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_net_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_pid_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_user_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_uts_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_time_ns_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vuid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_veuid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vsuid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vgid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vegid_to_ctx(struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
-int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_vsgid_to_ctx(struct lttng_ust_ctx **ctx);
 
 #endif /* _LTTNG_UST_CONTEXT_INTERNAL_H */
index 0ada2ccfc4bd9eb8bf903a42fee00aa93e46e0f2..96343d900befad9e718b18c6bab99ab9c4ab6df8 100644 (file)
 
 __attribute__((visibility("hidden")))
 void lttng_ust_context_set_event_notifier_group_provider(const char *name,
-               size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
-               void (*record)(struct lttng_ctx_field *field,
+               size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
+               void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan),
-               void (*get_value)(struct lttng_ctx_field *field,
-                       struct lttng_ctx_value *value));
+               void (*get_value)(struct lttng_ust_ctx_field *field,
+                       struct lttng_ust_ctx_value *value));
 
 #endif /* _LTTNG_UST_CONTEXT_PROVIDER_INTERNAL_H */
index 46351a25f3ed4e23cd68a6edc7deafa7327794cc..5b2dc51a05950b0c951a6a54d887d2ae618977ef 100644 (file)
@@ -217,17 +217,18 @@ LABEL_##name
 #define IS_INTEGER_REGISTER(reg_type) \
                (reg_type == REG_U64 || reg_type == REG_S64)
 
-static int context_get_index(struct lttng_ctx *ctx,
+static int context_get_index(struct lttng_ust_ctx *ctx,
                struct load_ptr *ptr,
                uint32_t idx)
 {
 
-       struct lttng_ctx_field *ctx_field;
+       struct lttng_ust_ctx_field *ctx_field;
        struct lttng_ust_event_field *field;
-       struct lttng_ctx_value v;
+       struct lttng_ust_ctx_value v;
 
-       ctx_field = &ctx->fields[idx];
-       field = &ctx_field->event_field;
+       v.struct_size = sizeof(struct lttng_ust_ctx_value);
+       ctx_field = ctx->fields[idx];
+       field = ctx_field->event_field;
        ptr->type = LOAD_OBJECT;
        ptr->field = field;
 
@@ -345,7 +346,7 @@ static int context_get_index(struct lttng_ctx *ctx,
        return 0;
 }
 
-static int dynamic_get_index(struct lttng_ctx *ctx,
+static int dynamic_get_index(struct lttng_ust_ctx *ctx,
                struct bytecode_runtime *runtime,
                uint64_t index, struct estack_entry *stack_top)
 {
@@ -717,7 +718,7 @@ uint64_t bytecode_interpret(void *interpreter_data,
                struct lttng_interpreter_output *output)
 {
        struct bytecode_runtime *bytecode = interpreter_data;
-       struct lttng_ctx *ctx = lttng_ust_rcu_dereference(*bytecode->p.priv->pctx);
+       struct lttng_ust_ctx *ctx = lttng_ust_rcu_dereference(*bytecode->p.priv->pctx);
        void *pc, *next_pc, *start_pc;
        int ret = -EINVAL;
        uint64_t retval = 0;
@@ -2136,12 +2137,13 @@ uint64_t bytecode_interpret(void *interpreter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx_field *ctx_field;
-                       struct lttng_ctx_value v;
+                       struct lttng_ust_ctx_field *ctx_field;
+                       struct lttng_ust_ctx_value v;
 
+                       v.struct_size = sizeof(struct lttng_ust_ctx_value);
                        dbg_printf("get context ref offset %u type dynamic\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        switch (v.sel) {
@@ -2184,12 +2186,13 @@ uint64_t bytecode_interpret(void *interpreter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx_field *ctx_field;
-                       struct lttng_ctx_value v;
+                       struct lttng_ust_ctx_field *ctx_field;
+                       struct lttng_ust_ctx_value v;
 
+                       v.struct_size = sizeof(struct lttng_ust_ctx_value);
                        dbg_printf("get context ref offset %u type string\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.str = v.u.str;
@@ -2211,12 +2214,13 @@ uint64_t bytecode_interpret(void *interpreter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx_field *ctx_field;
-                       struct lttng_ctx_value v;
+                       struct lttng_ust_ctx_field *ctx_field;
+                       struct lttng_ust_ctx_value v;
 
+                       v.struct_size = sizeof(struct lttng_ust_ctx_value);
                        dbg_printf("get context ref offset %u type s64\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = v.u.s64;
@@ -2230,12 +2234,13 @@ uint64_t bytecode_interpret(void *interpreter_data,
                {
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
-                       struct lttng_ctx_field *ctx_field;
-                       struct lttng_ctx_value v;
+                       struct lttng_ust_ctx_field *ctx_field;
+                       struct lttng_ust_ctx_value v;
 
+                       v.struct_size = sizeof(struct lttng_ust_ctx_value);
                        dbg_printf("get context ref offset %u type double\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        memcpy(&estack_ax(stack, top)->u.d, &v.u.d, sizeof(struct literal_double));
index 1ba4ffebdd1cbc303205faeb73ad1bfabd196a9d..c546c8d6dc411688943e8804128721ef69325fc1 100644 (file)
@@ -366,7 +366,7 @@ end:
        return ret;
 }
 
-static int specialize_context_lookup_name(struct lttng_ctx *ctx,
+static int specialize_context_lookup_name(struct lttng_ust_ctx *ctx,
                struct bytecode_runtime *bytecode,
                struct load_op *insn)
 {
@@ -452,13 +452,13 @@ static int specialize_load_object(const struct lttng_ust_event_field *field,
        return 0;
 }
 
-static int specialize_context_lookup(struct lttng_ctx *ctx,
+static int specialize_context_lookup(struct lttng_ust_ctx *ctx,
                struct bytecode_runtime *runtime,
                struct load_op *insn,
                struct vstack_load *load)
 {
        int idx, ret;
-       struct lttng_ctx_field *ctx_field;
+       struct lttng_ust_ctx_field *ctx_field;
        struct lttng_ust_event_field *field;
        struct bytecode_get_index_data gid;
        ssize_t data_offset;
@@ -467,8 +467,8 @@ static int specialize_context_lookup(struct lttng_ctx *ctx,
        if (idx < 0) {
                return -ENOENT;
        }
-       ctx_field = &ctx->fields[idx];
-       field = &ctx_field->event_field;
+       ctx_field = ctx->fields[idx];
+       field = ctx_field->event_field;
        ret = specialize_load_object(field, load, true);
        if (ret)
                return ret;
@@ -488,7 +488,7 @@ static int specialize_context_lookup(struct lttng_ctx *ctx,
        return 0;
 }
 
-static int specialize_app_context_lookup(struct lttng_ctx **pctx,
+static int specialize_app_context_lookup(struct lttng_ust_ctx **pctx,
                struct bytecode_runtime *runtime,
                struct load_op *insn,
                struct vstack_load *load)
@@ -497,7 +497,7 @@ static int specialize_app_context_lookup(struct lttng_ctx **pctx,
        const char *orig_name;
        char *name = NULL;
        int idx, ret;
-       struct lttng_ctx_field *ctx_field;
+       struct lttng_ust_ctx_field *ctx_field;
        struct lttng_ust_event_field *field;
        struct bytecode_get_index_data gid;
        ssize_t data_offset;
@@ -522,8 +522,8 @@ static int specialize_app_context_lookup(struct lttng_ctx **pctx,
                if (idx < 0)
                        return -ENOENT;
        }
-       ctx_field = &(*pctx)->fields[idx];
-       field = &ctx_field->event_field;
+       ctx_field = (*pctx)->fields[idx];
+       field = ctx_field->event_field;
        ret = specialize_load_object(field, load, true);
        if (ret)
                goto end;
@@ -631,7 +631,7 @@ int lttng_bytecode_specialize(const struct lttng_ust_event_desc *event_desc,
        int ret = -EINVAL;
        struct vstack _stack;
        struct vstack *stack = &_stack;
-       struct lttng_ctx **pctx = bytecode->p.priv->pctx;
+       struct lttng_ust_ctx **pctx = bytecode->p.priv->pctx;
 
        vstack_init(stack);
 
index 6c86c634fb0a3ceca4ce76cd53a6fca2b1a1f7a5..f9ebc47645c2cf8d59b5b44bd296fe2b2ef0491c 100644 (file)
@@ -274,9 +274,9 @@ int apply_context_reloc(struct bytecode_runtime *runtime,
                enum bytecode_op bytecode_op)
 {
        struct load_op *op;
-       struct lttng_ctx_field *ctx_field;
+       struct lttng_ust_ctx_field *ctx_field;
        int idx;
-       struct lttng_ctx **pctx = runtime->p.priv->pctx;
+       struct lttng_ust_ctx **pctx = runtime->p.priv->pctx;
 
        dbg_printf("Apply context reloc: %u %s\n", reloc_offset, context_name);
 
@@ -302,7 +302,7 @@ int apply_context_reloc(struct bytecode_runtime *runtime,
                return -EINVAL;
 
        /* Get context return type */
-       ctx_field = &(*pctx)->fields[idx];
+       ctx_field = (*pctx)->fields[idx];
        op = (struct load_op *) &runtime->code[reloc_offset];
 
        switch (bytecode_op) {
@@ -311,7 +311,7 @@ int apply_context_reloc(struct bytecode_runtime *runtime,
                struct field_ref *field_ref;
 
                field_ref = (struct field_ref *) op->data;
-               switch (ctx_field->event_field.type.atype) {
+               switch (ctx_field->event_field->type.atype) {
                case atype_integer:
                case atype_enum_nestable:
                        op->op = BYTECODE_OP_GET_CONTEXT_REF_S64;
@@ -397,7 +397,7 @@ int bytecode_is_linked(struct lttng_ust_bytecode_node *bytecode,
  */
 static
 int link_bytecode(const struct lttng_ust_event_desc *event_desc,
-               struct lttng_ctx **ctx,
+               struct lttng_ust_ctx **ctx,
                struct lttng_ust_bytecode_node *bytecode,
                struct cds_list_head *bytecode_runtime_head,
                struct cds_list_head *insert_loc)
@@ -530,7 +530,7 @@ void lttng_bytecode_capture_sync_state(struct lttng_ust_bytecode_runtime *runtim
  * instance are name matching (or glob pattern matching).
  */
 void lttng_enabler_link_bytecode(const struct lttng_ust_event_desc *event_desc,
-               struct lttng_ctx **ctx,
+               struct lttng_ust_ctx **ctx,
                struct cds_list_head *instance_bytecode_head,
                struct cds_list_head *enabler_bytecode_head)
 {
index 681eea49514326a7535b2d925b43746236fb3596..2ba495b3362032669ca8739e2c384420e92ba740 100644 (file)
@@ -90,7 +90,7 @@ void lttng_context_cgroup_ns_reset(void)
 }
 
 static
-size_t cgroup_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t cgroup_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -100,7 +100,7 @@ size_t cgroup_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void cgroup_ns_record(struct lttng_ctx_field *field,
+void cgroup_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -112,15 +112,15 @@ void cgroup_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void cgroup_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void cgroup_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_cgroup_ns();
 }
 
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_cgroup_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -129,14 +129,14 @@ int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "cgroup_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "cgroup_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = cgroup_ns_get_size;
        field->record = cgroup_ns_record;
        field->get_value = cgroup_ns_get_value;
index 2a8f2812338265040423f90883517ccb7511ca26..1221bf6cf687db73f56256201eeff026b5b26f24 100644 (file)
@@ -24,7 +24,7 @@
 #include "context-internal.h"
 
 static
-size_t cpu_id_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t cpu_id_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -34,7 +34,7 @@ size_t cpu_id_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void cpu_id_record(struct lttng_ctx_field *field,
+void cpu_id_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -46,15 +46,15 @@ void cpu_id_record(struct lttng_ctx_field *field,
 }
 
 static
-void cpu_id_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void cpu_id_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = lttng_ust_get_cpu();
 }
 
-int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_cpu_id_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -63,14 +63,14 @@ int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "cpu_id";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(int) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(int) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(int);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "cpu_id";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(int) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(int) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(int);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = cpu_id_get_size;
        field->record = cpu_id_record;
        field->get_value = cpu_id_get_value;
index af4f02acc43b1fb1f389e051d2b54d39659272a9..20c6fef34b8efbf5aa56dea460a4e8e72d6ed4f7 100644 (file)
@@ -17,7 +17,7 @@
 #include "context-internal.h"
 
 static
-size_t ip_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t ip_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t ip_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void ip_record(struct lttng_ctx_field *field,
+void ip_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -38,9 +38,9 @@ void ip_record(struct lttng_ctx_field *field,
        chan->ops->event_write(ctx, &ip, sizeof(ip));
 }
 
-int lttng_add_ip_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_ip_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -49,14 +49,14 @@ int lttng_add_ip_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "ip";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(void *) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(void *) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(void *);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 16;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "ip";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(void *) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(void *) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(void *);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 16;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = ip_get_size;
        field->record = ip_record;
        lttng_context_update(*ctx);
index f265c397e36ef26b250c283c58cda9179e4f2e0f..a9d2024d37f95dff13afc9bb688d92e3c2eeb487 100644 (file)
@@ -89,7 +89,7 @@ void lttng_context_ipc_ns_reset(void)
 }
 
 static
-size_t ipc_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t ipc_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -99,7 +99,7 @@ size_t ipc_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void ipc_ns_record(struct lttng_ctx_field *field,
+void ipc_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -111,15 +111,15 @@ void ipc_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void ipc_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void ipc_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_ipc_ns();
 }
 
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_ipc_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -128,14 +128,14 @@ int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "ipc_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "ipc_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = ipc_ns_get_size;
        field->record = ipc_ns_record;
        field->get_value = ipc_ns_get_value;
index 4ce9384500f63322cccfdde7298bab79ff0fee1e..930bd61849a257d0002962ac887ecd15730f0eef 100644 (file)
@@ -72,7 +72,7 @@ void lttng_context_mnt_ns_reset(void)
 }
 
 static
-size_t mnt_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t mnt_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -82,7 +82,7 @@ size_t mnt_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void mnt_ns_record(struct lttng_ctx_field *field,
+void mnt_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -94,15 +94,15 @@ void mnt_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void mnt_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void mnt_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_mnt_ns();
 }
 
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_mnt_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -111,14 +111,14 @@ int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "mnt_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "mnt_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = mnt_ns_get_size;
        field->record = mnt_ns_record;
        field->get_value = mnt_ns_get_value;
index 08b6134069a54d816c4cb759810f9698cddaa68b..c7022b54a8f241fd37bd1d45f259815ba2afb03f 100644 (file)
@@ -89,7 +89,7 @@ void lttng_context_net_ns_reset(void)
 }
 
 static
-size_t net_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t net_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -99,7 +99,7 @@ size_t net_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void net_ns_record(struct lttng_ctx_field *field,
+void net_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -111,15 +111,15 @@ void net_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void net_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void net_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_net_ns();
 }
 
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_net_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -128,14 +128,14 @@ int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "net_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "net_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = net_ns_get_size;
        field->record = net_ns_record;
        field->get_value = net_ns_get_value;
index 74e07dc57a0c5e0eb01c2f7acdbe28f033a63ff8..fa2833240e4828c3bf8565cdeca5ecd9caa26f2f 100644 (file)
@@ -156,7 +156,7 @@ void lttng_perf_unlock(void)
 }
 
 static
-size_t perf_counter_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t perf_counter_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -425,18 +425,18 @@ struct lttng_perf_counter_thread_field *
 }
 
 static
-uint64_t wrapper_perf_counter_read(struct lttng_ctx_field *field)
+uint64_t wrapper_perf_counter_read(struct lttng_ust_ctx_field *field)
 {
        struct lttng_perf_counter_field *perf_field;
        struct lttng_perf_counter_thread_field *perf_thread_field;
 
-       perf_field = field->u.perf_counter;
+       perf_field = (struct lttng_perf_counter_field *) field->priv;
        perf_thread_field = get_thread_field(perf_field);
        return arch_read_perf_counter(perf_thread_field);
 }
 
 static
-void perf_counter_record(struct lttng_ctx_field *field,
+void perf_counter_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -448,8 +448,8 @@ void perf_counter_record(struct lttng_ctx_field *field,
 }
 
 static
-void perf_counter_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void perf_counter_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = wrapper_perf_counter_read(field);
 }
@@ -482,13 +482,13 @@ void lttng_destroy_perf_thread_key(void *_key)
 
 /* Called with UST lock held */
 static
-void lttng_destroy_perf_counter_field(struct lttng_ctx_field *field)
+void lttng_destroy_perf_counter_field(struct lttng_ust_ctx_field *field)
 {
        struct lttng_perf_counter_field *perf_field;
        struct lttng_perf_counter_thread_field *pos, *p;
 
-       free((char *) field->event_field.name);
-       perf_field = field->u.perf_counter;
+       free((char *) field->event_field->name);
+       perf_field = (struct lttng_perf_counter_field *) field->priv;
        /*
         * This put is performed when no threads can concurrently
         * perform a "get" concurrently, thanks to urcu-bp grace
@@ -526,9 +526,9 @@ int perf_get_exclude_kernel(void)
 int lttng_add_perf_counter_to_ctx(uint32_t type,
                                uint64_t config,
                                const char *name,
-                               struct lttng_ctx **ctx)
+                               struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
        struct lttng_perf_counter_field *perf_field;
        char *name_alloc;
        int ret;
@@ -555,17 +555,17 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
 
        field->destroy = lttng_destroy_perf_counter_field;
 
-       field->event_field.name = name_alloc;
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size =
+       field->event_field->name = name_alloc;
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size =
                        sizeof(uint64_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment =
+       field->event_field->type.u.integer.alignment =
                        lttng_alignof(uint64_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness =
+       field->event_field->type.u.integer.signedness =
                        lttng_is_signed_type(uint64_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = perf_counter_get_size;
        field->record = perf_counter_record;
        field->get_value = perf_counter_get_value;
@@ -574,7 +574,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
        perf_field->attr.config = config;
        perf_field->attr.exclude_kernel = perf_get_exclude_kernel();
        CDS_INIT_LIST_HEAD(&perf_field->thread_field_list);
-       field->u.perf_counter = perf_field;
+       field->priv = perf_field;
 
        /* Ensure that this perf counter can be used in this process. */
        ret = open_perf_fd(&perf_field->attr);
index df7a764db56ea0438c5be4f0926bc4f6fc8c6a60..4ab4246c37c5a08fa2c9e25eaf8afb61095aae91 100644 (file)
@@ -75,7 +75,7 @@ void lttng_context_pid_ns_reset(void)
 }
 
 static
-size_t pid_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t pid_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -85,7 +85,7 @@ size_t pid_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void pid_ns_record(struct lttng_ctx_field *field,
+void pid_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -97,15 +97,15 @@ void pid_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void pid_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void pid_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_pid_ns();
 }
 
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_pid_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -114,14 +114,14 @@ int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "pid_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "pid_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = pid_ns_get_size;
        field->record = pid_ns_record;
        field->get_value = pid_ns_get_value;
index d467b43ca3ee23b4678afb2c124b66ba38ba89e9..9e24cb0630d92b0cac74d2e64f88934f7b96f95f 100644 (file)
@@ -65,13 +65,13 @@ void lttng_ust_context_procname_reset(void)
 }
 
 static
-size_t procname_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t procname_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        return LTTNG_UST_ABI_PROCNAME_LEN;
 }
 
 static
-void procname_record(struct lttng_ctx_field *field,
+void procname_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -82,8 +82,8 @@ void procname_record(struct lttng_ctx_field *field,
 }
 
 static
-void procname_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void procname_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.str = wrapper_getprocname();
 }
@@ -91,9 +91,9 @@ void procname_get_value(struct lttng_ctx_field *field,
 static const struct lttng_type procname_array_elem_type =
        __type_integer(char, BYTE_ORDER, 10, UTF8);
 
-int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_procname_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -102,11 +102,11 @@ int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "procname";
-       field->event_field.type.atype = atype_array_nestable;
-       field->event_field.type.u.array_nestable.elem_type =
+       field->event_field->name = "procname";
+       field->event_field->type.atype = atype_array_nestable;
+       field->event_field->type.u.array_nestable.elem_type =
                &procname_array_elem_type;
-       field->event_field.type.u.array_nestable.length = LTTNG_UST_ABI_PROCNAME_LEN;
+       field->event_field->type.u.array_nestable.length = LTTNG_UST_ABI_PROCNAME_LEN;
        field->get_size = procname_get_size;
        field->record = procname_record;
        field->get_value = procname_get_value;
index 46a18c9fa92fa82ac2b410115dabbe075753d9ea..fe67c2eef1871e6f71fa82e045ac975966cc5904 100644 (file)
@@ -120,42 +120,64 @@ end:
  * metadata describing the context.
  */
 int lttng_ust_add_app_context_to_ctx_rcu(const char *name,
-               struct lttng_ctx **ctx)
+               struct lttng_ust_ctx **ctx)
 {
        struct lttng_ust_context_provider *provider;
-       struct lttng_ctx_field new_field;
+       struct lttng_ust_ctx_field *new_field = NULL;
        int ret;
 
        if (*ctx && lttng_find_context(*ctx, name))
                return -EEXIST;
-       /*
-        * For application context, add it by expanding
-        * ctx array.
-        */
-       memset(&new_field, 0, sizeof(new_field));
-       new_field.field_name = strdup(name);
-       if (!new_field.field_name)
-               return -ENOMEM;
-       new_field.event_field.name = new_field.field_name;
-       new_field.event_field.type.atype = atype_dynamic;
+       new_field = zmalloc(sizeof(struct lttng_ust_ctx_field));
+       if (!new_field) {
+               ret = -ENOMEM;
+               goto error_field_alloc;
+       }
+       new_field->struct_size = sizeof(struct lttng_ust_ctx_field);
+       new_field->event_field = zmalloc(sizeof(struct lttng_ust_event_field));
+       if (!new_field->event_field) {
+               ret = -ENOMEM;
+               goto error_event_field_alloc;
+       }
+       new_field->field_name = strdup(name);
+       if (!new_field->field_name) {
+               ret = -ENOMEM;
+               goto error_field_name_alloc;
+       }
+       new_field->event_field->name = new_field->field_name;
+       new_field->event_field->type.atype = atype_dynamic;
        /*
         * If provider is not found, we add the context anyway, but
         * it will provide a dummy context.
         */
        provider = lookup_provider_by_name(name);
        if (provider) {
-               new_field.get_size = provider->get_size;
-               new_field.record = provider->record;
-               new_field.get_value = provider->get_value;
+               new_field->get_size = provider->get_size;
+               new_field->record = provider->record;
+               new_field->get_value = provider->get_value;
        } else {
-               new_field.get_size = lttng_ust_dummy_get_size;
-               new_field.record = lttng_ust_dummy_record;
-               new_field.get_value = lttng_ust_dummy_get_value;
+               new_field->get_size = lttng_ust_dummy_get_size;
+               new_field->record = lttng_ust_dummy_record;
+               new_field->get_value = lttng_ust_dummy_get_value;
        }
-       ret = lttng_context_add_rcu(ctx, &new_field);
+       /*
+        * For application context, add it by expanding
+        * ctx array. Ownership of new_field is passed to the callee on
+        * success.
+        */
+       ret = lttng_context_add_rcu(ctx, new_field);
        if (ret) {
-               free(new_field.field_name);
+               free(new_field->field_name);
+               free(new_field->event_field);
+               free(new_field);
                return ret;
        }
        return 0;
+
+error_field_name_alloc:
+       free(new_field->event_field);
+error_event_field_alloc:
+       free(new_field);
+error_field_alloc:
+       return ret;
 }
index 2502f75fd03b93c7bf63b1b2fab08281dcbf9bf4..162b2cf4c78bb966a8c0c0bd688562b7d2a3ade8 100644 (file)
@@ -16,7 +16,7 @@
 #include "context-internal.h"
 
 static
-size_t pthread_id_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t pthread_id_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -26,7 +26,7 @@ size_t pthread_id_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void pthread_id_record(struct lttng_ctx_field *field,
+void pthread_id_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -38,15 +38,15 @@ void pthread_id_record(struct lttng_ctx_field *field,
 }
 
 static
-void pthread_id_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void pthread_id_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = (unsigned long) pthread_self();
 }
 
-int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_pthread_id_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -55,14 +55,14 @@ int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "pthread_id";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(unsigned long) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned long);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "pthread_id";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(unsigned long) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(unsigned long);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = pthread_id_get_size;
        field->record = pthread_id_record;
        field->get_value = pthread_id_get_value;
index a2365cd200581d901214c754b0bb85fb81c8cb96..8edc1fae4462a844ca7705b47e83b8a09bb44ed7 100644 (file)
@@ -88,7 +88,7 @@ void lttng_context_time_ns_reset(void)
 }
 
 static
-size_t time_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t time_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -98,7 +98,7 @@ size_t time_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void time_ns_record(struct lttng_ctx_field *field,
+void time_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -110,15 +110,15 @@ void time_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void time_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void time_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_time_ns();
 }
 
-int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_time_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -127,14 +127,14 @@ int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "time_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "time_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = time_ns_get_size;
        field->record = time_ns_record;
        field->get_value = time_ns_get_value;
index d2a79b52883320b6d4c8bfeba983d4fc52ca42a9..fccf70f2491fc6c3133bd99159dd8e99a021fc0d 100644 (file)
@@ -72,7 +72,7 @@ void lttng_context_user_ns_reset(void)
 }
 
 static
-size_t user_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t user_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -82,7 +82,7 @@ size_t user_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void user_ns_record(struct lttng_ctx_field *field,
+void user_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -94,15 +94,15 @@ void user_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void user_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void user_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_user_ns();
 }
 
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_user_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -111,14 +111,14 @@ int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "user_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "user_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = user_ns_get_size;
        field->record = user_ns_record;
        field->get_value = user_ns_get_value;
index 2cd2393994ae02327adb877c91627a0e08618a86..af8aad464e18cd9fd4c1eab281d321f413d6eb99 100644 (file)
@@ -90,7 +90,7 @@ void lttng_context_uts_ns_reset(void)
 }
 
 static
-size_t uts_ns_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t uts_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -100,7 +100,7 @@ size_t uts_ns_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void uts_ns_record(struct lttng_ctx_field *field,
+void uts_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -112,15 +112,15 @@ void uts_ns_record(struct lttng_ctx_field *field,
 }
 
 static
-void uts_ns_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void uts_ns_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_uts_ns();
 }
 
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_uts_ns_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -129,14 +129,14 @@ int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "uts_ns";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(ino_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "uts_ns";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(ino_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(ino_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = uts_ns_get_size;
        field->record = uts_ns_record;
        field->get_value = uts_ns_get_value;
index 436b566ad12b418494cd9c6e4cd6aae0c8dcff68..a7bac4e2dd874f12ba0889abe2fc1cdb6fa20cae 100644 (file)
@@ -61,7 +61,7 @@ void lttng_context_vegid_reset(void)
 }
 
 static
-size_t vegid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vegid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -71,7 +71,7 @@ size_t vegid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void vegid_record(struct lttng_ctx_field *field,
+void vegid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -83,15 +83,15 @@ void vegid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vegid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vegid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_vegid();
 }
 
-int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vegid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -100,14 +100,14 @@ int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vegid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vegid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(gid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vegid_get_size;
        field->record = vegid_record;
        field->get_value = vegid_get_value;
index 3d6305750da0ba96bb73c896cd5e7afc01dfb890..e21745039664a2e4223c96f8788489cc31d88d4f 100644 (file)
@@ -61,7 +61,7 @@ void lttng_context_veuid_reset(void)
 }
 
 static
-size_t veuid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t veuid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -71,7 +71,7 @@ size_t veuid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void veuid_record(struct lttng_ctx_field *field,
+void veuid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -83,15 +83,15 @@ void veuid_record(struct lttng_ctx_field *field,
 }
 
 static
-void veuid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void veuid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_veuid();
 }
 
-int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_veuid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -100,14 +100,14 @@ int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "veuid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "veuid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(uid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = veuid_get_size;
        field->record = veuid_record;
        field->get_value = veuid_get_value;
index 04933405914ab9206b1cc4bb4b10aa9f5de8003f..7bc12544f9244c73b30afe0abddd826bc167c16c 100644 (file)
@@ -61,7 +61,7 @@ void lttng_context_vgid_reset(void)
 }
 
 static
-size_t vgid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vgid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -71,7 +71,7 @@ size_t vgid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void vgid_record(struct lttng_ctx_field *field,
+void vgid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -83,15 +83,15 @@ void vgid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vgid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vgid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_vgid();
 }
 
-int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vgid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -100,14 +100,14 @@ int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vgid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vgid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(gid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vgid_get_size;
        field->record = vgid_record;
        field->get_value = vgid_get_value;
index f41119f9129e73e853c66512fa26851c826b5440..ddcfb8ad3bcf25ed98f15557945d65c4a73c14f2 100644 (file)
@@ -45,7 +45,7 @@ void lttng_context_vpid_reset(void)
 }
 
 static
-size_t vpid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vpid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -55,7 +55,7 @@ size_t vpid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void vpid_record(struct lttng_ctx_field *field,
+void vpid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -66,15 +66,15 @@ void vpid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vpid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vpid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = wrapper_getvpid();
 }
 
-int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vpid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -83,14 +83,14 @@ int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vpid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vpid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(pid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vpid_get_size;
        field->record = vpid_record;
        field->get_value = vpid_get_value;
index 0778d8751ce841b3ad0fae4fca3cf2da8b3bab65..0d7b0426d9f6c5b4c3606e500ae6ac7f6aa036b2 100644 (file)
@@ -65,7 +65,7 @@ void lttng_context_vsgid_reset(void)
 }
 
 static
-size_t vsgid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vsgid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -75,7 +75,7 @@ size_t vsgid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void vsgid_record(struct lttng_ctx_field *field,
+void vsgid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -87,15 +87,15 @@ void vsgid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vsgid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vsgid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_vsgid();
 }
 
-int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vsgid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -104,14 +104,14 @@ int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vsgid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vsgid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(gid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vsgid_get_size;
        field->record = vsgid_record;
        field->get_value = vsgid_get_value;
index ecc239bcaaa4eff0c09fdb9f3b980110ee83d67f..0428292a3e277fc7993cab731f0bf7cb697ddc69 100644 (file)
@@ -65,7 +65,7 @@ void lttng_context_vsuid_reset(void)
 }
 
 static
-size_t vsuid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vsuid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -75,7 +75,7 @@ size_t vsuid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void vsuid_record(struct lttng_ctx_field *field,
+void vsuid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -87,15 +87,15 @@ void vsuid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vsuid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vsuid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_vsuid();
 }
 
-int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vsuid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -104,14 +104,14 @@ int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vsuid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vsuid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(uid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vsuid_get_size;
        field->record = vsuid_record;
        field->get_value = vsuid_get_value;
index 15c11eddc6d096f2df2b4c106a5cb552999bf90f..9b91e57c5dd962b7991a03e81978ff0e409177a7 100644 (file)
@@ -36,7 +36,7 @@ void lttng_context_vtid_reset(void)
 }
 
 static
-size_t vtid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vtid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -59,7 +59,7 @@ pid_t wrapper_getvtid(void)
 }
 
 static
-void vtid_record(struct lttng_ctx_field *field,
+void vtid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -70,15 +70,15 @@ void vtid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vtid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vtid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = wrapper_getvtid();
 }
 
-int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vtid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -87,14 +87,14 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vtid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vtid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(pid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vtid_get_size;
        field->record = vtid_record;
        field->get_value = vtid_get_value;
index f4bcb5c90635ac6d739967e52a1cfaed739a4867..754218d269e188421040a925f312d2c2f337b74d 100644 (file)
@@ -61,7 +61,7 @@ void lttng_context_vuid_reset(void)
 }
 
 static
-size_t vuid_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t vuid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -71,7 +71,7 @@ size_t vuid_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void vuid_record(struct lttng_ctx_field *field,
+void vuid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -83,15 +83,15 @@ void vuid_record(struct lttng_ctx_field *field,
 }
 
 static
-void vuid_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void vuid_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = get_vuid();
 }
 
-int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_vuid_to_ctx(struct lttng_ust_ctx **ctx)
 {
-       struct lttng_ctx_field *field;
+       struct lttng_ust_ctx_field *field;
 
        field = lttng_append_context(ctx);
        if (!field)
@@ -100,14 +100,14 @@ int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx)
                lttng_remove_context_field(ctx, field);
                return -EEXIST;
        }
-       field->event_field.name = "vuid";
-       field->event_field.type.atype = atype_integer;
-       field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
-       field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
-       field->event_field.type.u.integer.reverse_byte_order = 0;
-       field->event_field.type.u.integer.base = 10;
-       field->event_field.type.u.integer.encoding = lttng_encode_none;
+       field->event_field->name = "vuid";
+       field->event_field->type.atype = atype_integer;
+       field->event_field->type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+       field->event_field->type.u.integer.signedness = lttng_is_signed_type(uid_t);
+       field->event_field->type.u.integer.reverse_byte_order = 0;
+       field->event_field->type.u.integer.base = 10;
+       field->event_field->type.u.integer.encoding = lttng_encode_none;
        field->get_size = vuid_get_size;
        field->record = vuid_record;
        field->get_value = vuid_get_value;
index dc6e13b3c5d546f183fb5b1a80ec7549a126764f..8ed9bbd4f1db15b13d1d56daaeacbdddc5921b8c 100644 (file)
@@ -26,7 +26,7 @@
  * same context performed by the same thread return the same result.
  */
 
-int lttng_find_context(struct lttng_ctx *ctx, const char *name)
+int lttng_find_context(struct lttng_ust_ctx *ctx, const char *name)
 {
        unsigned int i;
        const char *subname;
@@ -38,15 +38,15 @@ int lttng_find_context(struct lttng_ctx *ctx, const char *name)
        }
        for (i = 0; i < ctx->nr_fields; i++) {
                /* Skip allocated (but non-initialized) contexts */
-               if (!ctx->fields[i].event_field.name)
+               if (!ctx->fields[i]->event_field->name)
                        continue;
-               if (!strcmp(ctx->fields[i].event_field.name, subname))
+               if (!strcmp(ctx->fields[i]->event_field->name, subname))
                        return 1;
        }
        return 0;
 }
 
-int lttng_get_context_index(struct lttng_ctx *ctx, const char *name)
+int lttng_get_context_index(struct lttng_ust_ctx *ctx, const char *name)
 {
        unsigned int i;
        const char *subname;
@@ -60,23 +60,23 @@ int lttng_get_context_index(struct lttng_ctx *ctx, const char *name)
        }
        for (i = 0; i < ctx->nr_fields; i++) {
                /* Skip allocated (but non-initialized) contexts */
-               if (!ctx->fields[i].event_field.name)
+               if (!ctx->fields[i]->event_field->name)
                        continue;
-               if (!strcmp(ctx->fields[i].event_field.name, subname))
+               if (!strcmp(ctx->fields[i]->event_field->name, subname))
                        return i;
        }
        return -1;
 }
 
-static int lttng_find_context_provider(struct lttng_ctx *ctx, const char *name)
+static int lttng_find_context_provider(struct lttng_ust_ctx *ctx, const char *name)
 {
        unsigned int i;
 
        for (i = 0; i < ctx->nr_fields; i++) {
                /* Skip allocated (but non-initialized) contexts */
-               if (!ctx->fields[i].event_field.name)
+               if (!ctx->fields[i]->event_field->name)
                        continue;
-               if (!strncmp(ctx->fields[i].event_field.name, name,
+               if (!strncmp(ctx->fields[i]->event_field->name, name,
                                strlen(name)))
                        return 1;
        }
@@ -85,65 +85,100 @@ static int lttng_find_context_provider(struct lttng_ctx *ctx, const char *name)
 
 /*
  * Note: as we append context information, the pointer location may change.
+ * lttng_add_context leaves the new last context initialized to NULL.
  */
-struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
+static
+int lttng_add_context(struct lttng_ust_ctx **ctx_p)
 {
-       struct lttng_ctx_field *field;
-       struct lttng_ctx *ctx;
+       struct lttng_ust_ctx *ctx;
 
        if (!*ctx_p) {
-               *ctx_p = zmalloc(sizeof(struct lttng_ctx));
+               *ctx_p = zmalloc(sizeof(struct lttng_ust_ctx));
                if (!*ctx_p)
-                       return NULL;
+                       return -ENOMEM;
+               (*ctx_p)->struct_size = sizeof(struct lttng_ust_ctx);
                (*ctx_p)->largest_align = 1;
        }
        ctx = *ctx_p;
        if (ctx->nr_fields + 1 > ctx->allocated_fields) {
-               struct lttng_ctx_field *new_fields;
+               struct lttng_ust_ctx_field **new_fields;
 
                ctx->allocated_fields = max_t(size_t, 1, 2 * ctx->allocated_fields);
-               new_fields = zmalloc(ctx->allocated_fields * sizeof(struct lttng_ctx_field));
+               new_fields = zmalloc(ctx->allocated_fields * sizeof(*new_fields));
                if (!new_fields)
-                       return NULL;
+                       return -ENOMEM;
+               /* Copy pointers */
                if (ctx->fields)
                        memcpy(new_fields, ctx->fields, sizeof(*ctx->fields) * ctx->nr_fields);
                free(ctx->fields);
                ctx->fields = new_fields;
        }
-       field = &ctx->fields[ctx->nr_fields];
        ctx->nr_fields++;
+       return 0;
+}
+
+struct lttng_ust_ctx_field *lttng_append_context(struct lttng_ust_ctx **ctx_p)
+{
+       struct lttng_ust_ctx_field *field;
+       int ret;
+
+       field = zmalloc(sizeof(struct lttng_ust_ctx_field));
+       if (!field)
+               goto error_alloc_field;
+       field->struct_size = sizeof(struct lttng_ust_ctx_field);
+       field->event_field = zmalloc(sizeof(struct lttng_ust_event_field));
+       if (!field->event_field)
+               goto error_alloc_event_field;
+       field->event_field->struct_size = sizeof(struct lttng_ust_event_field);
+
+       ret = lttng_add_context(ctx_p);
+       if (ret)
+               goto error_add_context;
+       (*ctx_p)->fields[(*ctx_p)->nr_fields - 1] = field;
        return field;
+
+error_add_context:
+       free(field->event_field);
+error_alloc_event_field:
+       free(field);
+error_alloc_field:
+       return NULL;
 }
 
-int lttng_context_add_rcu(struct lttng_ctx **ctx_p,
-               const struct lttng_ctx_field *f)
+/*
+ * Takes ownership of @f on success.
+ */
+int lttng_context_add_rcu(struct lttng_ust_ctx **ctx_p,
+               struct lttng_ust_ctx_field *f)
 {
-       struct lttng_ctx *old_ctx = *ctx_p, *new_ctx = NULL;
-       struct lttng_ctx_field *new_fields = NULL;
-       struct lttng_ctx_field *nf;
+       struct lttng_ust_ctx *old_ctx = *ctx_p, *new_ctx = NULL;
+       struct lttng_ust_ctx_field **new_fields = NULL;
+       int ret;
 
        if (old_ctx) {
-               new_ctx = zmalloc(sizeof(struct lttng_ctx));
+               new_ctx = zmalloc(sizeof(struct lttng_ust_ctx));
                if (!new_ctx)
                        return -ENOMEM;
+               new_ctx->struct_size = sizeof(struct lttng_ust_ctx);
                *new_ctx = *old_ctx;
-               new_fields = zmalloc(new_ctx->allocated_fields
-                               * sizeof(struct lttng_ctx_field));
+               new_fields = zmalloc(new_ctx->allocated_fields * sizeof(*new_fields));
                if (!new_fields) {
                        free(new_ctx);
                        return -ENOMEM;
                }
+               /* Copy pointers */
                memcpy(new_fields, old_ctx->fields,
                                sizeof(*old_ctx->fields) * old_ctx->nr_fields);
                new_ctx->fields = new_fields;
        }
-       nf = lttng_append_context(&new_ctx);
-       if (!nf) {
+       ret = lttng_add_context(&new_ctx);
+       if (ret) {
                free(new_fields);
                free(new_ctx);
-               return -ENOMEM;
+               return ret;
        }
-       *nf = *f;
+       /* Taking ownership of f. */
+       (*ctx_p)->fields[(*ctx_p)->nr_fields - 1] = f;
        lttng_context_update(new_ctx);
        lttng_ust_rcu_assign_pointer(*ctx_p, new_ctx);
        lttng_ust_urcu_synchronize_rcu();
@@ -158,7 +193,7 @@ int lttng_context_add_rcu(struct lttng_ctx **ctx_p,
  * lttng_context_update() should be called at least once between context
  * modification and trace start.
  */
-void lttng_context_update(struct lttng_ctx *ctx)
+void lttng_context_update(struct lttng_ust_ctx *ctx)
 {
        int i;
        size_t largest_align = 8;       /* in bits */
@@ -167,7 +202,7 @@ void lttng_context_update(struct lttng_ctx *ctx)
                struct lttng_type *type;
                size_t field_align = 8;
 
-               type = &ctx->fields[i].event_field.type;
+               type = &ctx->fields[i]->event_field->type;
                switch (type->atype) {
                case atype_integer:
                        field_align = type->u.integer.alignment;
@@ -234,28 +269,30 @@ void lttng_context_update(struct lttng_ctx *ctx)
 /*
  * Remove last context field.
  */
-void lttng_remove_context_field(struct lttng_ctx **ctx_p,
-                               struct lttng_ctx_field *field)
+void lttng_remove_context_field(struct lttng_ust_ctx **ctx_p,
+                               struct lttng_ust_ctx_field *field)
 {
-       struct lttng_ctx *ctx;
+       struct lttng_ust_ctx *ctx;
 
        ctx = *ctx_p;
        ctx->nr_fields--;
-       assert(&ctx->fields[ctx->nr_fields] == field);
+       assert(ctx->fields[ctx->nr_fields] == field);
        assert(field->field_name == NULL);
-       memset(&ctx->fields[ctx->nr_fields], 0, sizeof(struct lttng_ctx_field));
+       ctx->fields[ctx->nr_fields] = NULL;
 }
 
-void lttng_destroy_context(struct lttng_ctx *ctx)
+void lttng_destroy_context(struct lttng_ust_ctx *ctx)
 {
        int i;
 
        if (!ctx)
                return;
        for (i = 0; i < ctx->nr_fields; i++) {
-               if (ctx->fields[i].destroy)
-                       ctx->fields[i].destroy(&ctx->fields[i]);
-               free(ctx->fields[i].field_name);
+               if (ctx->fields[i]->destroy)
+                       ctx->fields[i]->destroy(ctx->fields[i]);
+               free(ctx->fields[i]->field_name);
+               free(ctx->fields[i]->event_field);
+               free(ctx->fields[i]);
        }
        free(ctx->fields);
        free(ctx);
@@ -273,18 +310,18 @@ void lttng_destroy_context(struct lttng_ctx *ctx)
  * a single RCU read-side critical section see either all old, or all
  * new handlers.
  */
-int lttng_ust_context_set_provider_rcu(struct lttng_ctx **_ctx,
+int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
                const char *name,
-               size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
-               void (*record)(struct lttng_ctx_field *field,
+               size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
+               void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan),
-               void (*get_value)(struct lttng_ctx_field *field,
-                       struct lttng_ctx_value *value))
+               void (*get_value)(struct lttng_ust_ctx_field *field,
+                       struct lttng_ust_ctx_value *value))
 {
        int i, ret;
-       struct lttng_ctx *ctx = *_ctx, *new_ctx;
-       struct lttng_ctx_field *new_fields;
+       struct lttng_ust_ctx *ctx = *_ctx, *new_ctx;
+       struct lttng_ust_ctx_field **new_fields;
 
        if (!ctx || !lttng_find_context_provider(ctx, name))
                return 0;
@@ -294,21 +331,23 @@ int lttng_ust_context_set_provider_rcu(struct lttng_ctx **_ctx,
        new_ctx = zmalloc(sizeof(*new_ctx));
        if (!new_ctx)
                return -ENOMEM;
+       new_ctx->struct_size = sizeof(*new_ctx);
        *new_ctx = *ctx;
        new_fields = zmalloc(sizeof(*new_fields) * ctx->allocated_fields);
        if (!new_fields) {
                ret = -ENOMEM;
                goto field_error;
        }
+       /* Copy pointers */
        memcpy(new_fields, ctx->fields,
                sizeof(*new_fields) * ctx->allocated_fields);
        for (i = 0; i < ctx->nr_fields; i++) {
-               if (strncmp(new_fields[i].event_field.name,
+               if (strncmp(new_fields[i]->event_field->name,
                                name, strlen(name)) != 0)
                        continue;
-               new_fields[i].get_size = get_size;
-               new_fields[i].record = record;
-               new_fields[i].get_value = get_value;
+               new_fields[i]->get_size = get_size;
+               new_fields[i]->record = record;
+               new_fields[i]->get_value = get_value;
        }
        new_ctx->fields = new_fields;
        lttng_ust_rcu_assign_pointer(*_ctx, new_ctx);
@@ -322,7 +361,7 @@ field_error:
        return ret;
 }
 
-int lttng_context_init_all(struct lttng_ctx **ctx)
+int lttng_context_init_all(struct lttng_ust_ctx **ctx)
 {
        int ret;
 
index 4af0bc6d7bb247e1b3f5f480e63725c5b0d11809..035548947ad381af2338fc371040ab1608d93703 100644 (file)
@@ -516,7 +516,7 @@ int lttng_create_all_event_enums(size_t nr_fields,
 
 static
 int lttng_create_all_ctx_enums(size_t nr_fields,
-               const struct lttng_ctx_field *ctx_fields,
+               struct lttng_ust_ctx_field **ctx_fields,
                struct lttng_session *session)
 {
        size_t i;
@@ -524,7 +524,7 @@ int lttng_create_all_ctx_enums(size_t nr_fields,
 
        /* For each field, ensure enum is part of the session. */
        for (i = 0; i < nr_fields; i++) {
-               const struct lttng_type *type = &ctx_fields[i].event_field.type;
+               const struct lttng_type *type = &ctx_fields[i]->event_field->type;
 
                ret = lttng_create_enum_check(type, session);
                if (ret)
@@ -570,8 +570,8 @@ int lttng_session_enable(struct lttng_session *session)
         * we need to use.
         */
        cds_list_for_each_entry(chan, &session->priv->chan_head, node) {
-               const struct lttng_ctx *ctx;
-               const struct lttng_ctx_field *fields = NULL;
+               const struct lttng_ust_ctx *ctx;
+               struct lttng_ust_ctx_field **fields = NULL;
                size_t nr_fields = 0;
                uint32_t chan_id;
 
@@ -1546,7 +1546,7 @@ int lttng_event_notifier_enabler_attach_exclusion(
 
 int lttng_attach_context(struct lttng_ust_abi_context *context_param,
                union lttng_ust_abi_args *uargs,
-               struct lttng_ctx **ctx, struct lttng_session *session)
+               struct lttng_ust_ctx **ctx, struct lttng_session *session)
 {
        /*
         * We cannot attach a context after trace has been started for a
@@ -1947,12 +1947,12 @@ void lttng_session_lazy_sync_event_enablers(struct lttng_session *session)
  * context (either app context callbacks, or dummy callbacks).
  */
 void lttng_ust_context_set_session_provider(const char *name,
-               size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
-               void (*record)(struct lttng_ctx_field *field,
+               size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
+               void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan),
-               void (*get_value)(struct lttng_ctx_field *field,
-                       struct lttng_ctx_value *value))
+               void (*get_value)(struct lttng_ust_ctx_field *field,
+                       struct lttng_ust_ctx_value *value))
 {
        struct lttng_ust_session_private *session_priv;
 
@@ -1988,12 +1988,12 @@ void lttng_ust_context_set_session_provider(const char *name,
  * context (either app context callbacks, or dummy callbacks).
  */
 void lttng_ust_context_set_event_notifier_group_provider(const char *name,
-               size_t (*get_size)(struct lttng_ctx_field *field, size_t offset),
-               void (*record)(struct lttng_ctx_field *field,
+               size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
+               void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan),
-               void (*get_value)(struct lttng_ctx_field *field,
-                       struct lttng_ctx_value *value))
+               void (*get_value)(struct lttng_ust_ctx_field *field,
+                       struct lttng_ust_ctx_value *value))
 {
        struct lttng_event_notifier_group *event_notifier_group;
 
index 09d58c5f568f9c7fdc53287ab7652b93ca7a7d23..31934b674637c71df83351a65c05fc07ea1bcfeb 100644 (file)
@@ -70,7 +70,7 @@ static inline uint64_t lib_ring_buffer_clock_read(struct lttng_ust_lib_ring_buff
 }
 
 static inline
-size_t ctx_get_aligned_size(size_t offset, struct lttng_ctx *ctx,
+size_t ctx_get_aligned_size(size_t offset, struct lttng_ust_ctx *ctx,
                size_t ctx_len)
 {
        size_t orig_offset = offset;
@@ -83,7 +83,7 @@ size_t ctx_get_aligned_size(size_t offset, struct lttng_ctx *ctx,
 }
 
 static inline
-void ctx_get_struct_size(struct lttng_ctx *ctx, size_t *ctx_len,
+void ctx_get_struct_size(struct lttng_ust_ctx *ctx, size_t *ctx_len,
                enum app_ctx_mode mode)
 {
        int i;
@@ -95,9 +95,9 @@ void ctx_get_struct_size(struct lttng_ctx *ctx, size_t *ctx_len,
        }
        for (i = 0; i < ctx->nr_fields; i++) {
                if (mode == APP_CTX_ENABLED) {
-                       offset += ctx->fields[i].get_size(&ctx->fields[i], offset);
+                       offset += ctx->fields[i]->get_size(ctx->fields[i], offset);
                } else {
-                       if (lttng_context_is_app(ctx->fields[i].event_field.name)) {
+                       if (lttng_context_is_app(ctx->fields[i]->event_field->name)) {
                                /*
                                 * Before UST 2.8, we cannot use the
                                 * application context, because we
@@ -108,9 +108,9 @@ void ctx_get_struct_size(struct lttng_ctx *ctx, size_t *ctx_len,
                                 * concurrently with application context
                                 * register/unregister.
                                 */
-                               offset += lttng_ust_dummy_get_size(&ctx->fields[i], offset);
+                               offset += lttng_ust_dummy_get_size(ctx->fields[i], offset);
                        } else {
-                               offset += ctx->fields[i].get_size(&ctx->fields[i], offset);
+                               offset += ctx->fields[i]->get_size(ctx->fields[i], offset);
                        }
                }
        }
@@ -120,7 +120,7 @@ void ctx_get_struct_size(struct lttng_ctx *ctx, size_t *ctx_len,
 static inline
 void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx,
                struct lttng_channel *chan,
-               struct lttng_ctx *ctx,
+               struct lttng_ust_ctx *ctx,
                enum app_ctx_mode mode)
 {
        int i;
@@ -130,9 +130,9 @@ void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx,
        lib_ring_buffer_align_ctx(bufctx, ctx->largest_align);
        for (i = 0; i < ctx->nr_fields; i++) {
                if (mode == APP_CTX_ENABLED) {
-                       ctx->fields[i].record(&ctx->fields[i], bufctx, chan);
+                       ctx->fields[i]->record(ctx->fields[i], bufctx, chan);
                } else {
-                       if (lttng_context_is_app(ctx->fields[i].event_field.name)) {
+                       if (lttng_context_is_app(ctx->fields[i]->event_field->name)) {
                                /*
                                 * Before UST 2.8, we cannot use the
                                 * application context, because we
@@ -143,9 +143,9 @@ void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx,
                                 * concurrently with application context
                                 * register/unregister.
                                 */
-                               lttng_ust_dummy_record(&ctx->fields[i], bufctx, chan);
+                               lttng_ust_dummy_record(ctx->fields[i], bufctx, chan);
                        } else {
-                               ctx->fields[i].record(&ctx->fields[i], bufctx, chan);
+                               ctx->fields[i]->record(ctx->fields[i], bufctx, chan);
                        }
                }
        }
index 59b2700ee357b364b2e22a8475e67e611494c161..325fb5f9f74d9cb817410d08ce84a01ad6739f91 100644 (file)
@@ -28,9 +28,9 @@
 struct lttng_session;
 struct lttng_channel;
 struct lttng_event;
-struct lttng_ctx_field;
+struct lttng_ust_ctx_field;
 struct lttng_ust_lib_ring_buffer_ctx;
-struct lttng_ctx_value;
+struct lttng_ust_ctx_value;
 struct lttng_ust_event_notifier;
 
 __attribute__((visibility("hidden")))
@@ -88,15 +88,15 @@ __attribute__((visibility("hidden")))
 ssize_t lttng_ust_read(int fd, void *buf, size_t len);
 
 __attribute__((visibility("hidden")))
-size_t lttng_ust_dummy_get_size(struct lttng_ctx_field *field, size_t offset);
+size_t lttng_ust_dummy_get_size(struct lttng_ust_ctx_field *field, size_t offset);
 
 __attribute__((visibility("hidden")))
-void lttng_ust_dummy_record(struct lttng_ctx_field *field,
+void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan);
 __attribute__((visibility("hidden")))
-void lttng_ust_dummy_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value);
+void lttng_ust_dummy_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value);
 
 __attribute__((visibility("hidden")))
 void lttng_event_notifier_notification_send(
index 7953176335a6e0c4f9c30b2ec28d798fb790f5fd..3ed0f1989e788908efe73de9c356bcf46792e181 100644 (file)
@@ -379,7 +379,7 @@ static
 long lttng_abi_add_context(int objd,
        struct lttng_ust_abi_context *context_param,
        union lttng_ust_abi_args *uargs,
-       struct lttng_ctx **ctx, struct lttng_session *session)
+       struct lttng_ust_ctx **ctx, struct lttng_session *session)
 {
        return lttng_attach_context(context_param, uargs, ctx, session);
 }
index 1f291c4ed65c4f7d33b1fd3742dffd6855013b46..19f62840d66fe73cff9a7fb557b53f3aad9bf4de 100644 (file)
@@ -105,7 +105,7 @@ struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_session *session,
        return NULL;
 }
 
-size_t lttng_ust_dummy_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t lttng_ust_dummy_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -114,7 +114,7 @@ size_t lttng_ust_dummy_get_size(struct lttng_ctx_field *field, size_t offset)
        return size;
 }
 
-void lttng_ust_dummy_record(struct lttng_ctx_field *field,
+void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -124,8 +124,8 @@ void lttng_ust_dummy_record(struct lttng_ctx_field *field,
        chan->ops->event_write(ctx, &sel_char, sizeof(sel_char));
 }
 
-void lttng_ust_dummy_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void lttng_ust_dummy_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        value->sel = LTTNG_UST_DYNAMIC_TYPE_NONE;
 }
index 505db0b131bba830b9a55343719c7e4962798bde..e568d5ee352a81aa8af0658c4fc12062f54e54fb 100644 (file)
@@ -79,7 +79,7 @@ struct lttng_event_enabler {
         * Unused, but kept around to make it explicit that the tracer can do
         * it.
         */
-       struct lttng_ctx *ctx;
+       struct lttng_ust_ctx *ctx;
 };
 
 struct lttng_event_notifier_enabler {
@@ -220,7 +220,7 @@ struct lttng_event_notifier_group {
        struct cds_list_head enablers_head;
        struct cds_list_head event_notifiers_head;      /* list of event_notifiers */
        struct lttng_ust_event_notifier_ht event_notifiers_ht; /* hashtable of event_notifiers */
-       struct lttng_ctx *ctx;                  /* contexts for filters. */
+       struct lttng_ust_ctx *ctx;                      /* contexts for filters. */
 
        struct lttng_counter *error_counter;
        size_t error_counter_len;
@@ -278,7 +278,7 @@ struct lttng_ust_bytecode_runtime_private {
         * Pointer to a URCU-protected pointer owned by an `struct
         * lttng_session`or `struct lttng_event_notifier_group`.
         */
-       struct lttng_ctx **pctx;
+       struct lttng_ust_ctx **pctx;
 };
 
 struct lttng_ust_session_private {
@@ -303,7 +303,7 @@ struct lttng_ust_session_private {
        /* New UST 2.8 */
        struct lttng_ust_enum_ht enums_ht;      /* ht of enumerations */
        struct cds_list_head enums_head;
-       struct lttng_ctx *ctx;                  /* contexts for filters. */
+       struct lttng_ust_ctx *ctx;                      /* contexts for filters. */
 };
 
 struct lttng_enum {
@@ -395,7 +395,7 @@ int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *enabler,
  */
 __attribute__((visibility("hidden")))
 void lttng_enabler_link_bytecode(const struct lttng_ust_event_desc *event_desc,
-               struct lttng_ctx **ctx,
+               struct lttng_ust_ctx **ctx,
                struct cds_list_head *instance_bytecode_runtime_head,
                struct cds_list_head *enabler_bytecode_runtime_head);
 
@@ -498,7 +498,7 @@ __attribute__((visibility("hidden")))
 int lttng_add_perf_counter_to_ctx(uint32_t type,
                                  uint64_t config,
                                  const char *name,
-                                 struct lttng_ctx **ctx);
+                                 struct lttng_ust_ctx **ctx);
 
 __attribute__((visibility("hidden")))
 int lttng_perf_counter_init(void);
@@ -512,7 +512,7 @@ static inline
 int lttng_add_perf_counter_to_ctx(uint32_t type,
                                  uint64_t config,
                                  const char *name,
-                                 struct lttng_ctx **ctx)
+                                 struct lttng_ust_ctx **ctx)
 {
        return -ENOSYS;
 }
index 3d026095039091c6610e00557303c3ee3c9c78b2..20df12db0e80bb4b0d2cc001d7f8e04c4e6de180 100644 (file)
@@ -41,7 +41,7 @@ void test_inc_count(void)
 }
 
 static
-size_t test_get_size(struct lttng_ctx_field *field, size_t offset)
+size_t test_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
        size_t size = 0;
@@ -102,7 +102,7 @@ size_t test_get_size(struct lttng_ctx_field *field, size_t offset)
 }
 
 static
-void test_record(struct lttng_ctx_field *field,
+void test_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -206,8 +206,8 @@ void test_record(struct lttng_ctx_field *field,
 }
 
 static
-void test_get_value(struct lttng_ctx_field *field,
-               struct lttng_ctx_value *value)
+void test_get_value(struct lttng_ust_ctx_field *field,
+               struct lttng_ust_ctx_value *value)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
 
@@ -254,6 +254,7 @@ void test_get_value(struct lttng_ctx_field *field,
 }
 
 struct lttng_ust_context_provider myprovider = {
+       .struct_size = sizeof(struct lttng_ust_context_provider),
        .name = "$app.myprovider",
        .get_size = test_get_size,
        .record = test_record,
This page took 0.091603 seconds and 4 git commands to generate.