* Iterate over all child filesystems
*/
int
-zfs_iter_filesystems(zfs_handle_t *zhp, int flags, zfs_iter_f func, void *data)
+zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f func, void *data)
{
zfs_cmd_t zc = {"\0"};
zfs_handle_t *nzhp;
if (zhp->zfs_type != ZFS_TYPE_FILESYSTEM)
return (0);
- if ((flags & ZFS_ITER_SIMPLE) == ZFS_ITER_SIMPLE)
- zc.zc_simple = B_TRUE;
-
if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
return (-1);
while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_DATASET_LIST_NEXT,
&zc)) == 0) {
- if (zc.zc_simple)
- nzhp = make_dataset_simple_handle_zc(zhp, &zc);
- else
- nzhp = make_dataset_handle_zc(zhp->zfs_hdl, &zc);
/*
* Silently ignore errors, as the only plausible explanation is
* that the pool has since been removed.
*/
- if (nzhp == NULL)
+ if ((nzhp = make_dataset_handle_zc(zhp->zfs_hdl,
+ &zc)) == NULL) {
continue;
+ }
if ((ret = func(nzhp, data)) != 0) {
zcmd_free_nvlists(&zc);
* Iterate over all snapshots
*/
int
-zfs_iter_snapshots(zfs_handle_t *zhp, int flags, zfs_iter_f func,
+zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func,
void *data, uint64_t min_txg, uint64_t max_txg)
{
zfs_cmd_t zc = {"\0"};
zhp->zfs_type == ZFS_TYPE_BOOKMARK)
return (0);
- zc.zc_simple = (flags & ZFS_ITER_SIMPLE) != 0;
+ zc.zc_simple = simple;
if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0)
return (-1);
while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT,
&zc)) == 0) {
- if (zc.zc_simple)
+ if (simple)
nzhp = make_dataset_simple_handle_zc(zhp, &zc);
else
nzhp = make_dataset_handle_zc(zhp->zfs_hdl, &zc);
* Iterate over all bookmarks
*/
int
-zfs_iter_bookmarks(zfs_handle_t *zhp, int flags, zfs_iter_f func, void *data)
+zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
{
- (void) flags;
zfs_handle_t *nzhp;
nvlist_t *props = NULL;
nvlist_t *bmarks = NULL;
}
int
-zfs_iter_snapshots_sorted(zfs_handle_t *zhp, int flags, zfs_iter_f callback,
- void *data, uint64_t min_txg, uint64_t max_txg)
+zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data,
+ uint64_t min_txg, uint64_t max_txg)
{
int ret = 0;
zfs_node_t *node;
avl_create(&avl, zfs_snapshot_compare,
sizeof (zfs_node_t), offsetof(zfs_node_t, zn_avlnode));
- ret = zfs_iter_snapshots(zhp, flags, zfs_sort_snaps, &avl, min_txg,
+ ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl, min_txg,
max_txg);
for (node = avl_first(&avl); node != NULL; node = AVL_NEXT(&avl, node))
* return ENOENT at the end.
*/
int
-zfs_iter_snapspec(zfs_handle_t *fs_zhp, int flags, const char *spec_orig,
+zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
zfs_iter_f func, void *arg)
{
char *buf, *comma_separated, *cp;
}
}
- err = zfs_iter_snapshots_sorted(fs_zhp, flags,
+ err = zfs_iter_snapshots_sorted(fs_zhp,
snapspec_cb, &ssa, 0, 0);
if (ret == 0)
ret = err;
* and as close as possible.
*/
int
-zfs_iter_children(zfs_handle_t *zhp, int flags, zfs_iter_f func, void *data)
+zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, void *data)
{
int ret;
- if ((ret = zfs_iter_snapshots(zhp, flags, func, data, 0, 0)) != 0)
+ if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data, 0, 0)) != 0)
return (ret);
- return (zfs_iter_filesystems(zhp, flags, func, data));
+ return (zfs_iter_filesystems(zhp, func, data));
}
typedef struct iter_dependents_arg {
boolean_t first;
- int flags;
boolean_t allowrecursion;
iter_stack_frame_t *stack;
zfs_iter_f func;
isf.zhp = zhp;
isf.next = ida->stack;
ida->stack = &isf;
- err = zfs_iter_filesystems(zhp, ida->flags,
- iter_dependents_cb, ida);
+ err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida);
if (err == 0)
- err = zfs_iter_snapshots(zhp, ida->flags,
+ err = zfs_iter_snapshots(zhp, B_FALSE,
iter_dependents_cb, ida, 0, 0);
ida->stack = isf.next;
}
}
int
-zfs_iter_dependents(zfs_handle_t *zhp, int flags, boolean_t allowrecursion,
+zfs_iter_dependents(zfs_handle_t *zhp, boolean_t allowrecursion,
zfs_iter_f func, void *data)
{
iter_dependents_arg_t ida;
- ida.flags = flags;
ida.allowrecursion = allowrecursion;
ida.stack = NULL;
ida.func = func;