summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-05 23:55:04 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 10:41:49 +0200
commit1fff8f3a1326bd82f8140a61d969994e635834fe (patch)
tree817c148152a38acd0b1110d1e3d55788047d078c /include
parentae4193162e1607b75ef34e4e9a33e2b54f03af8a (diff)
Add pread(2) like function to data_reader
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/data_reader.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/data_reader.h b/include/data_reader.h
index c6d85f1..51bfff3 100644
--- a/include/data_reader.h
+++ b/include/data_reader.h
@@ -41,4 +41,14 @@ void data_reader_destroy(data_reader_t *data);
int data_reader_dump_file(data_reader_t *data, file_info_t *fi, int outfd,
bool allow_sparse);
+/*
+ Read a chunk of data from a file. Starting from 'offset' into the
+ uncompressed file, read 'size' bytes into 'buffer'.
+
+ Returns the number of bytes read, 0 if EOF, -1 on failure. Prints an
+ error message to stderr on failure.
+ */
+ssize_t data_reader_read(data_reader_t *data, file_info_t *fi,
+ uint64_t offset, void *buffer, size_t size);
+
#endif /* DATA_READER_H */