Refactoring: context callbacks
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 28 Apr 2021 20:26:20 +0000 (16:26 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 29 Apr 2021 14:33:51 +0000 (10:33 -0400)
Refactor the context callbacks so they take a private pointer as
argument.

Note that the callstack context internally uses a per-cpu stack across
context size calculation and recording to the ring buffer, which
requires that preemption is disabled across those operations.

The get_size_arg and _get_size callbacks are merged into a single
callback.

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

42 files changed:
include/lttng/events.h
src/lttng-bytecode-interpreter.c
src/lttng-context-callstack-legacy-impl.h
src/lttng-context-callstack-stackwalk-impl.h
src/lttng-context-callstack.c
src/lttng-context-cgroup-ns.c
src/lttng-context-cpu-id.c
src/lttng-context-egid.c
src/lttng-context-euid.c
src/lttng-context-gid.c
src/lttng-context-hostname.c
src/lttng-context-interruptible.c
src/lttng-context-ipc-ns.c
src/lttng-context-migratable.c
src/lttng-context-mnt-ns.c
src/lttng-context-need-reschedule.c
src/lttng-context-net-ns.c
src/lttng-context-nice.c
src/lttng-context-perf-counters.c
src/lttng-context-pid-ns.c
src/lttng-context-pid.c
src/lttng-context-ppid.c
src/lttng-context-prio.c
src/lttng-context-procname.c
src/lttng-context-sgid.c
src/lttng-context-suid.c
src/lttng-context-tid.c
src/lttng-context-time-ns.c
src/lttng-context-uid.c
src/lttng-context-user-ns.c
src/lttng-context-uts-ns.c
src/lttng-context-vegid.c
src/lttng-context-veuid.c
src/lttng-context-vgid.c
src/lttng-context-vpid.c
src/lttng-context-vppid.c
src/lttng-context-vsgid.c
src/lttng-context-vsuid.c
src/lttng-context-vtid.c
src/lttng-context-vuid.c
src/lttng-context.c
src/lttng-ring-buffer-client.h

index 8c200bdd49787ee7b5960f1bff741eea1413d838..464adb2c2ff9a8ecd187137be8b453ed31ef925d 100644 (file)
@@ -246,11 +246,10 @@ struct lttng_kernel_event_field {
                _fields                                                                                 \
        )
 
-#define lttng_kernel_static_ctx_field(_event_field, _get_size, _get_size_arg, _record, _get_value, _destroy, _priv) \
+#define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv)   \
        __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, {                                 \
                .event_field = (_event_field),                                                          \
                .get_size = (_get_size),                                                                \
-               .get_size_arg = (_get_size_arg),                                                        \
                .record = (_record),                                                                    \
                .get_value = (_get_value),                                                              \
                .destroy = (_destroy),                                                                  \
@@ -303,10 +302,12 @@ struct lttng_kernel_event_field {
                }                                                                                       \
        }),
 
-union lttng_ctx_value {
-       int64_t s64;
-       const char *str;
-       double d;
+struct lttng_ctx_value {
+       union {
+               int64_t s64;
+               const char *str;
+               double d;
+       } u;
 };
 
 /*
@@ -334,17 +335,14 @@ struct lttng_probe_ctx {
 
 struct lttng_kernel_ctx_field {
        const struct lttng_kernel_event_field *event_field;
-       size_t (*get_size)(size_t offset);
-       size_t (*get_size_arg)(size_t offset, struct lttng_kernel_ctx_field *field,
-                              struct lib_ring_buffer_ctx *ctx,
-                              struct lttng_channel *chan);
-       void (*record)(struct lttng_kernel_ctx_field *field,
-                      struct lib_ring_buffer_ctx *ctx,
-                      struct lttng_channel *chan);
-       void (*get_value)(struct lttng_kernel_ctx_field *field,
-                        struct lttng_probe_ctx *lttng_probe_ctx,
-                        union lttng_ctx_value *value);
-       void (*destroy)(struct lttng_kernel_ctx_field *field);
+       size_t (*get_size)(void *priv, struct lttng_probe_ctx *probe_ctx,
+                       size_t offset);
+       void (*record)(void *priv, struct lttng_probe_ctx *probe_ctx,
+                       struct lib_ring_buffer_ctx *ctx,
+                       struct lttng_channel *chan);
+       void (*get_value)(void *priv, struct lttng_probe_ctx *probe_ctx,
+                       struct lttng_ctx_value *value);
+       void (*destroy)(void *priv);
        void *priv;
 };
 
index 0161d673ccb6c45ed58ac799f5c7b0fcd2840f82..8ffe2f41d14156aa9b2050b563519ce4a7f985f8 100644 (file)
@@ -273,7 +273,7 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
 
        struct lttng_kernel_ctx_field *ctx_field;
        const struct lttng_kernel_event_field *field;
-       union lttng_ctx_value v;
+       struct lttng_ctx_value v;
 
        ctx_field = &lttng_static_ctx->fields[idx];
        field = ctx_field->event_field;
@@ -283,14 +283,14 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
 
        switch (field->type->type) {
        case lttng_kernel_type_integer:
-               ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
+               ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
                if (lttng_kernel_get_type_integer(field->type)->signedness) {
                        ptr->object_type = OBJECT_TYPE_S64;
-                       ptr->u.s64 = v.s64;
+                       ptr->u.s64 = v.u.s64;
                        ptr->ptr = &ptr->u.s64;
                } else {
                        ptr->object_type = OBJECT_TYPE_U64;
-                       ptr->u.u64 = v.s64;     /* Cast. */
+                       ptr->u.u64 = v.u.s64;   /* Cast. */
                        ptr->ptr = &ptr->u.u64;
                }
                break;
@@ -299,14 +299,14 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                const struct lttng_kernel_type_enum *enum_type = lttng_kernel_get_type_enum(field->type);
                const struct lttng_kernel_type_integer *integer_type = lttng_kernel_get_type_integer(enum_type->container_type);
 
-               ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
+               ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
                if (integer_type->signedness) {
                        ptr->object_type = OBJECT_TYPE_SIGNED_ENUM;
-                       ptr->u.s64 = v.s64;
+                       ptr->u.s64 = v.u.s64;
                        ptr->ptr = &ptr->u.s64;
                } else {
                        ptr->object_type = OBJECT_TYPE_UNSIGNED_ENUM;
-                       ptr->u.u64 = v.s64;     /* Cast. */
+                       ptr->u.u64 = v.u.s64;   /* Cast. */
                        ptr->ptr = &ptr->u.u64;
                }
                break;
@@ -324,8 +324,8 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                        return -EINVAL;
                }
                ptr->object_type = OBJECT_TYPE_STRING;
