From 20a4e5acd78dcb5f681ab5320adb0289cebfc277 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 14 May 2023 13:13:38 +0200 Subject: 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 --- lib/io/src/unix/dir_iterator.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/io/src/unix') diff --git a/lib/io/src/unix/dir_iterator.c b/lib/io/src/unix/dir_iterator.c index d2727ad..8d30b3f 100644 --- a/lib/io/src/unix/dir_iterator.c +++ b/lib/io/src/unix/dir_iterator.c @@ -126,6 +126,13 @@ static void dir_ignore_subdir(dir_iterator_t *it) (void)it; } +static int dir_open_file_ro(dir_iterator_t *it, istream_t **out) +{ + (void)it; + *out = NULL; + return SQFS_ERROR_UNSUPPORTED; +} + static int dir_open_subdir(dir_iterator_t *base, dir_iterator_t **out) { const unix_dir_iterator_t *it = (const unix_dir_iterator_t *)base; @@ -166,6 +173,7 @@ static int dir_open_subdir(dir_iterator_t *base, dir_iterator_t **out) ((dir_iterator_t *)sub)->read_link = dir_read_link; ((dir_iterator_t *)sub)->open_subdir = dir_open_subdir; ((dir_iterator_t *)sub)->ignore_subdir = dir_ignore_subdir; + ((dir_iterator_t *)sub)->open_file_ro = dir_open_file_ro; *out = (dir_iterator_t *)sub; return 0; @@ -206,6 +214,7 @@ dir_iterator_t *dir_iterator_create(const char *path) ((dir_iterator_t *)it)->read_link = dir_read_link; ((dir_iterator_t *)it)->open_subdir = dir_open_subdir; ((dir_iterator_t *)it)->ignore_subdir = dir_ignore_subdir; + ((dir_iterator_t *)it)->open_file_ro = dir_open_file_ro; return (dir_iterator_t *)it; } -- cgit v1.2.3