Refactoring: context callbacks
[lttng-modules.git] / include / lttng / events.h
index 2f48f6ef252a99b3f9b3e81b805d24a9da8938f3..464adb2c2ff9a8ecd187137be8b453ed31ef925d 100644 (file)
@@ -109,7 +109,7 @@ struct lttng_kernel_type_array {
 
 struct lttng_kernel_type_sequence {
        struct lttng_kernel_type_common parent;
-       const char *length_name;        /* Length field name. */
+       const char *length_name;        /* Length field name. If NULL, use previous field. */
        const struct lttng_kernel_type_common *elem_type;
        unsigned int alignment;         /* Alignment before elements. */
        enum lttng_kernel_string_encoding encoding;
@@ -124,7 +124,7 @@ struct lttng_kernel_type_struct {
 
 struct lttng_kernel_type_variant {
        struct lttng_kernel_type_common parent;
-       const char *tag_name;
+       const char *tag_name;           /* Tag field name. If NULL, use previous field. */
        const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */
        unsigned int nr_choices;
        unsigned int alignment;
@@ -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;
 };
 
@@ -562,8 +560,7 @@ struct lttng_channel_ops {
        struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
        int (*buffer_has_read_closed_stream)(struct channel *chan);
        void (*buffer_read_close)(struct lib_ring_buffer *buf);
-       int (*event_reserve)(struct lib_ring_buffer_ctx *ctx,
-                            uint32_t event_id);
+       int (*event_reserve)(struct lib_ring_buffer_ctx *ctx);
        void (*event_commit)(struct lib_ring_buffer_ctx *ctx);
        void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src,
                            size_t len);
This page took 0.023936 seconds and 4 git commands to generate.