-               ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
-               ptr->ptr = v.str;
+               ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
+               ptr->ptr = v.u.str;
                break;
        }
        case lttng_kernel_type_sequence:
@@ -341,14 +341,14 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                        return -EINVAL;
                }
                ptr->object_type = OBJECT_TYPE_STRING;
-               ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
-               ptr->ptr = v.str;
+               ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
+               ptr->ptr = v.u.str;
                break;
        }
        case lttng_kernel_type_string:
                ptr->object_type = OBJECT_TYPE_STRING;
-               ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
-               ptr->ptr = v.str;
+               ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
+               ptr->ptr = v.u.str;
                break;
        case lttng_kernel_type_struct:
                printk(KERN_WARNING "LTTng: bytecode: Structure type cannot be loaded.\n");
@@ -1488,14 +1488,14 @@ int lttng_bytecode_interpret(struct lttng_bytecode_runtime *kernel_bytecode,
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
                        struct lttng_kernel_ctx_field *ctx_field;
-                       union lttng_ctx_value v;
+                       struct lttng_ctx_value v;
 
                        dbg_printk("get context ref offset %u type string\n",
                                ref->offset);
                        ctx_field = &lttng_static_ctx->fields[ref->offset];
-                       ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
+                       ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
-                       estack_ax(stack, top)->u.s.str = v.str;
+                       estack_ax(stack, top)->u.s.str = v.u.str;
                        if (unlikely(!estack_ax(stack, top)->u.s.str)) {
                                dbg_printk("Bytecode warning: loading a NULL string.\n");
                                ret = -EINVAL;
@@ -1516,14 +1516,14 @@ int lttng_bytecode_interpret(struct lttng_bytecode_runtime *kernel_bytecode,
                        struct load_op *insn = (struct load_op *) pc;
                        struct field_ref *ref = (struct field_ref *) insn->data;
                        struct lttng_kernel_ctx_field *ctx_field;
-                       union lttng_ctx_value v;
+                       struct lttng_ctx_value v;
 
                        dbg_printk("get context ref offset %u type s64\n",
                                ref->offset);
                        ctx_field = &lttng_static_ctx->fields[ref->offset];
-                       ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
+                       ctx_field->get_value(ctx_field->priv, lttng_probe_ctx, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
-                       estack_ax_v = v.s64;
+                       estack_ax_v = v.u.s64;
                        estack_ax_t = REG_S64;
                        dbg_printk("ref get context s64 %lld\n",
                                (long long) estack_ax_v);
index edd13cf5d30445278cec1b49f522e54734e6ba92..34a977a0c550e0a48eaca3009ce1b1ef49eb3fdc 100644 (file)
@@ -95,19 +95,21 @@ void lttng_cs_set_init(struct lttng_cs __percpu *cs_set)
 /* Keep track of nesting inside userspace callstack context code */
 DEFINE_PER_CPU(int, callstack_user_nesting);
 
+/*
+ * Note: these callbacks expect to be invoked with preemption disabled across
+ * get_size and record due to its use of a per-cpu stack.
+ */
 static
-struct stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *field,
-                                       struct lib_ring_buffer_ctx *ctx)
+struct stack_trace *stack_trace_context(struct field_data *fdata, int cpu)
 {
        int buffer_nesting, cs_user_nesting;
        struct lttng_cs *cs;
-       struct field_data *fdata = field->priv;
 
        /*
         * Do not gather the userspace callstack context when the event was
         * triggered by the userspace callstack context saving mechanism.
         */
-       cs_user_nesting = per_cpu(callstack_user_nesting, ctx->priv.reserve_cpu);
+       cs_user_nesting = per_cpu(callstack_user_nesting, cpu);
 
        if (fdata->mode == CALLSTACK_USER && cs_user_nesting >= 1)
                return NULL;
@@ -119,8 +121,8 @@ struct stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *field,
         * max nesting is checked in lib_ring_buffer_get_cpu().
         * Check it again as a safety net.
         */
-       cs = per_cpu_ptr(fdata->cs_percpu, ctx->priv.reserve_cpu);
-       buffer_nesting = per_cpu(lib_ring_buffer_nesting, ctx->priv.reserve_cpu) - 1;
+       cs = per_cpu_ptr(fdata->cs_percpu, cpu);
+       buffer_nesting = per_cpu(lib_ring_buffer_nesting, cpu) - 1;
        if (buffer_nesting >= RING_BUFFER_MAX_NESTING)
                return NULL;
 
@@ -128,9 +130,7 @@ struct stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *field,
 }
 
 static
-size_t lttng_callstack_length_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
-                               struct lib_ring_buffer_ctx *ctx,
-                               struct lttng_channel *chan)
+size_t lttng_callstack_length_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t orig_offset = offset;
 
@@ -144,16 +144,15 @@ size_t lttng_callstack_length_get_size(size_t offset, struct lttng_kernel_ctx_fi
  * resulting callstack is saved to be accessed in the record step.
  */
 static
-size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
-                                       struct lib_ring_buffer_ctx *ctx,
-                                       struct lttng_channel *chan)
+size_t lttng_callstack_sequence_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        struct stack_trace *trace;
-       struct field_data *fdata = field->priv;
+       struct field_data *fdata = (struct field_data *) priv;
        size_t orig_offset = offset;
+       int cpu = smp_processor_id();
 
        /* do not write data if no space is available */
-       trace = stack_trace_context(field, ctx);
+       trace = stack_trace_context(fdata, cpu);
        if (unlikely(!trace)) {
                offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
                return offset - orig_offset;
@@ -163,13 +162,13 @@ size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_
        trace->nr_entries = 0;
 
        if (fdata->mode == CALLSTACK_USER)
-               ++per_cpu(callstack_user_nesting, ctx->priv.reserve_cpu);
+               ++per_cpu(callstack_user_nesting, cpu);
 
        /* do the real work and reserve space */
        cs_types[fdata->mode].save_func(trace);
 
        if (fdata->mode == CALLSTACK_USER)
-               per_cpu(callstack_user_nesting, ctx->priv.reserve_cpu)--;
+               per_cpu(callstack_user_nesting, cpu)--;
 
        /*
         * Remove final ULONG_MAX delimiter. If we cannot find it, add
@@ -189,11 +188,13 @@ size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_
 }
 
 static
-void lttng_callstack_length_record(struct lttng_kernel_ctx_field *field,
+void lttng_callstack_length_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                        struct lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan)
 {
-       struct stack_trace *trace = stack_trace_context(field, ctx);
+       int cpu = ctx->priv.reserve_cpu;
+       struct field_data *fdata = (struct field_data *) priv;
+       struct stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
@@ -207,11 +208,13 @@ void lttng_callstack_length_record(struct lttng_kernel_ctx_field *field,
        chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
 }
 static
-void lttng_callstack_sequence_record(struct lttng_kernel_ctx_field *field,
+void lttng_callstack_sequence_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                        struct lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan)
 {
-       struct stack_trace *trace = stack_trace_context(field, ctx);
+       int cpu = ctx->priv.reserve_cpu;
+       struct field_data *fdata = (struct field_data *) priv;
+       struct stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
index a7c5a062fb10f521f8a3722f2f0c1a40bab88850..2e43735904a00523e3049b9502cbe0b69c40164d 100644 (file)
@@ -97,19 +97,21 @@ void lttng_cs_set_init(struct lttng_cs __percpu *cs_set)
 /* Keep track of nesting inside userspace callstack context code */
 DEFINE_PER_CPU(int, callstack_user_nesting);
 
+/*
+ * Note: these callbacks expect to be invoked with preemption disabled across
+ * get_size and record due to its use of a per-cpu stack.
+ */
 static
-struct lttng_stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *field,
-                                       struct lib_ring_buffer_ctx *ctx)
+struct lttng_stack_trace *stack_trace_context(struct field_data *fdata, int cpu)
 {
        int buffer_nesting, cs_user_nesting;
        struct lttng_cs *cs;
-       struct field_data *fdata = field->priv;
 
        /*
         * Do not gather the userspace callstack context when the event was
         * triggered by the userspace callstack context saving mechanism.
         */
-       cs_user_nesting = per_cpu(callstack_user_nesting, ctx->priv.reserve_cpu);
+       cs_user_nesting = per_cpu(callstack_user_nesting, cpu);
 
        if (fdata->mode == CALLSTACK_USER && cs_user_nesting >= 1)
                return NULL;
@@ -121,8 +123,8 @@ struct lttng_stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *fie
         * max nesting is checked in lib_ring_buffer_get_cpu().
         * Check it again as a safety net.
         */
-       cs = per_cpu_ptr(fdata->cs_percpu, ctx->priv.reserve_cpu);
-       buffer_nesting = per_cpu(lib_ring_buffer_nesting, ctx->priv.reserve_cpu) - 1;
+       cs = per_cpu_ptr(fdata->cs_percpu, cpu);
+       buffer_nesting = per_cpu(lib_ring_buffer_nesting, cpu) - 1;
        if (buffer_nesting >= RING_BUFFER_MAX_NESTING)
                return NULL;
 
@@ -130,9 +132,7 @@ struct lttng_stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *fie
 }
 
 static
-size_t lttng_callstack_length_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
-                               struct lib_ring_buffer_ctx *ctx,
-                               struct lttng_channel *chan)
+size_t lttng_callstack_length_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t orig_offset = offset;
 
@@ -146,16 +146,15 @@ size_t lttng_callstack_length_get_size(size_t offset, struct lttng_kernel_ctx_fi
  * resulting callstack is saved to be accessed in the record step.
  */
 static
-size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
-                                       struct lib_ring_buffer_ctx *ctx,
-                                       struct lttng_channel *chan)
+size_t lttng_callstack_sequence_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        struct lttng_stack_trace *trace;
-       struct field_data *fdata = field->priv;
+       struct field_data *fdata = (struct field_data *) priv;
        size_t orig_offset = offset;
+       int cpu = smp_processor_id();
 
        /* do not write data if no space is available */
-       trace = stack_trace_context(field, ctx);
+       trace = stack_trace_context(fdata, cpu);
        if (unlikely(!trace)) {
                offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
                return offset - orig_offset;
@@ -171,11 +170,11 @@ size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_
                                                MAX_ENTRIES, 0);
                break;
        case CALLSTACK_USER:
-               ++per_cpu(callstack_user_nesting, ctx->priv.reserve_cpu);
+               ++per_cpu(callstack_user_nesting, cpu);
                /* do the real work and reserve space */
                trace->nr_entries = save_func_user(trace->entries,
                                                MAX_ENTRIES);
-               per_cpu(callstack_user_nesting, ctx->priv.reserve_cpu)--;
+               per_cpu(callstack_user_nesting, cpu)--;
                break;
        default:
                WARN_ON_ONCE(1);
@@ -194,11 +193,13 @@ size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_
 }
 
 static
