1.1 --- a/libe2access/include/e2access/image.h Thu Mar 03 23:40:20 2022 +0100
1.2 +++ b/libe2access/include/e2access/image.h Thu Mar 03 23:59:16 2022 +0100
1.3 @@ -60,6 +60,9 @@
1.4 errcode_t image_find_file(ext2_filsys fs, const char *dirname,
1.5 const char *basename, ext2_ino_t *ino);
1.6
1.7 +errcode_t image_find_file_by_inode(ext2_filsys fs, ext2_ino_t ino_parent,
1.8 + const char *basename, ext2_ino_t *ino);
1.9 +
1.10 errcode_t image_inode(ext2_filsys fs, const char *path,
1.11 struct ext2_inode *inode);
1.12
2.1 --- a/libe2access/lib/src/image.c Thu Mar 03 23:40:20 2022 +0100
2.2 +++ b/libe2access/lib/src/image.c Thu Mar 03 23:59:16 2022 +0100
2.3 @@ -318,6 +318,24 @@
2.4 return image_find_by_path(fs, path, ino);
2.5 }
2.6
2.7 +/* Find an object in the given directory with the given inode. */
2.8 +
2.9 +errcode_t image_find_file_by_inode(ext2_filsys fs, ext2_ino_t ino_parent,
2.10 + const char *basename, ext2_ino_t *ino)
2.11 +{
2.12 + char *buf;
2.13 + errcode_t retval = ext2fs_get_mem(fs->blocksize, &buf);
2.14 +
2.15 + if (retval)
2.16 + return retval;
2.17 +
2.18 + retval = ext2fs_lookup(fs, ino_parent, basename, strlen(basename), buf, ino);
2.19 +
2.20 + ext2fs_free_mem(&buf);
2.21 +
2.22 + return retval;
2.23 +}
2.24 +
2.25 /* Obtain the inode for the object with the given path. */
2.26
2.27 errcode_t image_inode(ext2_filsys fs, const char *path,