projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port: implement posix_fallocate wrapper
[babeltrace.git]
/
formats
/
ctf
/
writer
/
event-fields.c
diff --git
a/formats/ctf/writer/event-fields.c
b/formats/ctf/writer/event-fields.c
index 30fe5783db6e86a696b9ef96321ef9f233a7767b..9eff2dca98b19e3cb8eaa995af7cf6be968038f9 100644
(file)
--- a/
formats/ctf/writer/event-fields.c
+++ b/
formats/ctf/writer/event-fields.c
@@
-30,6
+30,7
@@
#include <babeltrace/ctf-writer/event-fields-internal.h>
#include <babeltrace/ctf-writer/event-types-internal.h>
#include <babeltrace/compiler.h>
#include <babeltrace/ctf-writer/event-fields-internal.h>
#include <babeltrace/ctf-writer/event-types-internal.h>
#include <babeltrace/compiler.h>
+#include <babeltrace/compat/fcntl.h>
#define PACKET_LEN_INCREMENT (getpagesize() * 8 * CHAR_BIT)
#define PACKET_LEN_INCREMENT (getpagesize() * 8 * CHAR_BIT)
@@
-179,8
+180,8
@@
struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type)
}
type_id = bt_ctf_field_type_get_type_id(type);
}
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id <= CTF_TYPE_UNKNOWN ||
-
type_id >= NR_CTF_TYPES
) {
+ if (type_id <= CTF_TYPE_UNKNOWN ||
type_id >= NR_CTF_TYPES ||
+
bt_ctf_field_type_validate(type)
) {
goto error;
}
goto error;
}
@@
-445,7
+446,7
@@
struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field,
tag_enum_integer = container_of(tag_enum, struct bt_ctf_field_integer,
parent);
tag_enum_integer = container_of(tag_enum, struct bt_ctf_field_integer,
parent);
- if (
!bt_ctf_field_validate(variant->tag)
) {
+ if (
bt_ctf_field_validate(tag_field) < 0
) {
goto end;
}
goto end;
}
@@
-941,7
+942,7
@@
void bt_ctf_field_string_destroy(struct bt_ctf_field *field)
static
int bt_ctf_field_generic_validate(struct bt_ctf_field *field)
{
static
int bt_ctf_field_generic_validate(struct bt_ctf_field *field)
{
- return
!(field && field->payload_set)
;
+ return
(field && field->payload_set) ? 0 : -1
;
}
static
}
static
@@
-1125,10
+1126,16
@@
int bt_ctf_field_structure_serialize(struct bt_ctf_field *field,
while (!ctf_pos_access_ok(pos,
offset_align(pos->offset,
field->type->declaration->alignment))) {
while (!ctf_pos_access_ok(pos,
offset_align(pos->offset,
field->type->declaration->alignment))) {
- increase_packet_size(pos);
+ ret = increase_packet_size(pos);
+ if (ret) {
+ goto end;
+ }
}
}
- ctf_align_pos(pos, field->type->declaration->alignment);
+ if (!ctf_align_pos(pos, field->type->declaration->alignment)) {
+ ret = -1;
+ goto end;
+ }
for (i = 0; i < structure->fields->len; i++) {
struct bt_ctf_field *field = g_ptr_array_index(
for (i = 0; i < structure->fields->len; i++) {
struct bt_ctf_field *field = g_ptr_array_index(
@@
-1139,7
+1146,7
@@
int bt_ctf_field_structure_serialize(struct bt_ctf_field *field,
break;
}
}
break;
}
}
-
+end:
return ret;
}
return ret;
}
@@
-1235,7
+1242,7
@@
int increase_packet_size(struct ctf_stream_pos *pos)
}
pos->packet_size += PACKET_LEN_INCREMENT;
}
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;
pos->packet_size / CHAR_BIT);
if (ret) {
goto end;
This page took
0.026133 seconds
and
4
git commands to generate.