From: Mathieu Desnoyers Date: Wed, 28 Apr 2021 20:26:20 +0000 (-0400) Subject: Refactoring: context callbacks X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2dc781e02eb156a76554ada092a181ab2916db57;p=lttng-modules.git Refactoring: context callbacks 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 Change-Id: I7c4146481d35cb9ddef19f2cb5d61e56ebe142be --- diff --git a/include/lttng/events.h b/include/lttng/events.h index 8c200bdd..464adb2c 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -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; }; diff --git a/src/lttng-bytecode-interpreter.c b/src/lttng-bytecode-interpreter.c index 0161d673..8ffe2f41 100644 --- a/src/lttng-bytecode-interpreter.c +++ b/src/lttng-bytecode-interpreter.c @@ -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 = <tng_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 = <tng_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 = <tng_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); diff --git a/src/lttng-context-callstack-legacy-impl.h b/src/lttng-context-callstack-legacy-impl.h index edd13cf5..34a977a0 100644 --- a/src/lttng-context-callstack-legacy-impl.h +++ b/src/lttng-context-callstack-legacy-impl.h @@ -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)); diff --git a/src/lttng-context-callstack-stackwalk-impl.h b/src/lttng-context-callstack-stackwalk-impl.h index a7c5a062..2e437359 100644 --- a/src/lttng-context-callstack-stackwalk-impl.h +++ b/src/lttng-context-callstack-stackwalk-impl.h @@ -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)); diff --git a/src/lttng-context-callstack.c b/src/lttng-context-callstack.c index e6ac2596..7e44fafa 100644 --- a/src/lttng-context-callstack.c +++ b/src/lttng-context-callstack.c @@ -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; diff --git a/src/lttng-context-cgroup-ns.c b/src/lttng-context-cgroup-ns.c index f34e9cf6..0bc345c5 100644 --- a/src/lttng-context-cgroup-ns.c +++ b/src/lttng-context-cgroup-ns.c @@ -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); diff --git a/src/lttng-context-cpu-id.c b/src/lttng-context-cpu-id.c index 7ae79a64..9e1d71a2 100644 --- a/src/lttng-context-cpu-id.c +++ b/src/lttng-context-cpu-id.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-egid.c b/src/lttng-context-egid.c index 027991cc..958ada67 100644 --- a/src/lttng-context-egid.c +++ b/src/lttng-context-egid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-euid.c b/src/lttng-context-euid.c index 3888da1d..4bd106ae 100644 --- a/src/lttng-context-euid.c +++ b/src/lttng-context-euid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-gid.c b/src/lttng-context-gid.c index 4a45bcdf..721e1a38 100644 --- a/src/lttng-context-gid.c +++ b/src/lttng-context-gid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-hostname.c b/src/lttng-context-hostname.c index d00c5356..df46293b 100644 --- a/src/lttng-context-hostname.c +++ b/src/lttng-context-hostname.c @@ -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); diff --git a/src/lttng-context-interruptible.c b/src/lttng-context-interruptible.c index 1c78d59b..4d0596a3 100644 --- a/src/lttng-context-interruptible.c +++ b/src/lttng-context-interruptible.c @@ -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); diff --git a/src/lttng-context-ipc-ns.c b/src/lttng-context-ipc-ns.c index 113ffb75..278a4ae0 100644 --- a/src/lttng-context-ipc-ns.c +++ b/src/lttng-context-ipc-ns.c @@ -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); diff --git a/src/lttng-context-migratable.c b/src/lttng-context-migratable.c index 1695f512..19190bb9 100644 --- a/src/lttng-context-migratable.c +++ b/src/lttng-context-migratable.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-mnt-ns.c b/src/lttng-context-mnt-ns.c index 232c5def..79b702ca 100644 --- a/src/lttng-context-mnt-ns.c +++ b/src/lttng-context-mnt-ns.c @@ -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); diff --git a/src/lttng-context-need-reschedule.c b/src/lttng-context-need-reschedule.c index 6f3d61d6..6984d1a4 100644 --- a/src/lttng-context-need-reschedule.c +++ b/src/lttng-context-need-reschedule.c @@ -18,7 +18,7 @@ #include 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); diff --git a/src/lttng-context-net-ns.c b/src/lttng-context-net-ns.c index 1c8adf49..a1a8d6dd 100644 --- a/src/lttng-context-net-ns.c +++ b/src/lttng-context-net-ns.c @@ -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); diff --git a/src/lttng-context-nice.c b/src/lttng-context-nice.c index 22b86965..ef61570c 100644 --- a/src/lttng-context-nice.c +++ b/src/lttng-context-nice.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-perf-counters.c b/src/lttng-context-perf-counters.c index 53578475..44c47640 100644 --- a/src/lttng-context-perf-counters.c +++ b/src/lttng-context-perf-counters.c @@ -20,7 +20,7 @@ #include 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)) diff --git a/src/lttng-context-pid-ns.c b/src/lttng-context-pid-ns.c index 1c3cc2bc..41c15cb5 100644 --- a/src/lttng-context-pid-ns.c +++ b/src/lttng-context-pid-ns.c @@ -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); diff --git a/src/lttng-context-pid.c b/src/lttng-context-pid.c index 6f613725..e3e962d6 100644 --- a/src/lttng-context-pid.c +++ b/src/lttng-context-pid.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-ppid.c b/src/lttng-context-ppid.c index 63d02b89..1494f5c7 100644 --- a/src/lttng-context-ppid.c +++ b/src/lttng-context-ppid.c @@ -18,7 +18,7 @@ #include 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); diff --git a/src/lttng-context-prio.c b/src/lttng-context-prio.c index b6f6c461..3eb3ff90 100644 --- a/src/lttng-context-prio.c +++ b/src/lttng-context-prio.c @@ -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); diff --git a/src/lttng-context-procname.c b/src/lttng-context-procname.c index 3254c2e9..94ba94e7 100644 --- a/src/lttng-context-procname.c +++ b/src/lttng-context-procname.c @@ -18,7 +18,7 @@ #include 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); diff --git a/src/lttng-context-sgid.c b/src/lttng-context-sgid.c index 28a44877..23d5e5bc 100644 --- a/src/lttng-context-sgid.c +++ b/src/lttng-context-sgid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-suid.c b/src/lttng-context-suid.c index 9a03468d..5a9e7beb 100644 --- a/src/lttng-context-suid.c +++ b/src/lttng-context-suid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-tid.c b/src/lttng-context-tid.c index 89228a1f..5a9dee54 100644 --- a/src/lttng-context-tid.c +++ b/src/lttng-context-tid.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-time-ns.c b/src/lttng-context-time-ns.c index 831bbd45..355feb16 100644 --- a/src/lttng-context-time-ns.c +++ b/src/lttng-context-time-ns.c @@ -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); diff --git a/src/lttng-context-uid.c b/src/lttng-context-uid.c index 841d2ea7..86d999af 100644 --- a/src/lttng-context-uid.c +++ b/src/lttng-context-uid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-user-ns.c b/src/lttng-context-user-ns.c index bbd689df..f774d971 100644 --- a/src/lttng-context-user-ns.c +++ b/src/lttng-context-user-ns.c @@ -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); diff --git a/src/lttng-context-uts-ns.c b/src/lttng-context-uts-ns.c index 04ddc80f..204cafb6 100644 --- a/src/lttng-context-uts-ns.c +++ b/src/lttng-context-uts-ns.c @@ -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); diff --git a/src/lttng-context-vegid.c b/src/lttng-context-vegid.c index 0c775890..87c53baf 100644 --- a/src/lttng-context-vegid.c +++ b/src/lttng-context-vegid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-veuid.c b/src/lttng-context-veuid.c index 07968729..5b4930db 100644 --- a/src/lttng-context-veuid.c +++ b/src/lttng-context-veuid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-vgid.c b/src/lttng-context-vgid.c index 00dd91d6..768ed519 100644 --- a/src/lttng-context-vgid.c +++ b/src/lttng-context-vgid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-vpid.c b/src/lttng-context-vpid.c index 4732f280..dfc56751 100644 --- a/src/lttng-context-vpid.c +++ b/src/lttng-context-vpid.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-vppid.c b/src/lttng-context-vppid.c index 714cf664..5f72a064 100644 --- a/src/lttng-context-vppid.c +++ b/src/lttng-context-vppid.c @@ -18,7 +18,7 @@ #include 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); diff --git a/src/lttng-context-vsgid.c b/src/lttng-context-vsgid.c index 0ca4f088..d95b2a1d 100644 --- a/src/lttng-context-vsgid.c +++ b/src/lttng-context-vsgid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-vsuid.c b/src/lttng-context-vsuid.c index 82a8a472..38b0a71e 100644 --- a/src/lttng-context-vsuid.c +++ b/src/lttng-context-vsuid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context-vtid.c b/src/lttng-context-vtid.c index 76750adc..ba597efc 100644 --- a/src/lttng-context-vtid.c +++ b/src/lttng-context-vtid.c @@ -17,7 +17,7 @@ #include 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); diff --git a/src/lttng-context-vuid.c b/src/lttng-context-vuid.c index ef9a4928..e3c946c9 100644 --- a/src/lttng-context-vuid.c +++ b/src/lttng-context-vuid.c @@ -19,7 +19,7 @@ #include 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); diff --git a/src/lttng-context.c b/src/lttng-context.c index 0176dd94..6f39ee06 100644 --- a/src/lttng-context.c +++ b/src/lttng-context.c @@ -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); diff --git a/src/lttng-ring-buffer-client.h b/src/lttng-ring-buffer-client.h index 9ac2cfe9..cec656af 100644 --- a/src/lttng-ring-buffer-client.h +++ b/src/lttng-ring-buffer-client.h @@ -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); } /*