X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf%2Ftypes.h;h=8018b5b363d8261665653fbe88ece38d37208c82;hp=2396c4ff5b6f2261f5e8b7205be98944ad348c74;hb=847bf71a4af4770390a59e8ef8e1fdfca33687b9;hpb=463b02a3703120da9580609acff5b80987306766 diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h index 2396c4ff..8018b5b3 100644 --- a/include/babeltrace/ctf/types.h +++ b/include/babeltrace/ctf/types.h @@ -29,8 +29,10 @@ #include #include + struct packet_index { off_t offset; /* offset of the packet in the file, in bytes */ + off_t data_offset; /* offset of data within the packet */ size_t packet_size; /* packet size, in bits */ size_t content_size; /* content size, in bits */ }; @@ -51,7 +53,7 @@ struct ctf_stream_pos { size_t content_size; /* current content size, in bits */ uint32_t *content_size_loc; /* pointer to current content size */ char *base; /* mmap base address */ - size_t offset; /* offset from base, in bits */ + ssize_t offset; /* offset from base, in bits. -EOF for end of file. */ size_t cur_index; /* current index in packet index */ int dummy; /* dummy position, for length calculation */ @@ -76,7 +78,7 @@ void ctf_variant_rw(struct stream_pos *pos, struct definition *definition); void ctf_array_rw(struct stream_pos *pos, struct definition *definition); void ctf_sequence_rw(struct stream_pos *pos, struct definition *definition); -void ctf_move_pos_slow(struct ctf_stream_pos *pos, size_t offset); +void ctf_move_pos_slow(struct ctf_stream_pos *pos, size_t offset, int whence); void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags); void ctf_fini_pos(struct ctf_stream_pos *pos); @@ -94,7 +96,7 @@ void ctf_move_pos(struct ctf_stream_pos *pos, size_t bit_offset) && (pos->offset + bit_offset >= pos->content_size)) || ((pos->prot == PROT_WRITE) && (pos->offset + bit_offset >= pos->packet_size))) { - ctf_move_pos_slow(pos, bit_offset); + ctf_move_pos_slow(pos, bit_offset, SEEK_CUR); return; } }