Пример #1
0
/*
 * Iterate over all properties, calling back into the specified function
 * for each property. We will continue to iterate until we either
 * reach the end or the callback function something other than
 * ZFS_PROP_CONT.
 */
zfs_prop_t
zfs_prop_iter_common(zfs_prop_f func, void *cb, zfs_type_t type,
    boolean_t show_all, boolean_t ordered)
{
	int i,j;
	zfs_prop_t order[ZFS_NUM_PROPS];

	for (j = 0; j < ZFS_NUM_PROPS; j++)
		order[j] = j;


	if (ordered) {
		qsort((void *)order, ZFS_NUM_PROPS, sizeof (zfs_prop_t),
		    zfs_prop_compare);
	}

	for (i = 0; i < ZFS_NUM_PROPS; i++) {
		if (zfs_prop_valid_for_type(order[i], type) &&
		    (zfs_prop_is_visible(order[i]) || show_all)) {
			if (func(order[i], cb) != ZFS_PROP_CONT)
				return (order[i]);
		}
	}
	return (ZFS_PROP_CONT);
}
Пример #2
0
/*
 * Iterate over all properties, calling back into the specified function
 * for each property. We will continue to iterate until we either
 * reach the end or the callback function something other than
 * ZFS_PROP_CONT.
 */
zfs_prop_t
zfs_prop_iter_common(zfs_prop_f func, void *cb, zfs_type_t type,
    boolean_t show_all)
{
	int i;

	for (i = 0; i < ZFS_PROP_COUNT; i++) {
		if (zfs_prop_valid_for_type(i, type) &&
		    (zfs_prop_is_visible(i) || show_all)) {
			if (func(i, cb) != ZFS_PROP_CONT)
				return (i);
		}
	}
	return (ZFS_PROP_CONT);
}