From owner-svn-src-stable@FreeBSD.ORG Sun Dec 16 14:10:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94D9341A; Sun, 16 Dec 2012 14:10:13 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4228FC0A; Sun, 16 Dec 2012 14:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBGEAD9X089615; Sun, 16 Dec 2012 14:10:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBGEADBP089614; Sun, 16 Dec 2012 14:10:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201212161410.qBGEADBP089614@svn.freebsd.org> From: Rick Macklem Date: Sun, 16 Dec 2012 14:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244291 - stable/9/usr.bin/nfsstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 14:10:13 -0000 Author: rmacklem Date: Sun Dec 16 14:10:12 2012 New Revision: 244291 URL: http://svnweb.freebsd.org/changeset/base/244291 Log: MFC: r243783 Add a "-m" option to nfsstat, which dumps out the actual options used by all NFS mounts. Works for the new/default NFS client only. Modified: stable/9/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/9/usr.bin/nfsstat/ (props changed) Modified: stable/9/usr.bin/nfsstat/nfsstat.c ============================================================================== --- stable/9/usr.bin/nfsstat/nfsstat.c Sun Dec 16 14:09:18 2012 (r244290) +++ stable/9/usr.bin/nfsstat/nfsstat.c Sun Dec 16 14:10:12 2012 (r244291) @@ -107,14 +107,36 @@ main(int argc, char **argv) int ch; char *memf, *nlistf; char errbuf[_POSIX2_LINE_MAX]; + int mntlen, i; + char buf[1024]; + struct statfs *mntbuf; + struct nfscl_dumpmntopts dumpmntopts; interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "cesWM:N:ow:z")) != -1) + while ((ch = getopt(argc, argv, "cesWM:mN:ow:z")) != -1) switch(ch) { case 'M': memf = optarg; break; + case 'm': + /* Display mount options for NFS mount points. */ + mntlen = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntlen; i++) { + if (strcmp(mntbuf->f_fstypename, "nfs") == 0) { + dumpmntopts.ndmnt_fname = + mntbuf->f_mntonname; + dumpmntopts.ndmnt_buf = buf; + dumpmntopts.ndmnt_blen = sizeof(buf); + if (nfssvc(NFSSVC_DUMPMNTOPTS, + &dumpmntopts) >= 0) + printf("%s on %s\n%s\n", + mntbuf->f_mntfromname, + mntbuf->f_mntonname, buf); + } + mntbuf++; + } + exit(0); case 'N': nlistf = optarg; break; @@ -646,7 +668,7 @@ void usage(void) { (void)fprintf(stderr, - "usage: nfsstat [-ceoszW] [-M core] [-N system] [-w wait]\n"); + "usage: nfsstat [-cemoszW] [-M core] [-N system] [-w wait]\n"); exit(1); }