Port: implement posix_fallocate wrapper
[babeltrace.git] / formats / ctf / ir / event-fields.c
index 4538d8e03317b26dd8008234384299727989841a..aa7475d0952722512636af701237ba68a361a81c 100644 (file)
@@ -32,6 +32,7 @@
 #include <babeltrace/object-internal.h>
 #include <babeltrace/ref.h>
 #include <babeltrace/compiler.h>
+#include <babeltrace/compat/fcntl.h>
 
 #define PACKET_LEN_INCREMENT   (getpagesize() * 8 * CHAR_BIT)
 
@@ -295,6 +296,46 @@ end:
        return ret;
 }
 
+int bt_ctf_field_is_integer(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_INTEGER;
+}
+
+int bt_ctf_field_is_floating_point(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_FLOAT;
+}
+
+int bt_ctf_field_is_enumeration(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_ENUM;
+}
+
+int bt_ctf_field_is_string(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRING;
+}
+
+int bt_ctf_field_is_structure(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRUCT;
+}
+
+int bt_ctf_field_is_array(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_ARRAY;
+}
+
+int bt_ctf_field_is_sequence(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_SEQUENCE;
+}
+
+int bt_ctf_field_is_variant(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_VARIANT;
+}
+
 struct bt_ctf_field *bt_ctf_field_sequence_get_length(
                struct bt_ctf_field *field)
 {
@@ -1217,7 +1258,7 @@ struct bt_ctf_field *bt_ctf_field_structure_create(
                struct bt_ctf_field_structure, 1);
        struct bt_ctf_field *field = NULL;
 
-       if (!structure || !structure_type->fields->len) {
+       if (!structure) {
                goto end;
        }
 
@@ -2130,7 +2171,7 @@ int increase_packet_size(struct ctf_stream_pos *pos)
        }
 
        pos->packet_size += PACKET_LEN_INCREMENT;
-       ret = posix_fallocate(pos->fd, pos->mmap_offset,
+       ret = bt_posix_fallocate(pos->fd, pos->mmap_offset,
                pos->packet_size / CHAR_BIT);
        if (ret) {
                goto end;
This page took 0.025397 seconds and 4 git commands to generate.