[Libguestfs] [PATCH v5 4/6] New API: internal_find_inode
Pino Toscano
ptoscano at redhat.com
Fri Sep 16 13:38:06 UTC 2016
On Thursday, 15 September 2016 23:16:42 CEST Matteo Cafasso wrote:
> +/* Find inode, it gets called on every FS node.
> + * If the FS node address is the given one, parse it,
> + * encode it into an XDR structure and send it to the library.
> + * Return TSK_WALK_CONT on success, TSK_WALK_ERROR on error.
> + */
> +static TSK_WALK_RET_ENUM
> +findino_callback (TSK_FS_FILE *fsfile, const char *path, void *data)
> +{
> + int ret = 0;
> + uint64_t *inode = (uint64_t *) data;
> +
> + if (entry_is_dot (fsfile))
> + return TSK_WALK_CONT;
> +
> + if (*inode != fsfile->name->meta_addr)
> + return TSK_WALK_CONT;
I guess this condition will be more critical in excluding the inodes
that are not wanted (all but the requested), and it should be fast
(since it's a simple comparison of uint64_t); hence I would do this
before the entry_is_dot one.
LGTM otherwise.
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/20160916/70a88875/attachment.sig>
More information about the Libguestfs
mailing list