X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf%2Ftypes.h;fp=include%2Fbabeltrace%2Fctf%2Ftypes.h;h=c1916a4d75b76b7557031e2ca1a96b6febaa1115;hp=6a76c6bbf945c3c2e351a191cdf5b015e368f3ad;hb=fef3bf22431390dae389d378b7709366b158b83d;hpb=9b3c1d6f8e01603488e317ffef7a8e3c15c98459 diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h index 6a76c6bb..c1916a4d 100644 --- a/include/babeltrace/ctf/types.h +++ b/include/babeltrace/ctf/types.h @@ -29,21 +29,22 @@ #include #include #include +#include #include -#define LAST_OFFSET_POISON ((ssize_t) -1L) +#define LAST_OFFSET_POISON ((int64_t) ~0ULL) struct bt_stream_callbacks; 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, in bits */ + int64_t data_offset; /* offset of data within the packet, in bits */ uint64_t packet_size; /* packet size, in bits */ uint64_t content_size; /* content size, in bits */ uint64_t timestamp_begin; uint64_t timestamp_end; uint64_t events_discarded; - size_t events_discarded_len; /* length of the field, in bits */ + uint64_t events_discarded_len; /* length of the field, in bits */ }; /* @@ -60,13 +61,13 @@ struct ctf_stream_pos { /* Current position */ off_t mmap_offset; /* mmap offset in the file, in bytes */ off_t mmap_base_offset; /* offset of start of packet in mmap, in bytes */ - size_t packet_size; /* current packet size, in bits */ - size_t content_size; /* current content size, in bits */ - uint32_t *content_size_loc; /* pointer to current content size */ + uint64_t packet_size; /* current packet size, in bits */ + uint64_t content_size; /* current content size, in bits */ + uint64_t *content_size_loc; /* pointer to current content size */ struct mmap_align *base_mma;/* mmap base address */ - ssize_t offset; /* offset from base, in bits. EOF for end of file. */ - ssize_t last_offset; /* offset before the last read_event */ - size_t cur_index; /* current index in packet index */ + int64_t offset; /* offset from base, in bits. EOF for end of file. */ + int64_t last_offset; /* offset before the last read_event */ + uint64_t cur_index; /* current index in packet index */ uint64_t last_events_discarded; /* last known amount of event discarded */ void (*packet_seek)(struct stream_pos *pos, size_t index, int whence); /* function called to switch packet */ @@ -107,9 +108,9 @@ void ctf_fini_pos(struct ctf_stream_pos *pos); * TODO: allow larger files by updating base too. */ static inline -void ctf_move_pos(struct ctf_stream_pos *pos, size_t bit_offset) +void ctf_move_pos(struct ctf_stream_pos *pos, uint64_t bit_offset) { - printf_debug("ctf_move_pos test EOF: %zd\n", pos->offset); + printf_debug("ctf_move_pos test EOF: %" PRId64 "\n", pos->offset); if (unlikely(pos->offset == EOF)) return; @@ -122,16 +123,16 @@ void ctf_move_pos(struct ctf_stream_pos *pos, size_t bit_offset) */ if ((pos->prot == PROT_WRITE) && (unlikely(pos->offset + bit_offset >= pos->packet_size))) { - printf_debug("ctf_packet_seek (before call): %zd\n", + printf_debug("ctf_packet_seek (before call): %" PRId64 "\n", pos->offset); ctf_packet_seek(&pos->parent, 0, SEEK_CUR); - printf_debug("ctf_packet_seek (after call): %zd\n", + printf_debug("ctf_packet_seek (after call): %" PRId64 "\n", pos->offset); return; } } pos->offset += bit_offset; - printf_debug("ctf_move_pos after increment: %zd\n", pos->offset); + printf_debug("ctf_move_pos after increment: %" PRId64 "\n", pos->offset); } /* @@ -140,7 +141,7 @@ void ctf_move_pos(struct ctf_stream_pos *pos, size_t bit_offset) * TODO: allow larger files by updating base too. */ static inline -void ctf_align_pos(struct ctf_stream_pos *pos, size_t bit_offset) +void ctf_align_pos(struct ctf_stream_pos *pos, uint64_t bit_offset) { ctf_move_pos(pos, offset_align(pos->offset, bit_offset)); } @@ -181,7 +182,7 @@ void ctf_pos_pad_packet(struct ctf_stream_pos *pos) } static inline -int ctf_pos_access_ok(struct ctf_stream_pos *pos, size_t bit_len) +int ctf_pos_access_ok(struct ctf_stream_pos *pos, uint64_t bit_len) { if (unlikely(pos->offset == EOF)) return 0; @@ -199,10 +200,10 @@ void ctf_pos_get_event(struct ctf_stream_pos *pos) { assert(pos->offset <= pos->content_size); if (pos->offset == pos->content_size) { - printf_debug("ctf_packet_seek (before call): %zd\n", + printf_debug("ctf_packet_seek (before call): %" PRId64 "\n", pos->offset); pos->packet_seek(&pos->parent, 0, SEEK_CUR); - printf_debug("ctf_packet_seek (after call): %zd\n", + printf_debug("ctf_packet_seek (after call): %" PRId64 "\n", pos->offset); } }