aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-14 13:13:38 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-14 13:13:38 +0200
commit20a4e5acd78dcb5f681ab5320adb0289cebfc277 (patch)
tree6f394a029f4e985d7323ec9ef8a09a3a6610c280 /include
parent7d01bbb78c11cb54c96cf9708916a116190364cb (diff)
libio: Add a function to open an istream_t from a directory iterator
For the native versions, this is currently dummied out, always returning an error number. The idea is to laster wrap the libtar interface around a directory iterator, here we need that method to support the existing use case in tar2sqfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/io/dir_iterator.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h
index 60c3796..b7212b3 100644
--- a/include/io/dir_iterator.h
+++ b/include/io/dir_iterator.h
@@ -8,6 +8,7 @@
#define IO_DIR_ITERATOR_H
#include "sqfs/predef.h"
+#include "io/istream.h"
/**
* @struct dir_entry_t
@@ -136,6 +137,19 @@ typedef struct dir_iterator_t {
* @param it A pointer to the iterator itself.
*/
void (*ignore_subdir)(struct dir_iterator_t *it);
+
+ /**
+ * @brief If the last entry was a regular file, open it.
+ *
+ * If next() returned a file, this can be used to create an istream
+ * to read from it.
+ *
+ * @param it A pointer to the iterator itself.
+ * @param out Returns a pointer to a @ref istream_t on success.
+ *
+ * @return Zero on success, negative @ref SQFS_ERROR value on failure.
+ */
+ int (*open_file_ro)(struct dir_iterator_t *it, istream_t **out);
} dir_iterator_t;
enum {