FreeBSD/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
/*
 * zpool destroy <pool>
 *
 * 	-f	Forcefully unmount any datasets
 *
 * Destroy the given pool.  Automatically unmounts any datasets in the pool.
 */
zpool destroy 
-f      Forcefully unmount any datasets

Destroy the given pool.  Automatically unmounts any datasets in the pool.
zpool destroy - f Forcefully unmount any datasets Destroy the given pool . Automatically unmounts any datasets in the pool .
int
zpool_do_destroy(int argc, char **argv)
{
	boolean_t force = B_FALSE;
	int c;
	char *pool;
	zpool_handle_t *zhp;
	int ret;
	while ((c = getopt(argc, argv, "f")) != -1) {
		switch (c) {
		case 'f':
			force = B_TRUE;
			break;
		case '?':
			(void) fprintf(stderr, gettext("invalid option '%c'\n"),
			    optopt);
			usage(B_FALSE);
		}
	}
	argc -= optind;
	argv += optind;
	if (argc < 1) {
		(void) fprintf(stderr, gettext("missing pool argument\n"));
		usage(B_FALSE);
	}
	if (argc > 1) {
		(void) fprintf(stderr, gettext("too many arguments\n"));
		usage(B_FALSE);
	}
	pool = argv[0];
	if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) {
		if (strchr(pool, '/') != NULL)
			(void) fprintf(stderr, gettext("use 'zfs destroy' to "
			    "destroy a dataset\n"));
		return (1);
	}
	if (zpool_disable_datasets(zhp, force) != 0) {
		(void) fprintf(stderr, gettext("could not destroy '%s': "
		    "could not unmount datasets\n"), zpool_get_name(zhp));
		return (1);
	}
	log_history = B_FALSE;
	ret = (zpool_destroy(zhp, history_str) != 0);
	zpool_close(zhp);
	return (ret);
}
int zpool_do_destroy ( int argc , char * * argv ) { boolean_t force = B_FALSE ; int c ; char * pool ; zpool_handle_t * zhp ; int ret ; while ( ( c = getopt ( argc , argv , " " ) ) != -1 ) { switch ( c ) { case ' ' : force = B_TRUE ; break ; case ' ' : ( void ) fprintf ( stderr , gettext ( " \n " ) , optopt ) ; usage ( B_FALSE ) ; } } argc -= optind ; argv += optind ; if ( argc < 1 ) { ( void ) fprintf ( stderr , gettext ( " \n " ) ) ; usage ( B_FALSE ) ; } if ( argc > 1 ) { ( void ) fprintf ( stderr , gettext ( " \n " ) ) ; usage ( B_FALSE ) ; } pool = argv [ 0 ] ; if ( ( zhp = zpool_open_canfail ( g_zfs , pool ) ) == NULL ) { if ( strchr ( pool , ' ' ) != NULL ) ( void ) fprintf ( stderr , gettext ( " " " \n " ) ) ; return ( 1 ) ; } if ( zpool_disable_datasets ( zhp , force ) != 0 ) { ( void ) fprintf ( stderr , gettext ( " " " \n " ) , zpool_get_name ( zhp ) ) ; return ( 1 ) ; } log_history = B_FALSE ; ret = ( zpool_destroy ( zhp , history_str ) != 0 ) ; zpool_close ( zhp ) ; return ( ret ) ; }
zpool destroy <pool>
      -f      Forcefully unmount any datasets
zpool destroy <pool > - f Forcefully unmount any datasets
/* check options */ /* check arguments */ /*
		 * As a special case, check for use of '/' in the name, and
		 * direct the user to use 'zfs destroy' instead.
		 */ /* The history must be logged as part of the export */