-void lttng_callstack_length_record(struct lttng_kernel_ctx_field *field,
+void lttng_callstack_length_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                        struct lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan)
 {
-       struct lttng_stack_trace *trace = stack_trace_context(field, ctx);
+       int cpu = ctx->priv.reserve_cpu;
+       struct field_data *fdata = (struct field_data *) priv;
+       struct lttng_stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
@@ -213,11 +214,13 @@ void lttng_callstack_length_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void lttng_callstack_sequence_record(struct lttng_kernel_ctx_field *field,
+void lttng_callstack_sequence_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                        struct lib_ring_buffer_ctx *ctx,
                        struct lttng_channel *chan)
 {
-       struct lttng_stack_trace *trace = stack_trace_context(field, ctx);
+       int cpu = ctx->priv.reserve_cpu;
+       struct field_data *fdata = (struct field_data *) priv;
+       struct lttng_stack_trace *trace = stack_trace_context(fdata, cpu);
        unsigned int nr_seq_entries;
 
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
index e6ac259621b5f8b557228736cd2380fc97056fca..7e44fafa2f633d337abbedad6c6dd065e678fa90 100644 (file)
@@ -90,9 +90,9 @@ error_alloc:
 }
 
 static
-void lttng_callstack_sequence_destroy(struct lttng_kernel_ctx_field *field)
+void lttng_callstack_sequence_destroy(void *priv)
 {
-       struct field_data *fdata = field->priv;
+       struct field_data *fdata = priv;
 
        field_data_free(fdata);
 }
@@ -158,7 +158,7 @@ int __lttng_add_callstack_generic(struct lttng_kernel_ctx **ctx,
        }
        memset(&ctx_field, 0, sizeof(ctx_field));
        ctx_field.event_field = event_fields[0];
-       ctx_field.get_size_arg = lttng_callstack_length_get_size;
+       ctx_field.get_size = lttng_callstack_length_get_size;
        ctx_field.record = lttng_callstack_length_record;
        ctx_field.priv = fdata;
        ret = lttng_kernel_context_append(ctx, &ctx_field);
@@ -169,7 +169,7 @@ int __lttng_add_callstack_generic(struct lttng_kernel_ctx **ctx,
 
        memset(&ctx_field, 0, sizeof(ctx_field));
        ctx_field.event_field = event_fields[1];
-       ctx_field.get_size_arg = lttng_callstack_sequence_get_size;
+       ctx_field.get_size = lttng_callstack_sequence_get_size;
        ctx_field.record = lttng_callstack_sequence_record;
        ctx_field.destroy = lttng_callstack_sequence_destroy;
        ctx_field.priv = fdata;
index f34e9cf6508ada2315d4867c00afcf90b0f547de..0bc345c5f9c9d3c2d1ef58b7dd898260434450c8 100644 (file)
@@ -25,7 +25,7 @@
         LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
 
 static
-size_t cgroup_ns_get_size(size_t offset)
+size_t cgroup_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -35,7 +35,7 @@ size_t cgroup_ns_get_size(size_t offset)
 }
 
 static
-void cgroup_ns_record(struct lttng_kernel_ctx_field *field,
+void cgroup_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -56,9 +56,9 @@ void cgroup_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void cgroup_ns_get_value(struct lttng_kernel_ctx_field *field,
+void cgroup_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int cgroup_ns_inum = 0;
 
@@ -72,7 +72,7 @@ void cgroup_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (current->nsproxy)
                cgroup_ns_inum = current->nsproxy->cgroup_ns->lttng_ns_inum;
 
-       value->s64 = cgroup_ns_inum;
+       value->u.s64 = cgroup_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -80,7 +80,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        cgroup_ns_get_size,
-       NULL,
        cgroup_ns_record,
        cgroup_ns_get_value,
        NULL, NULL);
index 7ae79a64347739ada4eec1172e22963e1553ddc0..9e1d71a29725116c3f5cf4c8eeeef31587d17e6e 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t cpu_id_get_size(size_t offset)
+size_t cpu_id_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t cpu_id_get_size(size_t offset)
 }
 
 static
-void cpu_id_record(struct lttng_kernel_ctx_field *field,
+void cpu_id_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -39,11 +39,11 @@ void cpu_id_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void cpu_id_get_value(struct lttng_kernel_ctx_field *field,
+void cpu_id_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = smp_processor_id();
+       value->u.s64 = smp_processor_id();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -51,7 +51,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
                false, false, false),
        cpu_id_get_size,
-       NULL,
        cpu_id_record,
        cpu_id_get_value,
        NULL, NULL);
index 027991ccb7f01a6c5348bf5d35cdfb2827bf5319..958ada67144c45254aef8d07a33647d229776dd4 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t egid_get_size(size_t offset)
+size_t egid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t egid_get_size(size_t offset)
 }
 
 static
