X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fmessage%2Fmessage.h;h=efd211296f5098357c1c5e97319bf9dfc89ae3f2;hb=5d9ef4cb64e5bd7793d443cbfcc0248bb8804580;hp=75515ef8f41ffc224033fde627bd59ffc44eb0a7;hpb=bdb288b3e94e412a33c8647d44f6cfac66ca0665;p=babeltrace.git diff --git a/src/lib/graph/message/message.h b/src/lib/graph/message/message.h index 75515ef8..efd21129 100644 --- a/src/lib/graph/message/message.h +++ b/src/lib/graph/message/message.h @@ -1,29 +1,13 @@ -#ifndef BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H -#define BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H - /* + * SPDX-License-Identifier: MIT + * * Copyright 2017-2018 Philippe Proulx * Copyright 2015 Jérémie Galarneau - * - * 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. */ +#ifndef BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H +#define BABELTRACE_GRAPH_MESSAGE_MESSAGE_INTERNAL_H + /* Protection: this file uses BT_LIB_LOG*() macros directly */ #ifndef BT_LIB_LOG_SUPPORTED # error Please include "lib/logging.h" before including this file. @@ -33,7 +17,7 @@ #include "lib/object.h" #include "common/assert.h" #include -#include +#include #include #include "lib/object-pool.h" #include @@ -73,6 +57,15 @@ struct bt_message { _BT_ASSERT_PRE_MSG_IS_TYPE_FMT, \ bt_message_type_string(_type), (_msg)) +#define BT_ASSERT_PRE_BEGIN_LE_END(_msg_iter, _begin, _end) \ + BT_ASSERT_PRE( \ + _begin <= _end, \ + "Beginning default clock snapshot value is greater " \ + "than end default clock snapshot value: " \ + "cs-begin-val=%" PRIu64 ", cs-end-val=%" PRIu64 ", " \ + "%![msg-iter-]i", \ + _begin, _end, _msg_iter); + BT_HIDDEN void bt_message_init(struct bt_message *message, enum bt_message_type type, @@ -82,7 +75,7 @@ void bt_message_init(struct bt_message *message, static inline void bt_message_reset(struct bt_message *message) { - BT_ASSERT(message); + BT_ASSERT_DBG(message); #ifdef BT_DEV_MODE message->frozen = BT_FALSE; @@ -134,19 +127,19 @@ const char *bt_message_type_string(enum bt_message_type type) { switch (type) { case BT_MESSAGE_TYPE_EVENT: - return "BT_MESSAGE_TYPE_EVENT"; + return "EVENT"; case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: - return "BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY"; + return "MESSAGE_ITERATOR_INACTIVITY"; case BT_MESSAGE_TYPE_STREAM_BEGINNING: - return "BT_MESSAGE_TYPE_STREAM_BEGINNING"; + return "STREAM_BEGINNING"; case BT_MESSAGE_TYPE_STREAM_END: - return "BT_MESSAGE_TYPE_STREAM_END"; + return "STREAM_END"; case BT_MESSAGE_TYPE_PACKET_BEGINNING: - return "BT_MESSAGE_TYPE_PACKET_BEGINNING"; + return "PACKET_BEGINNING"; case BT_MESSAGE_TYPE_PACKET_END: - return "BT_MESSAGE_TYPE_PACKET_END"; + return "PACKET_END"; case BT_MESSAGE_TYPE_DISCARDED_EVENTS: - return "BT_MESSAGE_TYPE_DISCARDED_EVENTS"; + return "DISCARDED_EVENTS"; default: return "(unknown)"; }