summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-07-17 06:36:22 +0000
committerdelphij <delphij@FreeBSD.org>2014-07-17 06:36:22 +0000
commit08c695a76f98c90f35979e8662000d622d38223f (patch)
tree933b217167f85678db687cfd9c4a132f85f8c4c2 /usr.sbin
parentadc65d02d14d973466e44875fad12c0421e04fc8 (diff)
downloadFreeBSD-src-08c695a76f98c90f35979e8662000d622d38223f.zip
FreeBSD-src-08c695a76f98c90f35979e8662000d622d38223f.tar.gz
MFC r268238:
Add an option, -p, which makes gstat(8) to only display physical providers (those with rank of 1).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/gstat/gstat.86
-rw-r--r--usr.sbin/gstat/gstat.c12
2 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/gstat/gstat.8 b/usr.sbin/gstat/gstat.8
index 7897a62..6c0430e 100644
--- a/usr.sbin/gstat/gstat.8
+++ b/usr.sbin/gstat/gstat.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 17, 2014
+.Dd July 3, 2014
.Dt GSTAT 8
.Os
.Sh NAME
@@ -32,7 +32,7 @@
.Nd print statistics about GEOM disks
.Sh SYNOPSIS
.Nm
-.Op Fl abcdo
+.Op Fl abcdop
.Op Fl f Ar filter
.Op Fl I Ar interval
.Sh DESCRIPTION
@@ -84,6 +84,8 @@ or
.Cm us
(the default) indicates that the update interval is specified in
seconds, milliseconds, or microseconds, respectively.
+.It Fl p
+Only display physical providers (those with rank of 1).
.El
.Sh EXIT STATUS
.Ex -std
diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c
index d3aeae0..d83ef79 100644
--- a/usr.sbin/gstat/gstat.c
+++ b/usr.sbin/gstat/gstat.c
@@ -51,7 +51,7 @@
#include <sysexits.h>
#include <unistd.h>
-static int flag_a, flag_b, flag_c, flag_d, flag_o;
+static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p;
static int flag_I = 1000000;
#define PRINTMSG(...) do { \
@@ -104,7 +104,7 @@ main(int argc, char **argv)
flag_b = 1;
f_s[0] = '\0';
- while ((i = getopt(argc, argv, "abdcf:oI:")) != -1) {
+ while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) {
switch (i) {
case 'a':
flag_a = 1;
@@ -143,6 +143,9 @@ main(int argc, char **argv)
i *= 1;
flag_I = i;
break;
+ case 'p':
+ flag_p = 1;
+ break;
case '?':
default:
usage();
@@ -254,6 +257,9 @@ main(int argc, char **argv)
continue;
if (gid->lg_what == ISCONSUMER && !flag_c)
continue;
+ if (flag_p && gid->lg_what == ISPROVIDER &&
+ ((struct gprovider *)(gid->lg_ptr))->lg_geom->lg_rank != 1)
+ continue;
/* Do not print past end of window */
if (!flag_b) {
getyx(stdscr, cury, curx);
@@ -443,7 +449,7 @@ main(int argc, char **argv)
static void
usage(void)
{
- fprintf(stderr, "usage: gstat [-abcd] [-f filter] [-I interval]\n");
+ fprintf(stderr, "usage: gstat [-abcdp] [-f filter] [-I interval]\n");
exit(EX_USAGE);
/* NOTREACHED */
}
OpenPOWER on IntegriCloud