aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_dataset.c
diff options
context:
space:
mode:
authorPaul Dagnelie <[email protected]>2022-01-06 11:12:53 -0800
committerGitHub <[email protected]>2022-01-06 11:12:53 -0800
commit399b98198ae2e7c003448bf6b9508879c2a3ed83 (patch)
treeac75993028048d6069069306697dbb573af89391 /lib/libzfs/libzfs_dataset.c
parent0175272f6463dcfe588480c459c065cc4a78ba08 (diff)
Revert "zfs list: Allow more fields in ZFS_ITER_SIMPLE mode"
This reverts commit f6a0dac84af2fba9c306a3a307ea7aafcbe32d2b. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Mark Maybee <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #12938
Diffstat (limited to 'lib/libzfs/libzfs_dataset.c')
-rw-r--r--lib/libzfs/libzfs_dataset.c51
1 files changed, 13 insertions, 38 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index fb99abfe3..bbc12877d 100644
--- a/lib/libzfs/libzfs_dataset.c
+++ b/lib/libzfs/libzfs_dataset.c
@@ -529,17 +529,9 @@ make_dataset_simple_handle_zc(zfs_handle_t *pzhp, zfs_cmd_t *zc)
zhp->zfs_hdl = pzhp->zfs_hdl;
(void) strlcpy(zhp->zfs_name, zc->zc_name, sizeof (zhp->zfs_name));
- zhp->zpool_hdl = zpool_handle(zhp);
- zhp->zfs_dmustats = zc->zc_objset_stats; /* structure assignment */
zhp->zfs_head_type = pzhp->zfs_type;
- if (zhp->zfs_dmustats.dds_is_snapshot)
- zhp->zfs_type = ZFS_TYPE_SNAPSHOT;
- else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZVOL)
- zhp->zfs_type = ZFS_TYPE_VOLUME;
- else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZFS)
- zhp->zfs_type = ZFS_TYPE_FILESYSTEM;
- else
- abort(); /* we should never see any other types */
+ zhp->zfs_type = ZFS_TYPE_SNAPSHOT;
+ zhp->zpool_hdl = zpool_handle(zhp);
return (zhp);
}
@@ -745,7 +737,7 @@ zfs_open(libzfs_handle_t *hdl, const char *path, int types)
* Iterate bookmarks to find the right one.
*/
errno = 0;
- if ((zfs_iter_bookmarks(pzhp, 0, zfs_open_bookmarks_cb,
+ if ((zfs_iter_bookmarks(pzhp, zfs_open_bookmarks_cb,
&cb_data) == 0) && (cb_data.zhp == NULL)) {
(void) zfs_error(hdl, EZFS_NOENT, errbuf);
zfs_close(pzhp);
@@ -2095,8 +2087,7 @@ getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
static boolean_t
zfs_is_recvd_props_mode(zfs_handle_t *zhp)
{
- return (zhp->zfs_props != NULL &&
- zhp->zfs_props == zhp->zfs_recvd_props);
+ return (zhp->zfs_props == zhp->zfs_recvd_props);
}
static void
@@ -2301,20 +2292,6 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
*val = zhp->zfs_dmustats.dds_redacted;
break;
- case ZFS_PROP_GUID:
- if (zhp->zfs_dmustats.dds_guid != 0)
- *val = zhp->zfs_dmustats.dds_guid;
- else
- *val = getprop_uint64(zhp, prop, source);
- break;
-
- case ZFS_PROP_CREATETXG:
- if (zhp->zfs_dmustats.dds_creation_txg != 0)
- *val = zhp->zfs_dmustats.dds_creation_txg;
- else
- *val = getprop_uint64(zhp, prop, source);
- break;
-
default:
switch (zfs_prop_get_type(prop)) {
case PROP_TYPE_NUMBER:
@@ -2458,7 +2435,7 @@ get_clones_cb(zfs_handle_t *zhp, void *arg)
}
out:
- (void) zfs_iter_children(zhp, 0, get_clones_cb, gca);
+ (void) zfs_iter_children(zhp, get_clones_cb, gca);
zfs_close(zhp);
return (0);
}
@@ -2745,9 +2722,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
break;
case ZFS_PROP_ORIGIN:
- str = (char *)&zhp->zfs_dmustats.dds_origin;
- if (*str == '\0')
- str = zfs_prop_default_string(prop);
+ str = getprop_string(zhp, prop, &source);
if (str == NULL)
return (-1);
(void) strlcpy(propbuf, str, proplen);
@@ -3883,7 +3858,7 @@ zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
if (lzc_exists(name))
verify(nvlist_add_boolean(dd->nvl, name) == 0);
- rv = zfs_iter_filesystems(zhp, 0, zfs_check_snap_cb, dd);
+ rv = zfs_iter_filesystems(zhp, zfs_check_snap_cb, dd);
zfs_close(zhp);
return (rv);
}
@@ -4124,7 +4099,7 @@ zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
fnvlist_add_boolean(sd->sd_nvl, name);
- rv = zfs_iter_filesystems(zhp, 0, zfs_snapshot_cb, sd);
+ rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd);
}
zfs_close(zhp);
@@ -4299,7 +4274,7 @@ rollback_destroy(zfs_handle_t *zhp, void *data)
rollback_data_t *cbp = data;
if (zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) > cbp->cb_create) {
- cbp->cb_error |= zfs_iter_dependents(zhp, 0, B_FALSE,
+ cbp->cb_error |= zfs_iter_dependents(zhp, B_FALSE,
rollback_destroy_dependent, cbp);
cbp->cb_error |= zfs_destroy(zhp, B_FALSE);
@@ -4339,10 +4314,10 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force)
if (cb.cb_create > 0)
min_txg = cb.cb_create;
- (void) zfs_iter_snapshots(zhp, 0, rollback_destroy, &cb,
+ (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb,
min_txg, 0);
- (void) zfs_iter_bookmarks(zhp, 0, rollback_destroy, &cb);
+ (void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb);
if (cb.cb_error)
return (-1);
@@ -4934,7 +4909,7 @@ zfs_hold_one(zfs_handle_t *zhp, void *arg)
fnvlist_add_string(ha->nvl, name, ha->tag);
if (ha->recursive)
- rv = zfs_iter_filesystems(zhp, 0, zfs_hold_one, ha);
+ rv = zfs_iter_filesystems(zhp, zfs_hold_one, ha);
zfs_close(zhp);
return (rv);
}
@@ -5065,7 +5040,7 @@ zfs_release_one(zfs_handle_t *zhp, void *arg)
}
if (ha->recursive)
- rv = zfs_iter_filesystems(zhp, 0, zfs_release_one, ha);
+ rv = zfs_iter_filesystems(zhp, zfs_release_one, ha);
zfs_close(zhp);
return (rv);
}