-void egid_record(struct lttng_kernel_ctx_field *field,
+void egid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void egid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void egid_get_value(struct lttng_kernel_ctx_field *field,
+void egid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_egid();
+       value->u.s64 = lttng_current_egid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
                false, false, false),
        egid_get_size,
-       NULL,
        egid_record,
        egid_get_value,
        NULL, NULL);
index 3888da1dba3b4e2e63f575d3d6bbbb2bb4e589fc..4bd106ae356aaa69fdc9e9a4868382a95e92b1ad 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t euid_get_size(size_t offset)
+size_t euid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t euid_get_size(size_t offset)
 }
 
 static
-void euid_record(struct lttng_kernel_ctx_field *field,
+void euid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void euid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void euid_get_value(struct lttng_kernel_ctx_field *field,
+void euid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_euid();
+       value->u.s64 = lttng_current_euid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
                false, false, false),
        euid_get_size,
-       NULL,
        euid_record,
        euid_get_value,
        NULL, NULL);
index 4a45bcdf6b883438dd5808d17fc8427d81dd1d6d..721e1a38fcce56247f444687a03a1c4069b9e6e6 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t gid_get_size(size_t offset)
+size_t gid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t gid_get_size(size_t offset)
 }
 
 static
-void gid_record(struct lttng_kernel_ctx_field *field,
+void gid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void gid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void gid_get_value(struct lttng_kernel_ctx_field *field,
+void gid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_gid();
+       value->u.s64 = lttng_current_gid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
                false, false, false),
        gid_get_size,
-       NULL,
        gid_record,
        gid_get_value,
        NULL, NULL);
index d00c5356ae6c1f5715214bf78052377f960943f4..df46293b0bf860914cc92717aed22f8e2d793723 100644 (file)
@@ -20,7 +20,7 @@
 #define LTTNG_HOSTNAME_CTX_LEN (__NEW_UTS_LEN + 1)
 
 static
-size_t hostname_get_size(size_t offset)
+size_t hostname_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t hostname_get_size(size_t offset)
 }
 
 static
-void hostname_record(struct lttng_kernel_ctx_field *field,
+void hostname_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -54,9 +54,9 @@ void hostname_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void hostname_get_value(struct lttng_kernel_ctx_field *field,
+void hostname_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        struct nsproxy *nsproxy;
        struct uts_namespace *ns;
@@ -73,7 +73,7 @@ void hostname_get_value(struct lttng_kernel_ctx_field *field,
        } else {
                hostname = "";
        }
-       value->str = hostname;
+       value->u.str = hostname;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -81,7 +81,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_array_text(LTTNG_HOSTNAME_CTX_LEN),
                false, false, false),
        hostname_get_size,
-       NULL,
        hostname_record,
        hostname_get_value,
        NULL, NULL);
index 1c78d59b737c21afb686923fc6bff11963518138..4d0596a3288bf74b029ada077f9a41e924ae4dcd 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 static
-size_t interruptible_get_size(size_t offset)
+size_t interruptible_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -32,7 +32,7 @@ size_t interruptible_get_size(size_t offset)
 }
 
 static
-void interruptible_record(struct lttng_kernel_ctx_field *field,
+void interruptible_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -44,13 +44,13 @@ void interruptible_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void interruptible_get_value(struct lttng_kernel_ctx_field *field,
+void interruptible_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        int8_t interruptible = lttng_probe_ctx->interruptible;
 
-       value->s64 = interruptible;
+       value->u.s64 = interruptible;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -58,7 +58,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(int8_t, __BYTE_ORDER, 10),
                false, false, false),
        interruptible_get_size,
-       NULL,
        interruptible_record,
        interruptible_get_value,
        NULL, NULL);
index 113ffb750648c86048be062c21aa4eae9b309796..278a4ae0feb333327848dd0bf07b7b4696bcb6b1 100644 (file)
@@ -23,7 +23,7 @@
        (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
 
 static
-size_t ipc_ns_get_size(size_t offset)
+size_t ipc_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -33,7 +33,7 @@ size_t ipc_ns_get_size(size_t offset)
 }
 
 static
