aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-12 08:22:28 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-12 08:22:28 +0100
commit90d0b5eead05174cea371788cc4766bc7739e982 (patch)
tree50615ee3109df01af43ec37a7c381c374676f544 /lib/sqfs
parentc92faad51817c10570de3680e95a3fd18bb21204 (diff)
Add a start anchor parameter to sqfs_dir_reader_find_by_path
It optionally allows code that does tree traversal to start at an inode that it obtained previously and makes it easier to keep state externally. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/dir_reader.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/sqfs/dir_reader.c b/lib/sqfs/dir_reader.c
index bda7d7a..8eae5bd 100644
--- a/lib/sqfs/dir_reader.c
+++ b/lib/sqfs/dir_reader.c
@@ -210,15 +210,21 @@ int sqfs_dir_reader_get_root_inode(sqfs_dir_reader_t *rd,
block_start, offset, inode);
}
-int sqfs_dir_reader_find_by_path(sqfs_dir_reader_t *rd, const char *path,
- sqfs_inode_generic_t **out)
+int sqfs_dir_reader_find_by_path(sqfs_dir_reader_t *rd,
+ const sqfs_inode_generic_t *start,
+ const char *path, sqfs_inode_generic_t **out)
{
sqfs_inode_generic_t *inode;
sqfs_dir_entry_t *ent;
const char *ptr;
int ret;
- ret = sqfs_dir_reader_get_root_inode(rd, &inode);
+ if (start == NULL) {
+ ret = sqfs_dir_reader_get_root_inode(rd, &inode);
+ } else {
+ ret = sqfs_inode_copy(start, &inode);
+ }
+
if (ret)
return ret;