Skip to content

Commit

Permalink
Print iostat headers every time terminal fills.
Browse files Browse the repository at this point in the history
Each time terminal fills zpool iostat will print headers.
If -n flag is passed this behavior will be supressed.

Signed-off-by: Damian Wojslaw <damian@wojslaw.pl>
  • Loading branch information
madwizard committed Jan 8, 2019
1 parent 5811e7c commit 647ca71
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmd/zpool/zpool_main.c
Expand Up @@ -4748,7 +4748,7 @@ get_namewidth_iostat(zpool_handle_t *zhp, void *data)
* -w Display latency histograms
* -r Display request size histogram
* -T Display a timestamp in date(1) or Unix format
* -n Only print headers once
* -nOnly print headers once
*
* This command can be tricky because we want to be able to deal with pool
* creation/destruction as well as vdev configuration changes. The bulk of this
Expand All @@ -4764,8 +4764,8 @@ zpool_do_iostat(int argc, char **argv)
int npools;
float interval = 0;
unsigned long count = 0;
struct winsize win;
int winheight = 24; // Default number of terminal rows
>···struct winsize win;
>···int winheight = 24; // Default number of terminal rows
zpool_list_t *list;
boolean_t verbose = B_FALSE;
boolean_t latency = B_FALSE, l_histo = B_FALSE, rq_histo = B_FALSE;
Expand All @@ -4774,7 +4774,7 @@ zpool_do_iostat(int argc, char **argv)
boolean_t guid = B_FALSE;
boolean_t follow_links = B_FALSE;
boolean_t full_name = B_FALSE;
boolean_t headers_once = B_FALSE;
>···boolean_t headers_once = B_FALSE;
iostat_cbdata_t cb = { 0 };
char *cmd = NULL;

Expand Down Expand Up @@ -4848,9 +4848,9 @@ zpool_do_iostat(int argc, char **argv)
case 'y':
omit_since_boot = B_TRUE;
break;
case 'n':
headers_once = B_TRUE;
break;
>···>···>···case 'n':
>···>···>···headers_once = B_TRUE;
>···>···>···break;
case 'h':
usage(B_FALSE);
break;
Expand All @@ -4860,7 +4860,7 @@ zpool_do_iostat(int argc, char **argv)
exit(0);
} else {
fprintf(stderr,
gettext("invalid option '%c'\n"), optopt);
>···gettext("invalid option '%c'\n"), optopt);
}
usage(B_FALSE);
}
Expand Down Expand Up @@ -5013,8 +5013,8 @@ zpool_do_iostat(int argc, char **argv)
}


if(ioctl(1,TIOCGWINSZ, &win) != -1 && win.ws_row > 0)
winheight = win.ws_row;
>···if(ioctl(1,TIOCGWINSZ, &win) != -1 && win.ws_row > 0)
>···>···winheight = win.ws_row;

for (;;) {
if ((npools = pool_list_count(list)) == 0)
Expand Down

0 comments on commit 647ca71

Please sign in to comment.