FreeBSD/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
/*
 * zpool status [-vx] [-T d|u] [pool] ... [interval [count]]
 *
 *	-v	Display complete error logs
 *	-x	Display only pools with potential problems
 *	-D	Display dedup status (undocumented)
 *	-T	Display a timestamp in date(1) or Unix format
 *
 * Describes the health status of all pools or some subset.
 */


Describes the health status of all pools or some subset.
Describes the health status of all pools or some subset .
int
zpool_do_status(int argc, char **argv)
{
	int c;
	int ret;
	unsigned long interval = 0, count = 0;
	status_cbdata_t cb = { 0 };
	while ((c = getopt(argc, argv, "vxDT:")) != -1) {
		switch (c) {
		case 'v':
			cb.cb_verbose = B_TRUE;
			break;
		case 'x':
			cb.cb_explain = B_TRUE;
			break;
		case 'D':
			cb.cb_dedup_stats = B_TRUE;
			break;
		case 'T':
			get_timestamp_arg(*optarg);
			break;
		case '?':
			(void) fprintf(stderr, gettext("invalid option '%c'\n"),
			    optopt);
			usage(B_FALSE);
		}
	}
	argc -= optind;
	argv += optind;
	get_interval_count(&argc, argv, &interval, &count);
	if (argc == 0)
		cb.cb_allpools = B_TRUE;
	cb.cb_first = B_TRUE;
	for (;;) {
		if (timestamp_fmt != NODATE)
			print_timestamp(timestamp_fmt);
		ret = for_each_pool(argc, argv, B_TRUE, NULL,
		    status_callback, &cb);
		if (argc == 0 && cb.cb_count == 0)
			(void) printf(gettext("no pools available\n"));
		else if (cb.cb_explain && cb.cb_first && cb.cb_allpools)
			(void) printf(gettext("all pools are healthy\n"));
		if (ret != 0)
			return (ret);
		if (interval == 0)
			break;
		if (count != 0 && --count == 0)
			break;
		(void) sleep(interval);
	}
	return (0);
}
int zpool_do_status ( int argc , char * * argv ) { int c ; int ret ; unsigned long interval = 0 , count = 0 ; status_cbdata_t cb = { 0 } ; while ( ( c = getopt ( argc , argv , " " ) ) != -1 ) { switch ( c ) { case ' ' : cb . cb_verbose = B_TRUE ; break ; case ' ' : cb . cb_explain = B_TRUE ; break ; case ' ' : cb . cb_dedup_stats = B_TRUE ; break ; case ' ' : get_timestamp_arg ( * optarg ) ; break ; case ' ' : ( void ) fprintf ( stderr , gettext ( " \n " ) , optopt ) ; usage ( B_FALSE ) ; } } argc -= optind ; argv += optind ; get_interval_count ( & argc , argv , & interval , & count ) ; if ( argc == 0 ) cb . cb_allpools = B_TRUE ; cb . cb_first = B_TRUE ; for ( ; ; ) { if ( timestamp_fmt != NODATE ) print_timestamp ( timestamp_fmt ) ; ret = for_each_pool ( argc , argv , B_TRUE , NULL , status_callback , & cb ) ; if ( argc == 0 && cb . cb_count == 0 ) ( void ) printf ( gettext ( " \n " ) ) ; else if ( cb . cb_explain && cb . cb_first && cb . cb_allpools ) ( void ) printf ( gettext ( " \n " ) ) ; if ( ret != 0 ) return ( ret ) ; if ( interval == 0 ) break ; if ( count != 0 && -- count == 0 ) break ; ( void ) sleep ( interval ) ; } return ( 0 ) ; }
zpool status [-vx] [-T d|u] [pool] ... [interval [count]]
      -v      Display complete error logs
      -x      Display only pools with potential problems
      -D      Display dedup status (undocumented)
      -T      Display a timestamp in date(1) or Unix format
zpool status [ - vx ] [ - T d|u ] [ pool ] ... [ interval [ count ]] - v Display complete error logs - x Display only pools with potential problems - D Display dedup status ( undocumented ) - T Display a timestamp in date ( 1 ) or Unix format
/* check options */