-void ipc_ns_record(struct lttng_kernel_ctx_field *field,
+void ipc_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -54,9 +54,9 @@ void ipc_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void ipc_ns_get_value(struct lttng_kernel_ctx_field *field,
+void ipc_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int ipc_ns_inum = 0;
 
@@ -70,7 +70,7 @@ void ipc_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (current->nsproxy)
                ipc_ns_inum = current->nsproxy->ipc_ns->lttng_ns_inum;
 
-       value->s64 = ipc_ns_inum;
+       value->u.s64 = ipc_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -78,7 +78,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        ipc_ns_get_size,
-       NULL,
        ipc_ns_record,
        ipc_ns_get_value,
        NULL, NULL);
index 1695f512a66aa49e872f4fa047985046985a5a2f..19190bb9d158d5f48fea7990f4e92f23ffa93952 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t migratable_get_size(size_t offset)
+size_t migratable_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t migratable_get_size(size_t offset)
 }
 
 static
-void migratable_record(struct lttng_kernel_ctx_field *field,
+void migratable_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -38,11 +38,11 @@ void migratable_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void migratable_get_value(struct lttng_kernel_ctx_field *field,
+void migratable_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = !current->migrate_disable;
+       value->u.s64 = !current->migrate_disable;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -50,7 +50,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10),
                false, false, false),
        migratable_get_size,
-       NULL,
        migratable_record,
        migratable_get_value,
        NULL, NULL);
index 232c5defff7442b285f618d978f21457ba23f0ef..79b702caebced3d59a76ff17b4c0650b4268eb52 100644 (file)
@@ -26,7 +26,7 @@
 #include <../fs/mount.h>
 
 static
-size_t mnt_ns_get_size(size_t offset)
+size_t mnt_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -36,7 +36,7 @@ size_t mnt_ns_get_size(size_t offset)
 }
 
 static
-void mnt_ns_record(struct lttng_kernel_ctx_field *field,
+void mnt_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -57,9 +57,9 @@ void mnt_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void mnt_ns_get_value(struct lttng_kernel_ctx_field *field,
+void mnt_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int mnt_ns_inum = 0;
 
@@ -73,7 +73,7 @@ void mnt_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (current->nsproxy)
                mnt_ns_inum = current->nsproxy->mnt_ns->lttng_ns_inum;
 
-       value->s64 = mnt_ns_inum;
+       value->u.s64 = mnt_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -81,7 +81,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        mnt_ns_get_size,
-       NULL,
        mnt_ns_record,
        mnt_ns_get_value,
        NULL, NULL);
index 6f3d61d6c0942a0df5f875a5f99246026c7f33a3..6984d1a44d7dfdac404c550e5cad042272da501f 100644 (file)
@@ -18,7 +18,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t need_reschedule_get_size(size_t offset)
+size_t need_reschedule_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -28,7 +28,7 @@ size_t need_reschedule_get_size(size_t offset)
 }
 
 static
-void need_reschedule_record(struct lttng_kernel_ctx_field *field,
+void need_reschedule_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -39,11 +39,11 @@ void need_reschedule_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void need_reschedule_get_value(struct lttng_kernel_ctx_field *field,
+void need_reschedule_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = test_tsk_need_resched(current);;
+       value->u.s64 = test_tsk_need_resched(current);;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -51,7 +51,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10),
                false, false, false),
        need_reschedule_get_size,
-       NULL,
        need_reschedule_record,
        need_reschedule_get_value,
        NULL, NULL);
index 1c8adf4962502b840fabb4d9e0488c6159632df7..a1a8d6dd7695a9fa9549dd5353358b09eea333d7 100644 (file)
@@ -24,7 +24,7 @@
        (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
 
 static
-size_t net_ns_get_size(size_t offset)
+size_t net_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -34,7 +34,7 @@ size_t net_ns_get_size(size_t offset)
 }
 
 static
-void net_ns_record(struct lttng_kernel_ctx_field *field,
+void net_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -55,9 +55,9 @@ void net_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void net_ns_get_value(struct lttng_kernel_ctx_field *field,
+void net_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int net_ns_inum = 0;
 
@@ -71,7 +71,7 @@ void net_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (current->nsproxy)
                net_ns_inum = current->nsproxy->net_ns->lttng_ns_inum;
 
-       value->s64 = net_ns_inum;
+       value->u.s64 = net_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -79,7 +79,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        net_ns_get_size,
-       NULL,
        net_ns_record,
        net_ns_get_value,
        NULL, NULL);
index 22b8696536903412d1dfccb9f950050d3c8be420..ef61570c502da79474c5d7217962be35b68fc957 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t nice_get_size(size_t offset)
+size_t nice_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t nice_get_size(size_t offset)
 }
 
 static
-void nice_record(struct lttng_kernel_ctx_field *field,
+void nice_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -39,11 +39,11 @@ void nice_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void nice_get_value(struct lttng_kernel_ctx_field *field,
+void nice_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = task_nice(current);
+       value->u.s64 = task_nice(current);
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -51,7 +51,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
                false, false, false),
        nice_get_size,
-       NULL,
        nice_record,
        nice_get_value,
        NULL, NULL);
index 535784752a790604f4fe933774d5de23d9d01e05..44c47640ca50039ff141fd859a219af12c0fe90a 100644 (file)
@@ -20,7 +20,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t perf_counter_get_size(size_t offset)
+size_t perf_counter_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -30,11 +30,11 @@ size_t perf_counter_get_size(size_t offset)
 }
 
 static
