From owner-svn-src-stable-10@FreeBSD.ORG Thu Jul 17 06:36:23 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 395B4CD3; Thu, 17 Jul 2014 06:36:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CBC12277; Thu, 17 Jul 2014 06:36:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6H6aM6i078685; Thu, 17 Jul 2014 06:36:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6H6aMsE078681; Thu, 17 Jul 2014 06:36:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407170636.s6H6aMsE078681@svn.freebsd.org> From: Xin LI Date: Thu, 17 Jul 2014 06:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268791 - stable/10/usr.sbin/gstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2014 06:36:23 -0000 Author: delphij Date: Thu Jul 17 06:36:22 2014 New Revision: 268791 URL: http://svnweb.freebsd.org/changeset/base/268791 Log: MFC r268238: Add an option, -p, which makes gstat(8) to only display physical providers (those with rank of 1). Modified: stable/10/usr.sbin/gstat/gstat.8 stable/10/usr.sbin/gstat/gstat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/gstat/gstat.8 ============================================================================== --- stable/10/usr.sbin/gstat/gstat.8 Thu Jul 17 06:21:58 2014 (r268790) +++ stable/10/usr.sbin/gstat/gstat.8 Thu Jul 17 06:36:22 2014 (r268791) @@ -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 Modified: stable/10/usr.sbin/gstat/gstat.c ============================================================================== --- stable/10/usr.sbin/gstat/gstat.c Thu Jul 17 06:21:58 2014 (r268790) +++ stable/10/usr.sbin/gstat/gstat.c Thu Jul 17 06:36:22 2014 (r268791) @@ -51,7 +51,7 @@ #include #include -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 */ }