CTF_TRACE_SET_FIELD(trace, minor);
} else if (!strcmp(left, "uuid")) {
uuid_t uuid;
CTF_TRACE_SET_FIELD(trace, minor);
} else if (!strcmp(left, "uuid")) {
uuid_t uuid;
}
CTF_TRACE_SET_FIELD(trace, uuid);
} else if (!strcmp(left, "byte_order")) {
struct ctf_node *right;
int byte_order;
}
CTF_TRACE_SET_FIELD(trace, uuid);
} else if (!strcmp(left, "byte_order")) {
struct ctf_node *right;
int byte_order;
right = _cds_list_first_entry(&node->u.ctf_expression.right, struct ctf_node, siblings);
byte_order = get_trace_byte_order(fd, depth, right);
if (byte_order < 0)
return -EINVAL;
right = _cds_list_first_entry(&node->u.ctf_expression.right, struct ctf_node, siblings);
byte_order = get_trace_byte_order(fd, depth, right);
if (byte_order < 0)
return -EINVAL;
- trace->byte_order = byte_order;
+
+ if (CTF_TRACE_FIELD_IS_SET(trace, byte_order)
+ && byte_order != trace->byte_order) {
+ fprintf(fd, "[error] %s: endianness mismatch\n", __func__);
+ ret = -EPERM;
+ goto error;
+ } else {
+ trace->byte_order = byte_order;
+ }
CTF_TRACE_SET_FIELD(trace, byte_order);
} else if (!strcmp(left, "packet.header")) {
struct declaration *declaration;
CTF_TRACE_SET_FIELD(trace, byte_order);
} else if (!strcmp(left, "packet.header")) {
struct declaration *declaration;
printf_verbose("CTF visitor: metadata construction... ");
trace->root_declaration_scope = new_declaration_scope(NULL);
printf_verbose("CTF visitor: metadata construction... ");
trace->root_declaration_scope = new_declaration_scope(NULL);
ret = ctf_root_declaration_visit(fd, depth + 1, iter, trace);
if (ret) {
fprintf(fd, "[error] %s: root declaration error\n", __func__);
ret = ctf_root_declaration_visit(fd, depth + 1, iter, trace);
if (ret) {
fprintf(fd, "[error] %s: root declaration error\n", __func__);
}
}
cds_list_for_each_entry(iter, &node->u.root.trace, siblings) {
ret = ctf_trace_visit(fd, depth + 1, iter, trace);
if (ret) {
fprintf(fd, "[error] %s: trace declaration error\n", __func__);
}
}
cds_list_for_each_entry(iter, &node->u.root.trace, siblings) {
ret = ctf_trace_visit(fd, depth + 1, iter, trace);
if (ret) {
fprintf(fd, "[error] %s: trace declaration error\n", __func__);
}
cds_list_for_each_entry(iter, &node->u.root.stream, siblings) {
ret = ctf_stream_visit(fd, depth + 1, iter,
trace->root_declaration_scope, trace);
if (ret) {
fprintf(fd, "[error] %s: stream declaration error\n", __func__);
}
cds_list_for_each_entry(iter, &node->u.root.stream, siblings) {
ret = ctf_stream_visit(fd, depth + 1, iter,
trace->root_declaration_scope, trace);
if (ret) {
fprintf(fd, "[error] %s: stream declaration error\n", __func__);
trace->root_declaration_scope, trace);
if (ret) {
fprintf(fd, "[error] %s: event declaration error\n", __func__);
trace->root_declaration_scope, trace);
if (ret) {
fprintf(fd, "[error] %s: event declaration error\n", __func__);
default:
fprintf(fd, "[error] %s: unknown node type %d\n", __func__,
(int) node->type);
default:
fprintf(fd, "[error] %s: unknown node type %d\n", __func__,
(int) node->type);