Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2014 07:50:54 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262832 - head/tools/tools/npe/npestats
Message-ID:  <201403060750.s267osce065191@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Mar  6 07:50:54 2014
New Revision: 262832
URL: http://svnweb.freebsd.org/changeset/base/262832

Log:
  Migrate npestats to use bsdstat.

Deleted:
  head/tools/tools/npe/npestats/statfoo.c
  head/tools/tools/npe/npestats/statfoo.h
Modified:
  head/tools/tools/npe/npestats/Makefile
  head/tools/tools/npe/npestats/npestats.c
  head/tools/tools/npe/npestats/npestats.h

Modified: head/tools/tools/npe/npestats/Makefile
==============================================================================
--- head/tools/tools/npe/npestats/Makefile	Thu Mar  6 07:49:12 2014	(r262831)
+++ head/tools/tools/npe/npestats/Makefile	Thu Mar  6 07:50:54 2014	(r262832)
@@ -1,8 +1,10 @@
 # $FreeBSD$
 
 PROG=	npestats
-SRCS=	main.c statfoo.c npestats.c
+SRCS=	main.c npestats.c
 BINDIR=	/usr/local/bin
 NO_MAN=	true
+USEPRIVATELIB=
+LDADD=	-lbsdstat
 
 .include <bsd.prog.mk>

Modified: head/tools/tools/npe/npestats/npestats.c
==============================================================================
--- head/tools/tools/npe/npestats/npestats.c	Thu Mar  6 07:49:12 2014	(r262831)
+++ head/tools/tools/npe/npestats/npestats.c	Thu Mar  6 07:50:54 2014	(r262832)
@@ -151,7 +151,7 @@ npe_collect(struct npestatfoo_p *wf, str
 }
 
 static void
-npe_collect_cur(struct statfoo *sf)
+npe_collect_cur(struct bsdstat *sf)
 {
 	struct npestatfoo_p *wf = (struct npestatfoo_p *) sf;
 
@@ -159,7 +159,7 @@ npe_collect_cur(struct statfoo *sf)
 }
 
 static void
-npe_collect_tot(struct statfoo *sf)
+npe_collect_tot(struct bsdstat *sf)
 {
 	struct npestatfoo_p *wf = (struct npestatfoo_p *) sf;
 
@@ -167,7 +167,7 @@ npe_collect_tot(struct statfoo *sf)
 }
 
 static void
-npe_update_tot(struct statfoo *sf)
+npe_update_tot(struct bsdstat *sf)
 {
 	struct npestatfoo_p *wf = (struct npestatfoo_p *) sf;
 
@@ -175,7 +175,7 @@ npe_update_tot(struct statfoo *sf)
 }
 
 static int
-npe_get_curstat(struct statfoo *sf, int s, char b[], size_t bs)
+npe_get_curstat(struct bsdstat *sf, int s, char b[], size_t bs)
 {
 	struct npestatfoo_p *wf = (struct npestatfoo_p *) sf;
 #define	STAT(x) \
@@ -211,7 +211,7 @@ npe_get_curstat(struct statfoo *sf, int 
 }
 
 static int
-npe_get_totstat(struct statfoo *sf, int s, char b[], size_t bs)
+npe_get_totstat(struct bsdstat *sf, int s, char b[], size_t bs)
 {
 	struct npestatfoo_p *wf = (struct npestatfoo_p *) sf;
 #define	STAT(x) \
@@ -246,7 +246,7 @@ npe_get_totstat(struct statfoo *sf, int 
 #undef STAT
 }
 
-STATFOO_DEFINE_BOUNCE(npestatfoo)
+BSDSTAT_DEFINE_BOUNCE(npestatfoo)
 
 struct npestatfoo *
 npestats_new(const char *ifname, const char *fmtstring)
@@ -256,7 +256,7 @@ npestats_new(const char *ifname, const c
 
 	wf = calloc(1, sizeof(struct npestatfoo_p));
 	if (wf != NULL) {
-		statfoo_init(&wf->base.base, "npestats", npestats, N(npestats));
+		bsdstat_init(&wf->base.base, "npestats", npestats, N(npestats));
 		/* override base methods */
 		wf->base.base.collect_cur = npe_collect_cur;
 		wf->base.base.collect_tot = npe_collect_tot;
@@ -265,7 +265,7 @@ npestats_new(const char *ifname, const c
 		wf->base.base.update_tot = npe_update_tot;
 
 		/* setup bounce functions for public methods */
-		STATFOO_BOUNCE(wf, npestatfoo);
+		BSDSTAT_BOUNCE(wf, npestatfoo);
 
 		/* setup our public methods */
 		wf->base.setifname = npe_setifname;

Modified: head/tools/tools/npe/npestats/npestats.h
==============================================================================
--- head/tools/tools/npe/npestats/npestats.h	Thu Mar  6 07:49:12 2014	(r262831)
+++ head/tools/tools/npe/npestats/npestats.h	Thu Mar  6 07:50:54 2014	(r262832)
@@ -32,15 +32,15 @@
 #ifndef _NPESTATS_H_
 #define	_NPESTATS_H_
 
-#include "statfoo.h"
+#include "bsdstat.h"
 
 /*
  * npe statistics class.
  */
 struct npestatfoo {
-	struct statfoo base;
+	struct bsdstat base;
 
-	STATFOO_DECL_METHODS(struct npestatfoo *);
+	BSDSTAT_DECL_METHODS(struct npestatfoo *);
 
 	/* set the network interface name for collection */
 	void (*setifname)(struct npestatfoo *, const char *ifname);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403060750.s267osce065191>