[illumos-Developer] Difference between zfs_path_to_zhandle and zfs_open

Richard Lowe richlowe at richlowe.net
Fri Oct 8 00:17:31 PDT 2010


Peter Tap wrote:
> Garrett,
>
> Thank you for your help. I too have been looking at the code:-).
>
> It appears to me that zfs_path_to_zhandle can take dataset name as a
> parameter as well. I have tried this scenario.
>

zfs_path_to_zhandle is used in cases where the argument can be either
dataset or filesystem path, for instance, the arguments to 'zfs list'.
The other consumer appears to be the zone root path (see
usr/src/cmd/zfs/zfs_iter.c, and .../cmd/zoneadmd/vplat.c).  This is also
the reason it is so cautious about what it is willing to treat as a
filesystem path -- those things which are invalid ZFS dataset names but
valid pathnames -- to remove ambiguity.

Additional failure modes are apparent from the code:  For things which
it treats as filesystem paths it stats them (may fail), checks that they
are on a ZFS filesystem (may fail), then calls zfs_open(). 

-- Rich



More information about the Developer mailing list