-void perf_counter_record(struct lttng_kernel_ctx_field *field,
+void perf_counter_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                         struct lib_ring_buffer_ctx *ctx,
                         struct lttng_channel *chan)
 {
-       struct lttng_perf_counter_field *perf_field = field->priv;
+       struct lttng_perf_counter_field *perf_field = (struct lttng_perf_counter_field *) priv;
        struct perf_event *event;
        uint64_t value;
 
@@ -77,9 +77,9 @@ void overflow_callback(struct perf_event *event, int nmi,
 #endif
 
 static
-void lttng_destroy_perf_counter_ctx_field(struct lttng_kernel_ctx_field *field)
+void lttng_destroy_perf_counter_ctx_field(void *priv)
 {
-       struct lttng_perf_counter_field *perf_field = field->priv;
+       struct lttng_perf_counter_field *perf_field = priv;
        struct perf_event **events = perf_field->e;
 
 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
index 1c3cc2bc7e6b8e1a35777bab70a6a7b86c717fe0..41c15cb531632f158eeeb581e901259e003336ba 100644 (file)
@@ -24,7 +24,7 @@
        (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
 
 static
-size_t pid_ns_get_size(size_t offset)
+size_t pid_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -34,7 +34,7 @@ size_t pid_ns_get_size(size_t offset)
 }
 
 static
-void pid_ns_record(struct lttng_kernel_ctx_field *field,
+void pid_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -56,9 +56,9 @@ void pid_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void pid_ns_get_value(struct lttng_kernel_ctx_field *field,
+void pid_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        struct pid_namespace *ns;
        unsigned int pid_ns_inum = 0;
@@ -73,7 +73,7 @@ void pid_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (ns)
                pid_ns_inum = ns->lttng_ns_inum;
 
-       value->s64 = pid_ns_inum;
+       value->u.s64 = pid_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -81,7 +81,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        pid_ns_get_size,
-       NULL,
        pid_ns_record,
        pid_ns_get_value,
        NULL, NULL);
index 6f613725aad4815791616637ed3ef2a5e470fe52..e3e962d666092124748a9660eda47f2938967333 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t pid_get_size(size_t offset)
+size_t pid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t pid_get_size(size_t offset)
 }
 
 static
-void pid_record(struct lttng_kernel_ctx_field *field,
+void pid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -39,11 +39,11 @@ void pid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void pid_get_value(struct lttng_kernel_ctx_field *field,
+void pid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = task_tgid_nr(current);
+       value->u.s64 = task_tgid_nr(current);
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -51,7 +51,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
                false, false, false),
        pid_get_size,
-       NULL,
        pid_record,
        pid_get_value,
        NULL, NULL);
index 63d02b89fc02c3a10f11ea2d5e073245768ed78c..1494f5c70a6c7ab17667e7e2988decc85531341e 100644 (file)
@@ -18,7 +18,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t ppid_get_size(size_t offset)
+size_t ppid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -28,7 +28,7 @@ size_t ppid_get_size(size_t offset)
 }
 
 static
-void ppid_record(struct lttng_kernel_ctx_field *field,
+void ppid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -49,9 +49,9 @@ void ppid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void ppid_get_value(struct lttng_kernel_ctx_field *field,
+void ppid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        pid_t ppid;
 
@@ -65,7 +65,7 @@ void ppid_get_value(struct lttng_kernel_ctx_field *field,
        rcu_read_lock();
        ppid = task_tgid_nr(current->real_parent);
        rcu_read_unlock();
-       value->s64 = ppid;
+       value->u.s64 = ppid;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -73,7 +73,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
                false, false, false),
        ppid_get_size,
-       NULL,
        ppid_record,
        ppid_get_value,
        NULL, NULL);
index b6f6c461c381ebc3a137a764a8028fe6765e86e0..3eb3ff9056b3a3022d4cb759efd22089121b5cbf 100644 (file)
@@ -44,7 +44,7 @@ int __canary__task_prio(const struct task_struct *p)
 }
 
 static
-size_t prio_get_size(size_t offset)
+size_t prio_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -54,7 +54,7 @@ size_t prio_get_size(size_t offset)
 }
 
 static
-void prio_record(struct lttng_kernel_ctx_field *field,
+void prio_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                struct lib_ring_buffer_ctx *ctx,
                struct lttng_channel *chan)
 {
@@ -66,11 +66,11 @@ void prio_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void prio_get_value(struct lttng_kernel_ctx_field *field,
+void prio_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = wrapper_task_prio_sym(current);
+       value->u.s64 = wrapper_task_prio_sym(current);
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -78,7 +78,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
                false, false, false),
        prio_get_size,
-       NULL,
        prio_record,
        prio_get_value,
        NULL, NULL);
index 3254c2e9c9448f458bda20b919ede304f00a7df5..94ba94e78879319f643bb6cbbba392b11ca4441b 100644 (file)
@@ -18,7 +18,7 @@
 #include <lttng/endian.h>
 
 static
-size_t procname_get_size(size_t offset)
+size_t procname_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -33,7 +33,7 @@ size_t procname_get_size(size_t offset)
  * could lead to crash in IRQ context and deadlock of the lockdep tracer.
  */
 static
-void procname_record(struct lttng_kernel_ctx_field *field,
+void procname_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void procname_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void procname_get_value(struct lttng_kernel_ctx_field *field,
+void procname_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->str = current->comm;
+       value->u.str = current->comm;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_array_text(sizeof(current->comm)),
                false, false, false),
        procname_get_size,
-       NULL,
        procname_record,
        procname_get_value,
        NULL, NULL);
index 28a448773f45b7729b33eccc598b079f808dbd46..23d5e5bc4e8229dbb2d643da479511debc646123 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t sgid_get_size(size_t offset)
+size_t sgid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t sgid_get_size(size_t offset)
 }
 
 static
-void sgid_record(struct lttng_kernel_ctx_field *field,
+void sgid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void sgid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void sgid_get_value(struct lttng_kernel_ctx_field *field,
+void sgid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_sgid();
+       value->u.s64 = lttng_current_sgid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
                false, false, false),
        sgid_get_size,
-       NULL,
        sgid_record,
        sgid_get_value,
        NULL, NULL);
index 9a03468d363356e91b3bab94b3420e3d94b1ca2f..5a9e7bebd54f9025c68e6dcd06ec1e6a3df0b852 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t suid_get_size(size_t offset)
+size_t suid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t suid_get_size(size_t offset)
 }
 
 static
-void suid_record(struct lttng_kernel_ctx_field *field,
+void suid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void suid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void suid_get_value(struct lttng_kernel_ctx_field *field,
+void suid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_suid();
+       value->u.s64 = lttng_current_suid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
                false, false, false),
        suid_get_size,
-       NULL,
        suid_record,
        suid_get_value,
        NULL, NULL);
index 89228a1f8194a4d784c6b2dab94290f58c5ab947..5a9dee54fd8f8c8c74b89541192c0567b621bf9f 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t tid_get_size(size_t offset)
+size_t tid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t tid_get_size(size_t offset)
 }
 
 static
-void tid_record(struct lttng_kernel_ctx_field *field,
+void tid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -39,14 +39,14 @@ void tid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void tid_get_value(struct lttng_kernel_ctx_field *field,
+void tid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        pid_t tid;
 
        tid = task_pid_nr(current);
-       value->s64 = tid;
+       value->u.s64 = tid;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -54,7 +54,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
                false, false, false),
        tid_get_size,
-       NULL,
        tid_record,
        tid_get_value,
        NULL, NULL);
index 831bbd45e2c9e7ba63d05946b603d8c91b836222..355feb163cc048f6963dfc4fb771c243d45afc9c 100644 (file)
@@ -24,7 +24,7 @@
 #if defined(CONFIG_TIME_NS)
 
 static
