FreeBSD/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
/*
 * zpool export [-f] <pool> ...
 *
 *	-f	Forcefully unmount datasets
 *
 * Export the given pools.  By default, the command will attempt to cleanly
 * unmount any active datasets within the pool.  If the '-f' flag is specified,
 * then the datasets will be forcefully unmounted.
 */
zpool export [-f] 
-f      Forcefully unmount datasets

Export the given pools.  By default, the command will attempt to cleanly
unmount any active datasets within the pool.  If the '-f' flag is specified,
then the datasets will be forcefully unmounted.
zpool export [ - f ] - f Forcefully unmount datasets Export the given pools . By default the command will attempt to cleanly unmount any active datasets within the pool . If the ' - f ' flag is specified then the datasets will be forcefully unmounted .
int
zpool_do_export(int argc, char **argv)
{
	boolean_t force = B_FALSE;
	boolean_t hardforce = B_FALSE;
	int c;
	zpool_handle_t *zhp;
	int ret;
	int i;
	while ((c = getopt(argc, argv, "fF")) != -1) {
		switch (c) {
		case 'f':
			force = B_TRUE;
			break;
		case 'F':
			hardforce = 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);
	}
	ret = 0;
	for (i = 0; i < argc; i++) {
		if ((zhp = zpool_open_canfail(g_zfs, argv[i])) == NULL) {
			ret = 1;
			continue;
		}
		if (zpool_disable_datasets(zhp, force) != 0) {
			ret = 1;
			zpool_close(zhp);
			continue;
		}
		log_history = B_FALSE;
		if (hardforce) {
			if (zpool_export_force(zhp, history_str) != 0)
				ret = 1;
		} else if (zpool_export(zhp, force, history_str) != 0) {
			ret = 1;
		}
		zpool_close(zhp);
	}
	return (ret);
}
int zpool_do_export ( int argc , char * * argv ) { boolean_t force = B_FALSE ; boolean_t hardforce = B_FALSE ; int c ; zpool_handle_t * zhp ; int ret ; int i ; while ( ( c = getopt ( argc , argv , " " ) ) != -1 ) { switch ( c ) { case ' ' : force = B_TRUE ; break ; case ' ' : hardforce = 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 ) ; } ret = 0 ; for ( i = 0 ; i < argc ; i ++ ) { if ( ( zhp = zpool_open_canfail ( g_zfs , argv [ i ] ) ) == NULL ) { ret = 1 ; continue ; } if ( zpool_disable_datasets ( zhp , force ) != 0 ) { ret = 1 ; zpool_close ( zhp ) ; continue ; } log_history = B_FALSE ; if ( hardforce ) { if ( zpool_export_force ( zhp , history_str ) != 0 ) ret = 1 ; } else if ( zpool_export ( zhp , force , history_str ) != 0 ) { ret = 1 ; } zpool_close ( zhp ) ; } return ( ret ) ; }
zpool export [-f] <pool> ...
      -f      Forcefully unmount datasets
zpool export [ - f ] <pool > ... - f Forcefully unmount datasets
/* check options */ /* check arguments */ /* The history must be logged as part of the export */