Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / ctf / common / bfcr / bfcr.c
index 0ea283c51a55a86d638764c11d62c315c5c9b283..9eb76dcb1b67e62020047f6e9b3f7e64fdf29a88 100644 (file)
@@ -1,32 +1,16 @@
 /*
- * Babeltrace - CTF binary field class reader (BFCR)
+ * SPDX-License-Identifier: MIT
  *
  * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
  * Copyright (c) 2015-2016 Philippe Proulx <pproulx@efficios.com>
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Babeltrace - CTF binary field class reader (BFCR)
  */
 
 #define BT_COMP_LOG_SELF_COMP (bfcr->self_comp)
 #define BT_LOG_OUTPUT_LEVEL (bfcr->log_level)
 #define BT_LOG_TAG "PLUGIN/CTF/BFCR"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
 
 #include <stdlib.h>
 #include <stdint.h>
@@ -116,8 +100,8 @@ struct bt_bfcr {
         * classes for which the common boundary is not the boundary of
         * a byte cannot have different byte orders.
         *
-        * This is set to -1 on reset and when the last basic field class
-        * was a string class.
+        * This is set to CTF_BYTE_ORDER_UNKNOWN on reset and when the last
+        * basic field class was a string class.
         */
        enum ctf_byte_order last_bo;
 
@@ -172,17 +156,17 @@ const char *bfcr_state_string(enum bfcr_state state)
 {
        switch (state) {
        case BFCR_STATE_NEXT_FIELD:
-               return "BFCR_STATE_NEXT_FIELD";
+               return "NEXT_FIELD";
        case BFCR_STATE_ALIGN_BASIC:
-               return "BFCR_STATE_ALIGN_BASIC";
+               return "ALIGN_BASIC";
        case BFCR_STATE_ALIGN_COMPOUND:
-               return "BFCR_STATE_ALIGN_COMPOUND";
+               return "ALIGN_COMPOUND";
        case BFCR_STATE_READ_BASIC_BEGIN:
-               return "BFCR_STATE_READ_BASIC_BEGIN";
+               return "READ_BASIC_BEGIN";
        case BFCR_STATE_READ_BASIC_CONTINUE:
-               return "BFCR_STATE_READ_BASIC_CONTINUE";
+               return "READ_BASIC_CONTINUE";
        case BFCR_STATE_DONE:
-               return "BFCR_STATE_DONE";
+               return "DONE";
        default:
                return "(unknown)";
        }
@@ -240,10 +224,10 @@ int stack_push(struct stack *stack, struct ctf_field_class *base_class,
        struct stack_entry *entry;
        struct bt_bfcr *bfcr;
 
-       BT_ASSERT(stack);
-       BT_ASSERT(base_class);
+       BT_ASSERT_DBG(stack);
+       BT_ASSERT_DBG(base_class);
        bfcr = stack->bfcr;
-       BT_COMP_LOGV("Pushing field class on stack: stack-addr=%p, "
+       BT_COMP_LOGT("Pushing field class on stack: stack-addr=%p, "
                "fc-addr=%p, fc-type=%d, base-length=%zu, "
                "stack-size-before=%zu, stack-size-after=%zu",
                stack, base_class, base_class->type,
@@ -293,7 +277,7 @@ int64_t get_compound_field_class_length(struct bt_bfcr *bfcr,
                        bfcr->user.data);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        return length;
@@ -322,7 +306,7 @@ end:
 static inline
 unsigned int stack_size(struct stack *stack)
 {
-       BT_ASSERT(stack);
+       BT_ASSERT_DBG(stack);
        return stack->size;
 }
 
@@ -331,10 +315,10 @@ void stack_pop(struct stack *stack)
 {
        struct bt_bfcr *bfcr;
 
-       BT_ASSERT(stack);
-       BT_ASSERT(stack_size(stack));
+       BT_ASSERT_DBG(stack);
+       BT_ASSERT_DBG(stack_size(stack));
        bfcr = stack->bfcr;
-       BT_COMP_LOGV("Popping from stack: "
+       BT_COMP_LOGT("Popping from stack: "
                "stack-addr=%p, stack-size-before=%u, stack-size-after=%u",
                stack, stack->entries->len, stack->entries->len - 1);
        stack->size--;
@@ -349,15 +333,15 @@ bool stack_empty(struct stack *stack)
 static
 void stack_clear(struct stack *stack)
 {
-       BT_ASSERT(stack);
+       BT_ASSERT_DBG(stack);
        stack->size = 0;
 }
 
 static inline
 struct stack_entry *stack_top(struct stack *stack)
 {
-       BT_ASSERT(stack);
-       BT_ASSERT(stack_size(stack));
+       BT_ASSERT_DBG(stack);
+       BT_ASSERT_DBG(stack_size(stack));
        return &g_array_index(stack->entries, struct stack_entry,
                stack->size - 1);
 }
@@ -371,7 +355,7 @@ size_t available_bits(struct bt_bfcr *bfcr)
 static inline
 void consume_bits(struct bt_bfcr *bfcr, size_t incr)
 {
-       BT_COMP_LOGV("Advancing cursor: bfcr-addr=%p, cur-before=%zu, cur-after=%zu",
+       BT_COMP_LOGT("Advancing cursor: bfcr-addr=%p, cur-before=%zu, cur-after=%zu",
                bfcr, bfcr->buf.at, bfcr->buf.at + incr);
        bfcr->buf.at += incr;
 }
@@ -476,10 +460,10 @@ void read_unsigned_bitfield(struct bt_bfcr *bfcr, const uint8_t *buf, size_t at,
                bt_bitfield_read_le(buf, uint8_t, at, field_size, v);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
-       BT_COMP_LOGV("Read unsigned bit array: cur=%zu, size=%u, "
+       BT_COMP_LOGT("Read unsigned bit array: cur=%zu, size=%u, "
                "bo=%d, val=%" PRIu64, at, field_size, bo, *v);
 }
 
@@ -495,10 +479,10 @@ void read_signed_bitfield(struct bt_bfcr *bfcr, const uint8_t *buf, size_t at,
                bt_bitfield_read_le(buf, uint8_t, at, field_size, v);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
-       BT_COMP_LOGV("Read signed bit array: cur=%zu, size=%u, "
+       BT_COMP_LOGT("Read signed bit array: cur=%zu, size=%u, "
                "bo=%d, val=%" PRId64, at, field_size, bo, *v);
 }
 
@@ -517,12 +501,12 @@ enum bt_bfcr_status validate_contiguous_bo(struct bt_bfcr *bfcr,
        }
 
        /* Always valid if last byte order is unknown */
-       if (bfcr->last_bo == -1) {
+       if (bfcr->last_bo == CTF_BYTE_ORDER_UNKNOWN) {
                goto end;
        }
 
        /* Always valid if next byte order is unknown */
-       if (next_bo == -1) {
+       if (next_bo == CTF_BYTE_ORDER_UNKNOWN) {
                goto end;
        }
 
@@ -562,7 +546,7 @@ enum bt_bfcr_status read_basic_float_and_call_cb(struct bt_bfcr *bfcr,
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
        struct ctf_field_class_float *fc = (void *) bfcr->cur_basic_field_class;
 
-       BT_ASSERT(fc);
+       BT_ASSERT_DBG(fc);
        field_size = fc->base.size;
        bo = fc->base.byte_order;
        bfcr->cur_bo = bo;
@@ -594,17 +578,17 @@ enum bt_bfcr_status read_basic_float_and_call_cb(struct bt_bfcr *bfcr,
        }
        default:
                /* Only 32-bit and 64-bit fields are supported currently */
-               abort();
+               bt_common_abort();
        }
 
-       BT_COMP_LOGV("Read floating point number value: bfcr=%p, cur=%zu, val=%f",
+       BT_COMP_LOGT("Read floating point number value: bfcr=%p, cur=%zu, val=%f",
                bfcr, at, dblval);
 
        if (bfcr->user.cbs.classes.floating_point) {
-               BT_COMP_LOGV("Calling user function (floating point number).");
+               BT_COMP_LOGT("Calling user function (floating point number).");
                status = bfcr->user.cbs.classes.floating_point(dblval,
                        bfcr->cur_basic_field_class, bfcr->user.data);
-               BT_COMP_LOGV("User function returned: status=%s",
+               BT_COMP_LOGT("User function returned: status=%s",
                        bt_bfcr_status_string(status));
                if (status != BT_BFCR_STATUS_OK) {
                        BT_COMP_LOGW("User function failed: bfcr-addr=%p, status=%s",
@@ -640,10 +624,10 @@ enum bt_bfcr_status read_basic_int_and_call_cb(struct bt_bfcr *bfcr,
                read_signed_bitfield(bfcr, buf, at, field_size, bo, &v);
 
                if (bfcr->user.cbs.classes.signed_int) {
-                       BT_COMP_LOGV("Calling user function (signed integer).");
+                       BT_COMP_LOGT("Calling user function (signed integer).");
                        status = bfcr->user.cbs.classes.signed_int(v,
                                bfcr->cur_basic_field_class, bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: "
@@ -657,10 +641,10 @@ enum bt_bfcr_status read_basic_int_and_call_cb(struct bt_bfcr *bfcr,
                read_unsigned_bitfield(bfcr, buf, at, field_size, bo, &v);
 
                if (bfcr->user.cbs.classes.unsigned_int) {
-                       BT_COMP_LOGV("Calling user function (unsigned integer).");
+                       BT_COMP_LOGT("Calling user function (unsigned integer).");
                        status = bfcr->user.cbs.classes.unsigned_int(v,
                                bfcr->cur_basic_field_class, bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: "
@@ -684,14 +668,14 @@ enum bt_bfcr_status read_bit_array_class_and_call_continue(struct bt_bfcr *bfcr,
                (void *) bfcr->cur_basic_field_class;
 
        if (!at_least_one_bit_left(bfcr)) {
-               BT_COMP_LOGV("Reached end of data: bfcr-addr=%p", bfcr);
+               BT_COMP_LOGT("Reached end of data: bfcr-addr=%p", bfcr);
                status = BT_BFCR_STATUS_EOF;
                goto end;
        }
 
        available = available_bits(bfcr);
        needed_bits = fc->size - bfcr->stitch.at;
-       BT_COMP_LOGV("Continuing basic field decoding: "
+       BT_COMP_LOGT("Continuing basic field decoding: "
                "bfcr-addr=%p, field-size=%u, needed-size=%zu, "
                "available-size=%zu",
                bfcr, fc->size, needed_bits, available);
@@ -721,7 +705,7 @@ enum bt_bfcr_status read_bit_array_class_and_call_continue(struct bt_bfcr *bfcr,
        }
 
        /* We are here; it means we don't have enough data to decode this */
-       BT_COMP_LOGV_STR("Not enough data to read the next basic field: appending to stitch buffer.");
+       BT_COMP_LOGT_STR("Not enough data to read the next basic field: appending to stitch buffer.");
        stitch_append_from_remaining_buf(bfcr);
        status = BT_BFCR_STATUS_EOF;
 
@@ -739,7 +723,7 @@ enum bt_bfcr_status read_bit_array_class_and_call_begin(struct bt_bfcr *bfcr,
                (void *) bfcr->cur_basic_field_class;
 
        if (!at_least_one_bit_left(bfcr)) {
-               BT_COMP_LOGV("Reached end of data: bfcr-addr=%p", bfcr);
+               BT_COMP_LOGT("Reached end of data: bfcr-addr=%p", bfcr);
                status = BT_BFCR_STATUS_EOF;
                goto end;
        }
@@ -754,7 +738,7 @@ enum bt_bfcr_status read_bit_array_class_and_call_begin(struct bt_bfcr *bfcr,
 
        if (fc->size <= available) {
                /* We have all the bits; decode and set now */
-               BT_ASSERT(bfcr->buf.addr);
+               BT_ASSERT_DBG(bfcr->buf.addr);
                status = read_basic_and_call_cb(bfcr, bfcr->buf.addr,
                        buf_at_from_addr(bfcr));
                if (status != BT_BFCR_STATUS_OK) {
@@ -781,7 +765,7 @@ enum bt_bfcr_status read_bit_array_class_and_call_begin(struct bt_bfcr *bfcr,
        }
 
        /* We are here; it means we don't have enough data to decode this */
-       BT_COMP_LOGV_STR("Not enough data to read the next basic field: setting stitch buffer.");
+       BT_COMP_LOGT_STR("Not enough data to read the next basic field: setting stitch buffer.");
        stitch_set_from_remaining_buf(bfcr);
        bfcr->state = BFCR_STATE_READ_BASIC_CONTINUE;
        status = BT_BFCR_STATUS_EOF;
@@ -832,23 +816,23 @@ enum bt_bfcr_status read_basic_string_class_and_call(
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
 
        if (!at_least_one_bit_left(bfcr)) {
-               BT_COMP_LOGV("Reached end of data: bfcr-addr=%p", bfcr);
+               BT_COMP_LOGT("Reached end of data: bfcr-addr=%p", bfcr);
                status = BT_BFCR_STATUS_EOF;
                goto end;
        }
 
-       BT_ASSERT(buf_at_from_addr(bfcr) % 8 == 0);
+       BT_ASSERT_DBG(buf_at_from_addr(bfcr) % 8 == 0);
        available_bytes = BITS_TO_BYTES_FLOOR(available_bits(bfcr));
        buf_at_bytes = BITS_TO_BYTES_FLOOR(buf_at_from_addr(bfcr));
-       BT_ASSERT(bfcr->buf.addr);
+       BT_ASSERT_DBG(bfcr->buf.addr);
        first_chr = &bfcr->buf.addr[buf_at_bytes];
        result = memchr(first_chr, '\0', available_bytes);
 
        if (begin && bfcr->user.cbs.classes.string_begin) {
-               BT_COMP_LOGV("Calling user function (string, beginning).");
+               BT_COMP_LOGT("Calling user function (string, beginning).");
                status = bfcr->user.cbs.classes.string_begin(
                        bfcr->cur_basic_field_class, bfcr->user.data);
-               BT_COMP_LOGV("User function returned: status=%s",
+               BT_COMP_LOGT("User function returned: status=%s",
                        bt_bfcr_status_string(status));
                if (status != BT_BFCR_STATUS_OK) {
                        BT_COMP_LOGW("User function failed: bfcr-addr=%p, status=%s",
@@ -860,12 +844,12 @@ enum bt_bfcr_status read_basic_string_class_and_call(
        if (!result) {
                /* No null character yet */
                if (bfcr->user.cbs.classes.string) {
-                       BT_COMP_LOGV("Calling user function (substring).");
+                       BT_COMP_LOGT("Calling user function (substring).");
                        status = bfcr->user.cbs.classes.string(
                                (const char *) first_chr,
                                available_bytes, bfcr->cur_basic_field_class,
                                bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: "
@@ -883,12 +867,12 @@ enum bt_bfcr_status read_basic_string_class_and_call(
                size_t result_len = (size_t) (result - first_chr);
 
                if (bfcr->user.cbs.classes.string && result_len) {
-                       BT_COMP_LOGV("Calling user function (substring).");
+                       BT_COMP_LOGT("Calling user function (substring).");
                        status = bfcr->user.cbs.classes.string(
                                (const char *) first_chr,
                                result_len, bfcr->cur_basic_field_class,
                                bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: "
@@ -899,10 +883,10 @@ enum bt_bfcr_status read_basic_string_class_and_call(
                }
 
                if (bfcr->user.cbs.classes.string_end) {
-                       BT_COMP_LOGV("Calling user function (string, end).");
+                       BT_COMP_LOGT("Calling user function (string, end).");
                        status = bfcr->user.cbs.classes.string_end(
                                bfcr->cur_basic_field_class, bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: "
@@ -934,7 +918,7 @@ enum bt_bfcr_status read_basic_begin_state(struct bt_bfcr *bfcr)
 {
        enum bt_bfcr_status status;
 
-       BT_ASSERT(bfcr->cur_basic_field_class);
+       BT_ASSERT_DBG(bfcr->cur_basic_field_class);
 
        switch (bfcr->cur_basic_field_class->type) {
        case CTF_FIELD_CLASS_TYPE_INT:
@@ -948,7 +932,7 @@ enum bt_bfcr_status read_basic_begin_state(struct bt_bfcr *bfcr)
                status = read_basic_string_class_and_call(bfcr, true);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        return status;
@@ -959,7 +943,7 @@ enum bt_bfcr_status read_basic_continue_state(struct bt_bfcr *bfcr)
 {
        enum bt_bfcr_status status;
 
-       BT_ASSERT(bfcr->cur_basic_field_class);
+       BT_ASSERT_DBG(bfcr->cur_basic_field_class);
 
        switch (bfcr->cur_basic_field_class->type) {
        case CTF_FIELD_CLASS_TYPE_INT:
@@ -973,7 +957,7 @@ enum bt_bfcr_status read_basic_continue_state(struct bt_bfcr *bfcr)
                status = read_basic_string_class_and_call(bfcr, false);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        return status;
@@ -1003,7 +987,7 @@ enum bt_bfcr_status align_class_state(struct bt_bfcr *bfcr,
         * 0 means "undefined" for variants; what we really want is 1
         * (always aligned)
         */
-       BT_ASSERT(field_alignment >= 1);
+       BT_ASSERT_DBG(field_alignment >= 1);
 
        /* Compute how many bits we need to skip */
        skip_bits = bits_to_skip_to_align_to(bfcr, (size_t) field_alignment);
@@ -1031,7 +1015,7 @@ enum bt_bfcr_status align_class_state(struct bt_bfcr *bfcr,
                goto end;
        } else {
                /* No: need more data */
-               BT_COMP_LOGV("Reached end of data when aligning: bfcr-addr=%p", bfcr);
+               BT_COMP_LOGT("Reached end of data when aligning: bfcr-addr=%p", bfcr);
                status = BT_BFCR_STATUS_EOF;
        }
 
@@ -1056,10 +1040,10 @@ enum bt_bfcr_status next_field_state(struct bt_bfcr *bfcr)
        /* Are we done with this base class? */
        while (top->index == top->base_len) {
                if (bfcr->user.cbs.classes.compound_end) {
-                       BT_COMP_LOGV("Calling user function (compound, end).");
+                       BT_COMP_LOGT("Calling user function (compound, end).");
                        status = bfcr->user.cbs.classes.compound_end(
                                top->base_class, bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: bfcr-addr=%p, status=%s",
@@ -1117,10 +1101,10 @@ enum bt_bfcr_status next_field_state(struct bt_bfcr *bfcr)
 
        if (next_field_class->is_compound) {
                if (bfcr->user.cbs.classes.compound_begin) {
-                       BT_COMP_LOGV("Calling user function (compound, begin).");
+                       BT_COMP_LOGT("Calling user function (compound, begin).");
                        status = bfcr->user.cbs.classes.compound_begin(
                                next_field_class, bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(status));
                        if (status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: bfcr-addr=%p, status=%s",
@@ -1140,7 +1124,7 @@ enum bt_bfcr_status next_field_state(struct bt_bfcr *bfcr)
                bfcr->state = BFCR_STATE_ALIGN_COMPOUND;
        } else {
                /* Replace current basic field class */
-               BT_COMP_LOGV("Replacing current basic field class: "
+               BT_COMP_LOGT("Replacing current basic field class: "
                        "bfcr-addr=%p, cur-basic-fc-addr=%p, "
                        "next-basic-fc-addr=%p",
                        bfcr, bfcr->cur_basic_field_class, next_field_class);
@@ -1159,7 +1143,7 @@ enum bt_bfcr_status handle_state(struct bt_bfcr *bfcr)
 {
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
 
-       BT_COMP_LOGV("Handling state: bfcr-addr=%p, state=%s",
+       BT_COMP_LOGT("Handling state: bfcr-addr=%p, state=%s",
                bfcr, bfcr_state_string(bfcr->state));
 
        switch (bfcr->state) {
@@ -1184,7 +1168,7 @@ enum bt_bfcr_status handle_state(struct bt_bfcr *bfcr)
                break;
        }
 
-       BT_COMP_LOGV("Handled state: bfcr-addr=%p, status=%s",
+       BT_COMP_LOGT("Handled state: bfcr-addr=%p, status=%s",
                bfcr, bt_bfcr_status_string(status));
        return status;
 }
@@ -1241,13 +1225,13 @@ void reset(struct bt_bfcr *bfcr)
        stack_clear(bfcr->stack);
        stitch_reset(bfcr);
        bfcr->buf.addr = NULL;
-       bfcr->last_bo = -1;
+       bfcr->last_bo = CTF_BYTE_ORDER_UNKNOWN;
 }
 
 static
 void update_packet_offset(struct bt_bfcr *bfcr)
 {
-       BT_COMP_LOGV("Updating packet offset for next call: "
+       BT_COMP_LOGT("Updating packet offset for next call: "
                "bfcr-addr=%p, cur-packet-offset=%zu, next-packet-offset=%zu",
                bfcr, bfcr->buf.packet_offset,
                bfcr->buf.packet_offset + bfcr->buf.at);
@@ -1260,8 +1244,8 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr,
        size_t offset, size_t packet_offset, size_t sz,
        enum bt_bfcr_status *status)
 {
-       BT_ASSERT(bfcr);
-       BT_ASSERT(BYTES_TO_BITS(sz) >= offset);
+       BT_ASSERT_DBG(bfcr);
+       BT_ASSERT_DBG(BYTES_TO_BITS(sz) >= offset);
        reset(bfcr);
        bfcr->buf.addr = buf;
        bfcr->buf.offset = offset;
@@ -1271,7 +1255,7 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr,
        bfcr->buf.sz = BYTES_TO_BITS(sz) - offset;
        *status = BT_BFCR_STATUS_OK;
 
-       BT_COMP_LOGV("Starting decoding: bfcr-addr=%p, fc-addr=%p, "
+       BT_COMP_LOGT("Starting decoding: bfcr-addr=%p, fc-addr=%p, "
                "buf-addr=%p, buf-size=%zu, offset=%zu, "
                "packet-offset=%zu",
                bfcr, cls, buf, sz, offset, packet_offset);
@@ -1282,10 +1266,10 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr,
                int stack_ret;
 
                if (bfcr->user.cbs.classes.compound_begin) {
-                       BT_COMP_LOGV("Calling user function (compound, begin).");
+                       BT_COMP_LOGT("Calling user function (compound, begin).");
                        *status = bfcr->user.cbs.classes.compound_begin(
                                cls, bfcr->user.data);
-                       BT_COMP_LOGV("User function returned: status=%s",
+                       BT_COMP_LOGT("User function returned: status=%s",
                                bt_bfcr_status_string(*status));
                        if (*status != BT_BFCR_STATUS_OK) {
                                BT_COMP_LOGW("User function failed: bfcr-addr=%p, status=%s",
@@ -1309,7 +1293,7 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr,
        }
 
        /* Run the machine! */
-       BT_COMP_LOGV_STR("Running the state machine.");
+       BT_COMP_LOGT_STR("Running the state machine.");
 
        while (true) {
                *status = handle_state(bfcr);
@@ -1330,9 +1314,9 @@ BT_HIDDEN
 size_t bt_bfcr_continue(struct bt_bfcr *bfcr, const uint8_t *buf, size_t sz,
                enum bt_bfcr_status *status)
 {
-       BT_ASSERT(bfcr);
-       BT_ASSERT(buf);
-       BT_ASSERT(sz > 0);
+       BT_ASSERT_DBG(bfcr);
+       BT_ASSERT_DBG(buf);
+       BT_ASSERT_DBG(sz > 0);
        bfcr->buf.addr = buf;
        bfcr->buf.offset = 0;
        bfcr->buf.at = 0;
@@ -1340,11 +1324,11 @@ size_t bt_bfcr_continue(struct bt_bfcr *bfcr, const uint8_t *buf, size_t sz,
        bfcr->buf.sz = BYTES_TO_BITS(sz);
        *status = BT_BFCR_STATUS_OK;
 
-       BT_COMP_LOGV("Continuing decoding: bfcr-addr=%p, buf-addr=%p, buf-size=%zu",
+       BT_COMP_LOGT("Continuing decoding: bfcr-addr=%p, buf-addr=%p, buf-size=%zu",
                bfcr, buf, sz);
 
        /* Continue running the machine */
-       BT_COMP_LOGV_STR("Running the state machine.");
+       BT_COMP_LOGT_STR("Running the state machine.");
 
        while (true) {
                *status = handle_state(bfcr);
@@ -1363,7 +1347,7 @@ BT_HIDDEN
 void bt_bfcr_set_unsigned_int_cb(struct bt_bfcr *bfcr,
                bt_bfcr_unsigned_int_cb_func cb)
 {
-       BT_ASSERT(bfcr);
-       BT_ASSERT(cb);
+       BT_ASSERT_DBG(bfcr);
+       BT_ASSERT_DBG(cb);
        bfcr->user.cbs.classes.unsigned_int = cb;
 }
This page took 0.033029 seconds and 4 git commands to generate.