-size_t time_ns_get_size(size_t offset)
+size_t time_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -34,7 +34,7 @@ size_t time_ns_get_size(size_t offset)
 }
 
 static
-void time_ns_record(struct lttng_kernel_ctx_field *field,
+void time_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -55,9 +55,9 @@ void time_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void time_ns_get_value(struct lttng_kernel_ctx_field *field,
+void time_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int time_ns_inum = 0;
 
@@ -71,7 +71,7 @@ void time_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (current->nsproxy)
                time_ns_inum = current->nsproxy->time_ns->lttng_ns_inum;
 
-       value->s64 = time_ns_inum;
+       value->u.s64 = time_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -79,7 +79,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        time_ns_get_size,
-       NULL,
        time_ns_record,
        time_ns_get_value,
        NULL, NULL);
index 841d2ea726a1341b100f7d16a709da6d7546dd29..86d999afdfac324f3843394ccf4b263f86d132cd 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t uid_get_size(size_t offset)
+size_t uid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t uid_get_size(size_t offset)
 }
 
 static
-void uid_record(struct lttng_kernel_ctx_field *field,
+void uid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void uid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void uid_get_value(struct lttng_kernel_ctx_field *field,
+void uid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_uid();
+       value->u.s64 = lttng_current_uid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
                false, false, false),
        uid_get_size,
-       NULL,
        uid_record,
        uid_get_value,
        NULL, NULL);
index bbd689dfa15d64ab699fd2329ca4758c246b2512..f774d9716487f23c22c56621a7c1065c60ecf77b 100644 (file)
@@ -24,7 +24,7 @@
        (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
 
 static
-size_t user_ns_get_size(size_t offset)
+size_t user_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -34,7 +34,7 @@ size_t user_ns_get_size(size_t offset)
 }
 
 static
-void user_ns_record(struct lttng_kernel_ctx_field *field,
+void user_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -48,16 +48,16 @@ void user_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void user_ns_get_value(struct lttng_kernel_ctx_field *field,
+void user_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int user_ns_inum = 0;
 
        if (current_user_ns())
                user_ns_inum = current_user_ns()->lttng_ns_inum;
 
-       value->s64 = user_ns_inum;
+       value->u.s64 = user_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -65,7 +65,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        user_ns_get_size,
-       NULL,
        user_ns_record,
        user_ns_get_value,
        NULL, NULL);
index 04ddc80ff7b8e9d0ce2ab2eb9967e529a07956be..204cafb658962065805e77e6c60d8896284e4d6b 100644 (file)
@@ -24,7 +24,7 @@
        (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
 
 static
-size_t uts_ns_get_size(size_t offset)
+size_t uts_ns_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -34,7 +34,7 @@ size_t uts_ns_get_size(size_t offset)
 }
 
 static
-void uts_ns_record(struct lttng_kernel_ctx_field *field,
+void uts_ns_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -55,9 +55,9 @@ void uts_ns_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void uts_ns_get_value(struct lttng_kernel_ctx_field *field,
+void uts_ns_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        unsigned int uts_ns_inum = 0;
 
@@ -71,7 +71,7 @@ void uts_ns_get_value(struct lttng_kernel_ctx_field *field,
        if (current->nsproxy)
                uts_ns_inum = current->nsproxy->uts_ns->lttng_ns_inum;
 
-       value->s64 = uts_ns_inum;
+       value->u.s64 = uts_ns_inum;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -79,7 +79,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
                false, false, false),
        uts_ns_get_size,
-       NULL,
        uts_ns_record,
        uts_ns_get_value,
        NULL, NULL);
index 0c775890bc49d9118a1dcee32fa5c00707807dfc..87c53baff039edbb3e4a05066257ce4c9a010dcb 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t vegid_get_size(size_t offset)
+size_t vegid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t vegid_get_size(size_t offset)
 }
 
 static
-void vegid_record(struct lttng_kernel_ctx_field *field,
+void vegid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void vegid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vegid_get_value(struct lttng_kernel_ctx_field *field,
+void vegid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_vegid();
+       value->u.s64 = lttng_current_vegid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
                false, false, false),
        vegid_get_size,
-       NULL,
        vegid_record,
        vegid_get_value,
        NULL, NULL);
index 0796872986f8a5650a7fd2deac6894660918acb6..5b4930dbcc11a7d27cdb55af7e91463446b86a2e 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t veuid_get_size(size_t offset)
+size_t veuid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t veuid_get_size(size_t offset)
 }
 
 static
-void veuid_record(struct lttng_kernel_ctx_field *field,
+void veuid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void veuid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void veuid_get_value(struct lttng_kernel_ctx_field *field,
+void veuid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_veuid();
+       value->u.s64 = lttng_current_veuid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
                false, false, false),
        veuid_get_size,
-       NULL,
        veuid_record,
        veuid_get_value,
        NULL, NULL);
index 00dd91d6e592764f5cca16a78d59388fa80032db..768ed519bc6e9ccf7566eef607b987cf95e0bb34 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t vgid_get_size(size_t offset)
+size_t vgid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t vgid_get_size(size_t offset)
 }
 
 static
-void vgid_record(struct lttng_kernel_ctx_field *field,
+void vgid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void vgid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vgid_get_value(struct lttng_kernel_ctx_field *field,
+void vgid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_vgid();
+       value->u.s64 = lttng_current_vgid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
                false, false, false),
        vgid_get_size,
-       NULL,
        vgid_record,
        vgid_get_value,
        NULL, NULL);
index 4732f2804164d1542ef9ed574cf520a3c05f576d..dfc56751539eaf30fdd71d49a3e56442290edf3d 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t vpid_get_size(size_t offset)
+size_t vpid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t vpid_get_size(size_t offset)
 }
 
 static
-void vpid_record(struct lttng_kernel_ctx_field *field,
+void vpid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -45,9 +45,9 @@ void vpid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vpid_get_value(struct lttng_kernel_ctx_field *field,
+void vpid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        pid_t vpid;
 
@@ -58,7 +58,7 @@ void vpid_get_value(struct lttng_kernel_ctx_field *field,
                vpid = 0;
        else
                vpid = task_tgid_vnr(current);
-       value->s64 = vpid;
+       value->u.s64 = vpid;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -66,7 +66,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
                false, false, false),
        vpid_get_size,
-       NULL,
        vpid_record,
        vpid_get_value,
        NULL, NULL);
index 714cf664cba3fcddcd16588ef94e87b2b5881672..5f72a0648d71f579fac1a7cfaa3108cfa5f9d879 100644 (file)
@@ -18,7 +18,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t vppid_get_size(size_t offset)
+size_t vppid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -28,7 +28,7 @@ size_t vppid_get_size(size_t offset)
 }
 
 static
