bt_field_class_*_create(): accept mandatory trace class
[babeltrace.git] / plugins / text / dmesg / dmesg.c
index 8a80df3bba7b833ec3aeb3bb97e02d8132da1b14..1ec86744b1ea9ac6b30d8b12cf11d9f6dcdb903a 100644 (file)
@@ -68,6 +68,7 @@ struct dmesg_component {
                bt_bool no_timestamp;
        } params;
 
+       bt_self_component_source *self_comp;
        bt_trace_class *trace_class;
        bt_stream_class *stream_class;
        bt_event_class *event_class;
@@ -78,19 +79,19 @@ struct dmesg_component {
 };
 
 static
-bt_field_class *create_event_payload_fc(void)
+bt_field_class *create_event_payload_fc(bt_trace_class *trace_class)
 {
        bt_field_class *root_fc = NULL;
        bt_field_class *fc = NULL;
        int ret;
 
-       root_fc = bt_field_class_structure_create();
+       root_fc = bt_field_class_structure_create(trace_class);
        if (!root_fc) {
                BT_LOGE_STR("Cannot create an empty structure field class object.");
                goto error;
        }
 
-       fc = bt_field_class_string_create();
+       fc = bt_field_class_string_create(trace_class);
        if (!fc) {
                BT_LOGE_STR("Cannot create a string field class object.");
                goto error;
@@ -120,7 +121,9 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts)
        bt_field_class *fc = NULL;
        int ret = 0;
 
-       dmesg_comp->trace_class = bt_trace_class_create();
+       dmesg_comp->trace_class = bt_trace_class_create(
+               bt_self_component_source_as_self_component(
+                       dmesg_comp->self_comp));
        if (!dmesg_comp->trace_class) {
                BT_LOGE_STR("Cannot create an empty trace class object.");
                goto error;
@@ -134,7 +137,8 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts)
        }
 
        if (has_ts) {
-               dmesg_comp->clock_class = bt_clock_class_create();
+               dmesg_comp->clock_class = bt_clock_class_create(
+                       dmesg_comp->trace_class);
                if (!dmesg_comp->clock_class) {
                        BT_LOGE_STR("Cannot create clock class.");
                        goto error;
@@ -161,7 +165,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts)
                goto error;
        }
 
-       fc = create_event_payload_fc();
+       fc = create_event_payload_fc(dmesg_comp->trace_class);
        if (!fc) {
                BT_LOGE_STR("Cannot create event payload field class.");
                goto error;
@@ -358,7 +362,7 @@ void destroy_dmesg_component(struct dmesg_component *dmesg_comp)
 }
 
 static
-enum bt_self_component_status create_port(
+bt_self_component_status create_port(
                bt_self_component_source *self_comp)
 {
        return bt_self_component_source_add_output_port(self_comp,
@@ -366,19 +370,20 @@ enum bt_self_component_status create_port(
 }
 
 BT_HIDDEN
-enum bt_self_component_status dmesg_init(
+bt_self_component_status dmesg_init(
                bt_self_component_source *self_comp,
                bt_value *params, void *init_method_data)
 {
        int ret = 0;
        struct dmesg_component *dmesg_comp = g_new0(struct dmesg_component, 1);
-       enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+       bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
 
        if (!dmesg_comp) {
                BT_LOGE_STR("Failed to allocate one dmesg component structure.");
                goto error;
        }
 
+       dmesg_comp->self_comp = self_comp;
        dmesg_comp->params.path = g_string_new(NULL);
        if (!dmesg_comp->params.path) {
                BT_LOGE_STR("Failed to allocate a GString.");
@@ -629,7 +634,7 @@ void destroy_dmesg_msg_iter(struct dmesg_msg_iter *dmesg_msg_iter)
 }
 
 BT_HIDDEN
-enum bt_self_message_iterator_status dmesg_msg_iter_init(
+bt_self_message_iterator_status dmesg_msg_iter_init(
                bt_self_message_iterator *self_msg_iter,
                bt_self_component_source *self_comp,
                bt_self_component_port_output *self_port)
@@ -637,7 +642,7 @@ enum bt_self_message_iterator_status dmesg_msg_iter_init(
        struct dmesg_component *dmesg_comp;
        struct dmesg_msg_iter *dmesg_msg_iter =
                g_new0(struct dmesg_msg_iter, 1);
-       enum bt_self_message_iterator_status status =
+       bt_self_message_iterator_status status =
                BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
 
        if (!dmesg_msg_iter) {
@@ -686,13 +691,13 @@ void dmesg_msg_iter_finalize(
 }
 
 static
-enum bt_self_message_iterator_status dmesg_msg_iter_next_one(
+bt_self_message_iterator_status dmesg_msg_iter_next_one(
                struct dmesg_msg_iter *dmesg_msg_iter,
                bt_message **msg)
 {
        ssize_t len;
        struct dmesg_component *dmesg_comp;
-       enum bt_self_message_iterator_status status =
+       bt_self_message_iterator_status status =
                BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
 
        BT_ASSERT(dmesg_msg_iter);
@@ -808,7 +813,7 @@ end:
 }
 
 BT_HIDDEN
-enum bt_self_message_iterator_status dmesg_msg_iter_next(
+bt_self_message_iterator_status dmesg_msg_iter_next(
                bt_self_message_iterator *self_msg_iter,
                bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
@@ -816,7 +821,7 @@ enum bt_self_message_iterator_status dmesg_msg_iter_next(
        struct dmesg_msg_iter *dmesg_msg_iter =
                bt_self_message_iterator_get_data(
                        self_msg_iter);
-       enum bt_self_message_iterator_status status =
+       bt_self_message_iterator_status status =
                BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
        uint64_t i = 0;
 
This page took 0.025697 seconds and 4 git commands to generate.