svn commit: r281922 - head/usr.bin/nfsstat

Sergey Kandaurov pluknet at freebsd.org
Fri Apr 24 11:31:33 UTC 2015


On 24 April 2015 at 10:58, Edward Tomasz Napierala <trasz at freebsd.org> wrote:
> Author: trasz
> Date: Fri Apr 24 07:57:59 2015
> New Revision: 281922
> URL: https://svnweb.freebsd.org/changeset/base/281922
>
> Log:
>   Make nfsstat(1) build with WARNS=6.
>
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/usr.bin/nfsstat/Makefile
>   head/usr.bin/nfsstat/nfsstat.c
>
> Modified: head/usr.bin/nfsstat/Makefile
> ==============================================================================
> --- head/usr.bin/nfsstat/Makefile       Fri Apr 24 07:52:21 2015        (r281921)
> +++ head/usr.bin/nfsstat/Makefile       Fri Apr 24 07:57:59 2015        (r281922)
> @@ -6,6 +6,4 @@ CFLAGS+=-DNFS
>
>  LIBADD=        kvm
>
> -WARNS?=        3
> -
>  .include <bsd.prog.mk>
>
> Modified: head/usr.bin/nfsstat/nfsstat.c
> ==============================================================================
> --- head/usr.bin/nfsstat/nfsstat.c      Fri Apr 24 07:52:21 2015        (r281921)
> +++ head/usr.bin/nfsstat/nfsstat.c      Fri Apr 24 07:57:59 2015        (r281922)
> @@ -70,15 +70,6 @@ static const char rcsid[] =
>  #include <paths.h>
>  #include <err.h>
>
> -struct nlist nl[] = {
> -#define        N_NFSSTAT       0
> -       { .n_name = "nfsstats" },
> -#define        N_NFSRVSTAT     1
> -       { .n_name = "nfsrvstats" },
> -       { .n_name = NULL },
> -};
> -kvm_t *kd;
> -
>  static int widemode = 0;
>  static int zflag = 0;
>  static int printtitle = 1;
>

Now that nfsstat no longer uses kvm to extract statistics, it could be
further trimmed.
- no longer link with kvm
- un-document -M/-N options but still kept (?) for backward compatibility
- cleanup from the previous sysctl/kvm usage.

Index: Makefile
===================================================================
--- Makefile    (revision 281924)
+++ Makefile    (working copy)
@@ -2,8 +2,5 @@
 # $FreeBSD$

 PROG=  nfsstat
-CFLAGS+=-DNFS

-LIBADD=        kvm
-
 .include <bsd.prog.mk>
Index: nfsstat.1
===================================================================
--- nfsstat.1   (revision 281924)
+++ nfsstat.1   (working copy)
@@ -39,8 +39,6 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl cemszW
-.Op Fl M Ar core
-.Op Fl N Ar system
 .Op Fl w Ar wait
 .Sh DESCRIPTION
 The
@@ -60,19 +58,12 @@
 .It Fl e
 Report the extra statistics collected by the NFS client and
 server for NFSv4.
-.It Fl M
-Extract values associated with the name list from the specified core
-instead of the default
-.Pa /dev/kmem .
 .It Fl m
 Report the mount options for all new NFS client mounts.
 This option overrides all others and
 .Nm
 will exit after completing the report.
 This option is only supported by the new NFS client.
-.It Fl N
-Extract the name list from the specified system instead of the default
-.Pa /boot/kernel/kernel .
 .It Fl s
 Only display server side statistics.
 .It Fl W
@@ -92,19 +83,11 @@
 .It Fl z
 Reset statistics after displaying them.
 .El
-.Sh FILES
-.Bl -tag -width ".Pa /boot/kernel/kernel" -compact
-.It Pa /boot/kernel/kernel
-default kernel namelist
-.It Pa /dev/kmem
-default memory file
-.El
 .Sh SEE ALSO
 .Xr fstat 1 ,
 .Xr netstat 1 ,
 .Xr ps 1 ,
 .Xr systat 1 ,
-.Xr sysctl 3 ,
 .Xr iostat 8 ,
 .Xr nfsdumpstate 8 ,
 .Xr pstat 8 ,
Index: nfsstat.c
===================================================================
--- nfsstat.c   (revision 281924)
+++ nfsstat.c   (working copy)
@@ -48,26 +48,16 @@
 #include <sys/module.h>
 #include <sys/mount.h>
 #include <sys/time.h>
-#include <sys/sysctl.h>
 #include <nfs/nfsproto.h>
-#include <nfsclient/nfs.h>
-#include <nfsserver/nfs.h>
 #include <nfs/nfssvc.h>

 #include <fs/nfs/nfsport.h>

-#include <signal.h>
-#include <fcntl.h>
-#include <ctype.h>
 #include <errno.h>
-#include <kvm.h>
-#include <limits.h>
-#include <nlist.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <paths.h>
 #include <err.h>

 static int widemode = 0;
@@ -93,18 +83,15 @@
        int clientOnly = -1;
        int serverOnly = -1;
        int ch;
-       char *memf, *nlistf;
        int mntlen, i;
        char buf[1024];
        struct statfs *mntbuf;
        struct nfscl_dumpmntopts dumpmntopts;

        interval = 0;
-       memf = nlistf = NULL;
        while ((ch = getopt(argc, argv, "cesWM:mN:w:z")) != -1)
                switch(ch) {
                case 'M':
-                       memf = optarg;
                        break;
                case 'm':
                        /* Display mount options for NFS mount points. */
@@ -128,7 +115,6 @@
                        }
                        exit(0);
                case 'N':
-                       nlistf = optarg;
                        break;
                case 'W':
                        widemode = 1;
@@ -159,17 +145,6 @@
        argc -= optind;
        argv += optind;

-#define        BACKWARD_COMPATIBILITY
-#ifdef BACKWARD_COMPATIBILITY
-       if (*argv) {
-               interval = atoi(*argv);
-               if (*++argv) {
-                       nlistf = *argv;
-                       if (*++argv)
-                               memf = *argv;
-               }
-       }
-#endif
        if (modfind("nfscommon") < 0)
                errx(1, "NFS client/server not loaded");



-- 
wbr,
pluknet


More information about the svn-src-head mailing list