FreeBSD/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
/*
 * Report any snapshots more recent than the one specified.  Used when '-r' is
 * not specified.  We reuse this same callback for the snapshot dependents - if
 * 'cb_dependent' is set, then this is a dependent and we should report it
 * without checking the transaction group.
 */
Report any snapshots more recent than the one specified.  Used when '-r' is
not specified.  We reuse this same callback for the snapshot dependents - if
'cb_dependent' is set, then this is a dependent and we should report it
without checking the transaction group.
Report any snapshots more recent than the one specified . Used when ' - r ' is not specified . We reuse this same callback for the snapshot dependents - if ' cb_dependent ' is set then this is a dependent and we should report it without checking the transaction group .
static int
rollback_check(zfs_handle_t *zhp, void *data)
{
	rollback_cbdata_t *cbp = data;
	if (cbp->cb_doclones) {
		zfs_close(zhp);
		return (0);
	}
	if (zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) > cbp->cb_create) {
		if (cbp->cb_first && !cbp->cb_recurse) {
			(void) fprintf(stderr, gettext("cannot "
			    "rollback to '%s': more recent snapshots "
			    "or bookmarks exist\n"),
			    cbp->cb_target);
			(void) fprintf(stderr, gettext("use '-r' to "
			    "force deletion of the following "
			    "snapshots and bookmarks:\n"));
			cbp->cb_first = 0;
			cbp->cb_error = 1;
		}
		if (cbp->cb_recurse) {
			if (zfs_iter_dependents(zhp, B_TRUE,
			    rollback_check_dependent, cbp) != 0) {
				zfs_close(zhp);
				return (-1);
			}
		} else {
			(void) fprintf(stderr, "%s\n",
			    zfs_get_name(zhp));
		}
	}
	zfs_close(zhp);
	return (0);
}
static int rollback_check ( zfs_handle_t * zhp , void * data ) { rollback_cbdata_t * cbp = data ; if ( cbp -> cb_doclones ) { zfs_close ( zhp ) ; return ( 0 ) ; } if ( zfs_prop_get_int ( zhp , ZFS_PROP_CREATETXG ) > cbp -> cb_create ) { if ( cbp -> cb_first && ! cbp -> cb_recurse ) { ( void ) fprintf ( stderr , gettext ( " " " " " \n " ) , cbp -> cb_target ) ; ( void ) fprintf ( stderr , gettext ( " " " " " \n " ) ) ; cbp -> cb_first = 0 ; cbp -> cb_error = 1 ; } if ( cbp -> cb_recurse ) { if ( zfs_iter_dependents ( zhp , B_TRUE , rollback_check_dependent , cbp ) != 0 ) { zfs_close ( zhp ) ; return ( -1 ) ; } } else { ( void ) fprintf ( stderr , " \n " , zfs_get_name ( zhp ) ) ; } } zfs_close ( zhp ) ; return ( 0 ) ; }
Report any snapshots more recent than the one specified.
Report any snapshots more recent than the one specified .