bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
d1a82a2555792e9763cbaa04f895a04e10faaba4Timo Siraineni_stream_fs_stats_read(struct istream_private *stream)
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen struct fs_stats_istream *sstream = (struct fs_stats_istream *)stream;
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen i_stream_seek(stream->parent, stream->parent_start_offset +
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen ret = i_stream_read_copy_from_parent(&stream->istream);
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen /* count the first returned bytes as the finish time, since
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen we don't want to count the time caller spends on processing
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen this stream. (only the first fs_file_timing_end() call
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen actually does anything - the others are ignored.) */
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen fs_file_timing_end(sstream->file, FS_OP_READ);
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Siraineni_stream_create_fs_stats(struct istream *input, struct fs_file *file)
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen sstream->istream.max_buffer_size = input->real_stream->max_buffer_size;
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen sstream->istream.stream_size_passthrough = TRUE;
d1a82a2555792e9763cbaa04f895a04e10faaba4Timo Sirainen sstream->istream.read = i_stream_fs_stats_read;
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen sstream->istream.istream.blocking = input->blocking;
1c244f6fdbb509cca857982368f5d426e999f2d1Timo Sirainen sstream->istream.istream.seekable = input->seekable;