-void vppid_record(struct lttng_kernel_ctx_field *field,
+void vppid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                  struct lib_ring_buffer_ctx *ctx,
                  struct lttng_channel *chan)
 {
@@ -60,9 +60,9 @@ void vppid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vppid_get_value(struct lttng_kernel_ctx_field *field,
+void vppid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        struct task_struct *parent;
        pid_t vppid;
@@ -87,7 +87,7 @@ void vppid_get_value(struct lttng_kernel_ctx_field *field,
        else
                vppid = task_tgid_vnr(parent);
        rcu_read_unlock();
-       value->s64 = vppid;
+       value->u.s64 = vppid;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -95,7 +95,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
                false, false, false),
        vppid_get_size,
-       NULL,
        vppid_record,
        vppid_get_value,
        NULL, NULL);
index 0ca4f08853c5705623e338a2d50182c8e16f48da..d95b2a1daa8d72defc36a84b5ebe40ae5261fe88 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t vsgid_get_size(size_t offset)
+size_t vsgid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t vsgid_get_size(size_t offset)
 }
 
 static
-void vsgid_record(struct lttng_kernel_ctx_field *field,
+void vsgid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void vsgid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vsgid_get_value(struct lttng_kernel_ctx_field *field,
+void vsgid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_vsgid();
+       value->u.s64 = lttng_current_vsgid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
                false, false, false),
        vsgid_get_size,
-       NULL,
        vsgid_record,
        vsgid_get_value,
        NULL, NULL);
index 82a8a4727c80db9f68d0d96966b5a483c53d6f8d..38b0a71e5171695f56903c56078e67f12ad0dcd2 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t vsuid_get_size(size_t offset)
+size_t vsuid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t vsuid_get_size(size_t offset)
 }
 
 static
-void vsuid_record(struct lttng_kernel_ctx_field *field,
+void vsuid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void vsuid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vsuid_get_value(struct lttng_kernel_ctx_field *field,
+void vsuid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_vsuid();
+       value->u.s64 = lttng_current_vsuid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
                false, false, false),
        vsuid_get_size,
-       NULL,
        vsuid_record,
        vsuid_get_value,
        NULL, NULL);
index 76750adc8b84e4520b54cae67a7c7b0951386080..ba597efc8834638304300adcd1984c66006435eb 100644 (file)
@@ -17,7 +17,7 @@
 #include <lttng/tracer.h>
 
 static
-size_t vtid_get_size(size_t offset)
+size_t vtid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -27,7 +27,7 @@ size_t vtid_get_size(size_t offset)
 }
 
 static
-void vtid_record(struct lttng_kernel_ctx_field *field,
+void vtid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -45,9 +45,9 @@ void vtid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vtid_get_value(struct lttng_kernel_ctx_field *field,
+void vtid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        pid_t vtid;
 
@@ -58,7 +58,7 @@ void vtid_get_value(struct lttng_kernel_ctx_field *field,
                vtid = 0;
        else
                vtid = task_pid_vnr(current);
-       value->s64 = vtid;
+       value->u.s64 = vtid;
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -66,7 +66,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
                false, false, false),
        vtid_get_size,
-       NULL,
        vtid_record,
        vtid_get_value,
        NULL, NULL);
index ef9a492865fbf4e57cb3d5dffca094d83b8a667b..e3c946c910f1058f21c2858e7405167cbc20e2c7 100644 (file)
@@ -19,7 +19,7 @@
 #include <wrapper/user_namespace.h>
 
 static
-size_t vuid_get_size(size_t offset)
+size_t vuid_get_size(void *priv, struct lttng_probe_ctx *probe_ctx, size_t offset)
 {
        size_t size = 0;
 
@@ -29,7 +29,7 @@ size_t vuid_get_size(size_t offset)
 }
 
 static
-void vuid_record(struct lttng_kernel_ctx_field *field,
+void vuid_record(void *priv, struct lttng_probe_ctx *probe_ctx,
                 struct lib_ring_buffer_ctx *ctx,
                 struct lttng_channel *chan)
 {
@@ -41,11 +41,11 @@ void vuid_record(struct lttng_kernel_ctx_field *field,
 }
 
 static
-void vuid_get_value(struct lttng_kernel_ctx_field *field,
+void vuid_get_value(void *priv,
                struct lttng_probe_ctx *lttng_probe_ctx,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
-       value->s64 = lttng_current_vuid();
+       value->u.s64 = lttng_current_vuid();
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
@@ -53,7 +53,6 @@ static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_
                lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
                false, false, false),
        vuid_get_size,
-       NULL,
        vuid_record,
        vuid_get_value,
        NULL, NULL);
index 0176dd9472e3ef40e35f5ea0436581e437671d9f..6f39ee060a5482ed87bf5dd8da5ae78ba55feba2 100644 (file)
@@ -201,7 +201,7 @@ void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx)
                return;
        for (i = 0; i < ctx->nr_fields; i++) {
                if (ctx->fields[i].destroy)
-                       ctx->fields[i].destroy(&ctx->fields[i]);
+                       ctx->fields[i].destroy(ctx->fields[i].priv);
        }
        lttng_kvfree(ctx->fields);
        kfree(ctx);
index 9ac2cfe9d348d057e7b30199cb1072766c69bd8d..cec656af5a7c20898c8b8db61226902dcf5edc0a 100644 (file)
@@ -99,11 +99,8 @@ void ctx_get_struct_size(struct lttng_kernel_ctx *ctx, size_t *ctx_len,
                return;
        }
        for (i = 0; i < ctx->nr_fields; i++) {
-               if (ctx->fields[i].get_size)
-                       offset += ctx->fields[i].get_size(offset);
-               if (ctx->fields[i].get_size_arg)
-                       offset += ctx->fields[i].get_size_arg(offset,
-                                       &ctx->fields[i], bufctx, chan);
+               offset += ctx->fields[i].get_size(ctx->fields[i].priv,
+                               bufctx->probe_ctx, offset);
        }
        *ctx_len = offset;
 }
@@ -119,7 +116,8 @@ void ctx_record(struct lib_ring_buffer_ctx *bufctx,
                return;
        lib_ring_buffer_align_ctx(bufctx, ctx->largest_align);
        for (i = 0; i < ctx->nr_fields; i++)
-               ctx->fields[i].record(&ctx->fields[i], bufctx, chan);
+               ctx->fields[i].record(ctx->fields[i].priv, bufctx->probe_ctx,
+                               bufctx, chan);
 }
 
 /*
This page took 0.06759 seconds and 4 git commands to generate.