projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: make packets and packet messages optional, disabled by default
[babeltrace.git]
/
src
/
lib
/
trace-ir
/
packet.c
diff --git
a/src/lib/trace-ir/packet.c
b/src/lib/trace-ir/packet.c
index ade0a3f2f4fc18bd5a919e5ef9c0b8a1fcd37da5..8f8625b6123b7f7b9ea8b2f46b62dd4200f80126 100644
(file)
--- a/
src/lib/trace-ir/packet.c
+++ b/
src/lib/trace-ir/packet.c
@@
-20,8
+20,8
@@
* SOFTWARE.
*/
* SOFTWARE.
*/
-#define BT_LOG_TAG "PACKET"
-#include "lib/l
ib-l
ogging.h"
+#define BT_LOG_TAG "
LIB/
PACKET"
+#include "lib/logging.h"
#include "lib/assert-pre.h"
#include <babeltrace2/trace-ir/packet-const.h>
#include "lib/assert-pre.h"
#include <babeltrace2/trace-ir/packet-const.h>
@@
-39,6
+39,7
@@
#include "stream-class.h"
#include "stream.h"
#include "trace.h"
#include "stream-class.h"
#include "stream.h"
#include "trace.h"
+#include "lib/func-status.h"
#define BT_ASSERT_PRE_PACKET_HOT(_packet) \
BT_ASSERT_PRE_HOT((_packet), "Packet", ": %!+a", (_packet))
#define BT_ASSERT_PRE_PACKET_HOT(_packet) \
BT_ASSERT_PRE_HOT((_packet), "Packet", ": %!+a", (_packet))
@@
-181,7
+182,8
@@
struct bt_packet *bt_packet_new(struct bt_stream *stream)
BT_LIB_LOGD("Creating packet object: %![stream-]+s", stream);
packet = g_new0(struct bt_packet, 1);
if (!packet) {
BT_LIB_LOGD("Creating packet object: %![stream-]+s", stream);
packet = g_new0(struct bt_packet, 1);
if (!packet) {
- BT_LOGE_STR("Failed to allocate one packet object.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one packet object.");
goto error;
}
goto error;
}
@@
-198,7
+200,8
@@
struct bt_packet *bt_packet_new(struct bt_stream *stream)
&stream->class->packet_context_field_pool,
stream->class->packet_context_fc);
if (!packet->context_field) {
&stream->class->packet_context_field_pool,
stream->class->packet_context_fc);
if (!packet->context_field) {
- BT_LOGE_STR("Cannot create packet context field wrapper.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Cannot create packet context field wrapper.");
goto error;
}
}
goto error;
}
}
@@
-219,9
+222,13
@@
struct bt_packet *bt_packet_create(const struct bt_stream *c_stream)
struct bt_stream *stream = (void *) c_stream;
BT_ASSERT_PRE_NON_NULL(stream, "Stream");
struct bt_stream *stream = (void *) c_stream;
BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+ BT_ASSERT_PRE(stream->class->supports_packets,
+ "Stream class does not support packets: %![sc-]+S",
+ stream->class);
packet = bt_object_pool_create_object(&stream->packet_pool);
if (G_UNLIKELY(!packet)) {
packet = bt_object_pool_create_object(&stream->packet_pool);
if (G_UNLIKELY(!packet)) {
- BT_LIB_LOGE("Cannot allocate one packet from stream's packet pool: "
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Cannot allocate one packet from stream's packet pool: "
"%![stream-]+s", stream);
goto end;
}
"%![stream-]+s", stream);
goto end;
}
@@
-236,7
+243,8
@@
end:
return (void *) packet;
}
return (void *) packet;
}
-enum bt_packet_status bt_packet_move_context_field(struct bt_packet *packet,
+enum bt_packet_move_context_field_status bt_packet_move_context_field(
+ struct bt_packet *packet,
struct bt_packet_context_field *context_field)
{
struct bt_stream_class *stream_class;
struct bt_packet_context_field *context_field)
{
struct bt_stream_class *stream_class;
@@
-261,7
+269,7
@@
enum bt_packet_status bt_packet_move_context_field(struct bt_packet *packet,
/* Move new field */
packet->context_field = field_wrapper;
/* Move new field */
packet->context_field = field_wrapper;
- return BT_
PACKET
_STATUS_OK;
+ return BT_
FUNC
_STATUS_OK;
}
void bt_packet_get_ref(const struct bt_packet *packet)
}
void bt_packet_get_ref(const struct bt_packet *packet)
This page took
0.026302 seconds
and
4
git commands to generate.