- if (!stream->metadata_flag) {
- ret = get_index_values(&index, infd);
- if (ret < 0) {
- err = kernctl_put_subbuf(infd);
- if (err != 0) {
- if (err == -EFAULT) {
- PERROR("Error in unreserving sub buffer\n");
- } else if (err == -EIO) {
- /* Should never happen with newer LTTng versions */
- PERROR("Reader has been pushed by the writer, last sub-buffer corrupted.");
- }
- ret = err;
- goto error;
- }
- goto error;
- }
- ret = update_stream_stats(stream);
- if (ret < 0) {
- err = kernctl_put_subbuf(infd);
- if (err != 0) {
- if (err == -EFAULT) {
- PERROR("Error in unreserving sub buffer\n");
- } else if (err == -EIO) {
- /* Should never happen with newer LTTng versions */
- PERROR("Reader has been pushed by the writer, last sub-buffer corrupted.");
- }
- ret = err;
- goto error;
- }
- goto error;
- }
- } else {
- write_index = 0;
- ret = metadata_stream_check_version(infd, stream);
- if (ret < 0) {
- err = kernctl_put_subbuf(infd);
- if (err != 0) {
- if (err == -EFAULT) {
- PERROR("Error in unreserving sub buffer\n");
- } else if (err == -EIO) {
- /* Should never happen with newer LTTng versions */
- PERROR("Reader has been pushed by the writer, last sub-buffer corrupted.");
- }
- ret = err;
- goto error;
- }
- goto error;
- }
- }
+static
+enum get_next_subbuffer_status get_next_subbuffer_metadata_check(struct lttng_consumer_stream *stream,
+ struct stream_subbuffer *subbuffer)
+{
+ int ret;
+ const char *addr;
+ bool coherent;
+ enum get_next_subbuffer_status status;