From 6044cf59cdf80d4ba94a7b6c6736cace8a7de9db Mon Sep 17 00:00:00 2001 From: John Date: Thu, 19 Oct 2017 11:18:42 -0700 Subject: [PATCH] Add convenience 'zfs_get' functions Add get functions to match existing ones. Reviewed-by: Giuseppe Di Natale Reviewed-by: Brian Behlendorf Signed-off-by: John Ramsden Closes #6308 --- include/libzfs.h | 1 + lib/libzfs/libzfs_dataset.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/libzfs.h b/include/libzfs.h index ac5a30c359..7ef250f02d 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -502,6 +502,7 @@ extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t); extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t); extern const char *zfs_prop_values(zfs_prop_t); extern int zfs_prop_is_string(zfs_prop_t prop); +extern nvlist_t *zfs_get_all_props(zfs_handle_t *); extern nvlist_t *zfs_get_user_props(zfs_handle_t *); extern nvlist_t *zfs_get_recvd_props(zfs_handle_t *); extern nvlist_t *zfs_get_clones_nvl(zfs_handle_t *); diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 3cf4707598..0a9a4277de 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -64,6 +64,7 @@ #include "zfs_namecheck.h" #include "zfs_prop.h" #include "libzfs_impl.h" +#include "libzfs.h" #include "zfs_deleg.h" static int userquota_propname_decode(const char *propname, boolean_t zoned, @@ -4353,6 +4354,21 @@ error: return (ret); } +nvlist_t * +zfs_get_all_props(zfs_handle_t *zhp) +{ + return (zhp->zfs_props); +} + +nvlist_t * +zfs_get_recvd_props(zfs_handle_t *zhp) +{ + if (zhp->zfs_recvd_props == NULL) + if (get_recvd_props_ioctl(zhp) != 0) + return (NULL); + return (zhp->zfs_recvd_props); +} + nvlist_t * zfs_get_user_props(zfs_handle_t *zhp) {