Matteo Cafasso
2016-Aug-24 20:42 UTC
[Libguestfs] [PATCH] filesystem_walk: fixed root inode listing
With the current implementation, the root inode of the given partition
is ignored.
The root inode is now reported. Its name will be a single dot '.'
reproducing the TSK API.
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
---
daemon/tsk.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/daemon/tsk.c b/daemon/tsk.c
index dd368d7..4a0517b 100644
--- a/daemon/tsk.c
+++ b/daemon/tsk.c
@@ -114,9 +114,12 @@ fswalk_callback (TSK_FS_FILE *fsfile, const char *path,
void *data)
struct guestfs_int_tsk_dirent dirent;
/* Ignore ./ and ../ */
- ret = TSK_FS_ISDOT (fsfile->name->name);
- if (ret != 0)
- return TSK_WALK_CONT;
+ if (TSK_FS_ISDOT (fsfile->name->name)) {
+ /* Root is represented as . */
+ if (fsfile->fs_info->root_inum != fsfile->name->meta_addr ||
+ strcmp (fsfile->name->name, "."))
+ return TSK_WALK_CONT;
+ }
/* Build the full relative path of the entry */
ret = asprintf (&fname, "%s%s", path,
fsfile->name->name);
--
2.9.3
Pino Toscano
2016-Aug-25 11:07 UTC
Re: [Libguestfs] [PATCH] filesystem_walk: fixed root inode listing
On Wednesday, 24 August 2016 23:42:05 CEST Matteo Cafasso wrote:> With the current implementation, the root inode of the given partition > is ignored. > > The root inode is now reported. Its name will be a single dot '.' > reproducing the TSK API. > > Signed-off-by: Matteo Cafasso <noxdafox@gmail.com> > --- > daemon/tsk.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/daemon/tsk.c b/daemon/tsk.c > index dd368d7..4a0517b 100644 > --- a/daemon/tsk.c > +++ b/daemon/tsk.c > @@ -114,9 +114,12 @@ fswalk_callback (TSK_FS_FILE *fsfile, const char *path, void *data) > struct guestfs_int_tsk_dirent dirent; > > /* Ignore ./ and ../ */ > - ret = TSK_FS_ISDOT (fsfile->name->name); > - if (ret != 0) > - return TSK_WALK_CONT; > + if (TSK_FS_ISDOT (fsfile->name->name)) { > + /* Root is represented as . */ > + if (fsfile->fs_info->root_inum != fsfile->name->meta_addr || > + strcmp (fsfile->name->name, ".")) > + return TSK_WALK_CONT; > + }Considering that this snippet is duplicated in the additions of the other patch series ("New API: find_inode"), I'd rather see the common parts factorised already when doing this change. Thanks, -- Pino Toscano
Apparently Analagous Threads
- Re: [PATCH v2 1/6] filesystem_walk: fixed root inode listing
- Re: [PATCH v2 1/6] filesystem_walk: fixed root inode listing
- Re: [PATCH v2 1/6] filesystem_walk: fixed root inode listing
- [PATCH v4 0/6] New API: find_inode
- [PATCH v2 1/6] filesystem_walk: fixed root inode listing