[Libguestfs] [PATCH] filesystem_walk: fixed root inode listing

Pino Toscano ptoscano at redhat.com
Thu Aug 25 11:07:03 UTC 2016


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160825/187977f1/attachment.sig>


More information about the Libguestfs mailing list