projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support ctf index version 1.1
[babeltrace.git]
/
formats
/
ctf
/
ctf.c
diff --git
a/formats/ctf/ctf.c
b/formats/ctf/ctf.c
index 3194cfdf394f71c4ed2ecb7fc6c2d411e1992625..a2ef43e242a28df7584e6d0180a56f7d6ce633aa 100644
(file)
--- a/
formats/ctf/ctf.c
+++ b/
formats/ctf/ctf.c
@@
-53,6
+53,7
@@
#include "metadata/ctf-ast.h"
#include "events-private.h"
#include <babeltrace/compat/memstream.h>
#include "metadata/ctf-ast.h"
#include "events-private.h"
#include <babeltrace/compat/memstream.h>
+#include <babeltrace/compat/fcntl.h>
#define LOG2_CHAR_BIT 3
#define LOG2_CHAR_BIT 3
@@
-860,7
+861,6
@@
void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
struct ctf_file_stream *file_stream =
container_of(pos, struct ctf_file_stream, pos);
int ret;
struct ctf_file_stream *file_stream =
container_of(pos, struct ctf_file_stream, pos);
int ret;
- off_t off;
struct packet_index *packet_index, *prev_index;
switch (whence) {
struct packet_index *packet_index, *prev_index;
switch (whence) {
@@
-904,9
+904,11
@@
void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
}
pos->content_size = -1U; /* Unknown at this point */
pos->packet_size = WRITE_PACKET_LEN;
}
pos->content_size = -1U; /* Unknown at this point */
pos->packet_size = WRITE_PACKET_LEN;
- off = posix_fallocate(pos->fd, pos->mmap_offset,
- pos->packet_size / CHAR_BIT);
- assert(off == 0);
+ do {
+ ret = bt_posix_fallocate(pos->fd, pos->mmap_offset,
+ pos->packet_size / CHAR_BIT);
+ } while (ret == EINTR);
+ assert(ret == 0);
pos->offset = 0;
} else {
read_next_packet:
pos->offset = 0;
} else {
read_next_packet:
@@
-1547,6
+1549,8
@@
begin:
packet_index.ts_cycles.timestamp_end = 0;
packet_index.events_discarded = 0;
packet_index.events_discarded_len = 0;
packet_index.ts_cycles.timestamp_end = 0;
packet_index.events_discarded = 0;
packet_index.events_discarded_len = 0;
+ packet_index.stream_instance_id = 0;
+ packet_index.packet_seq_num = 0;
/* read and check header, set stream id (and check) */
if (file_stream->parent.trace_packet_header) {
/* read and check header, set stream id (and check) */
if (file_stream->parent.trace_packet_header) {
@@
-1833,7
+1837,7
@@
int import_stream_packet_index(struct ctf_trace *td,
struct ctf_packet_index *ctf_index = NULL;
struct ctf_packet_index_file_hdr index_hdr;
struct packet_index index;
struct ctf_packet_index *ctf_index = NULL;
struct ctf_packet_index_file_hdr index_hdr;
struct packet_index index;
- uint32_t packet_index_len;
+ uint32_t packet_index_len
, index_minor
;
int ret = 0;
int first_packet = 1;
size_t len;
int ret = 0;
int first_packet = 1;
size_t len;
@@
-1861,6
+1865,8
@@
int import_stream_packet_index(struct ctf_trace *td,
ret = -1;
goto error;
}
ret = -1;
goto error;
}
+ index_minor = be32toh(index_hdr.index_minor);
+
packet_index_len = be32toh(index_hdr.packet_index_len);
if (packet_index_len == 0) {
fprintf(stderr, "[error] Packet index length cannot be 0.\n");
packet_index_len = be32toh(index_hdr.packet_index_len);
if (packet_index_len == 0) {
fprintf(stderr, "[error] Packet index length cannot be 0.\n");
@@
-1887,6
+1893,10
@@
int import_stream_packet_index(struct ctf_trace *td,
index.events_discarded_len = 64;
index.data_offset = -1;
stream_id = be64toh(ctf_index->stream_id);
index.events_discarded_len = 64;
index.data_offset = -1;
stream_id = be64toh(ctf_index->stream_id);
+ if (index_minor >= 1) {
+ index.stream_instance_id = be64toh(ctf_index->stream_instance_id);
+ index.packet_seq_num = be64toh(ctf_index->packet_seq_num);
+ }
if (!first_packet) {
/* add index to packet array */
if (!first_packet) {
/* add index to packet array */
@@
-2007,7
+2017,7
@@
int ctf_open_file_stream_read(struct ctf_trace *td, const char *path, int flags,
snprintf(index_name, strlen(path) + sizeof(INDEX_PATH),
INDEX_PATH, path);
snprintf(index_name, strlen(path) + sizeof(INDEX_PATH),
INDEX_PATH, path);
- if (
faccessat(td->dirfd, index_name, O_RDONLY, flags
) < 0) {
+ if (
bt_faccessat(td->dirfd, td->parent.path, index_name, O_RDONLY, 0
) < 0) {
ret = create_stream_packet_index(td, file_stream);
if (ret) {
fprintf(stderr, "[error] Stream index creation error.\n");
ret = create_stream_packet_index(td, file_stream);
if (ret) {
fprintf(stderr, "[error] Stream index creation error.\n");
This page took
0.024267 seconds
and
4
git commands to generate.