Refactoring: context structures
[lttng-ust.git] / liblttng-ust / lttng-bytecode-specialize.c
index 2982a7930ccdc9cb0e215c1c7e32d0d975a7219e..c546c8d6dc411688943e8804128721ef69325fc1 100644 (file)
@@ -15,6 +15,7 @@
 #include "context-internal.h"
 #include "lttng-bytecode.h"
 #include "ust-events-internal.h"
+#include "ust-helper.h"
 
 static int lttng_fls(int val)
 {
@@ -253,7 +254,7 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
                case OBJECT_TYPE_ARRAY:
                {
                        const struct lttng_integer_type *integer_type;
-                       const struct lttng_event_field *field;
+                       const struct lttng_ust_event_field *field;
                        uint32_t elem_len, num_elems;
                        int signedness;
 
@@ -293,7 +294,7 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
                case OBJECT_TYPE_SEQUENCE:
                {
                        const struct lttng_integer_type *integer_type;
-                       const struct lttng_event_field *field;
+                       const struct lttng_ust_event_field *field;
                        uint32_t elem_len;
                        int signedness;
 
@@ -365,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)
 {
@@ -377,7 +378,7 @@ static int specialize_context_lookup_name(struct lttng_ctx *ctx,
        return lttng_get_context_index(ctx, name);
 }
 
-static int specialize_load_object(const struct lttng_event_field *field,
+static int specialize_load_object(const struct lttng_ust_event_field *field,
                struct vstack_load *load, bool is_context)
 {
        load->type = LOAD_OBJECT;
@@ -451,14 +452,14 @@ static int specialize_load_object(const struct lttng_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_event_field *field;
+       struct lttng_ust_ctx_field *ctx_field;
+       struct lttng_ust_event_field *field;
        struct bytecode_get_index_data gid;
        ssize_t data_offset;
 
@@ -466,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;
@@ -487,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)
@@ -496,8 +497,8 @@ 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_event_field *field;
+       struct lttng_ust_ctx_field *ctx_field;
+       struct lttng_ust_event_field *field;
        struct bytecode_get_index_data gid;
        ssize_t data_offset;
 
@@ -521,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;
@@ -556,7 +557,7 @@ static int specialize_payload_lookup(const struct lttng_ust_event_desc *event_de
        unsigned int i, nr_fields;
        bool found = false;
        uint32_t field_offset = 0;
-       const struct lttng_event_field *field;
+       const struct lttng_ust_event_field *field;
        int ret;
        struct bytecode_get_index_data gid;
        ssize_t data_offset;
@@ -565,8 +566,8 @@ static int specialize_payload_lookup(const struct lttng_ust_event_desc *event_de
        offset = ((struct get_symbol *) insn->data)->offset;
        name = runtime->p.priv->bc->bc.data + runtime->p.priv->bc->bc.reloc_offset + offset;
        for (i = 0; i < nr_fields; i++) {
-               field = &event_desc->fields[i];
-               if (field->u.ext.nofilter) {
+               field = event_desc->fields[i];
+               if (field->nofilter) {
                        continue;
                }
                if (!strcmp(field->name, name)) {
@@ -630,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);
 
This page took 0.02657 seconds and 4 git commands to generate.