v4:
- refactor entry_is_dot
My apologies for the duplicated submission but I did not read the next e-mail.
The tsk_fs_dir_walk API will list all the entries including '.' and '..'
in a similar manner as for 'ls -a'.
This means our callback will be called for the following entries:
. <-- the Root entry
etc/.
etc/.. <-- again the Root entry
etc/systemd/.
etc/systemd/..
bin/.
bin/.. <-- again the Root entry
We want to return the Root entry only once.
Therefore, once we know that the entry under analysis is a dot
if (TSK_FS_ISDOT (fsfile->name->name))
We check whether the inode is root
if (fsfile->fs_info->root_inum == fsfile->name->meta_addr)
But we want to make sure is the first root entry and not the parent directory
of other directories.
if (STREQ(fsfile->name->name, ".")
I opened up a bit the logic to make it more clear.
Matteo Cafasso (6):
filesystem_walk: fixed root inode listing
daemon: refactor tsk code
lib: rename tsk internal function
New API: internal_find_inode
New API: find_inode
find_inode: added API tests
daemon/tsk.c | 161 ++++++++++++++++++++++++++++++-------------
generator/actions.ml | 21 ++++++
src/MAX_PROC_NR | 2 +-
src/tsk.c | 32 ++++++++-
tests/tsk/Makefile.am | 3 +-
tests/tsk/test-find-inode.sh | 66 ++++++++++++++++++
6 files changed, 233 insertions(+), 52 deletions(-)
create mode 100755 tests/tsk/test-find-inode.sh
--
2.9.3