Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2014 07:48:43 +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: r262830 - head/tools/tools/mwl/mwlstats
Message-ID:  <201403060748.s267mh7j064507@svn.freebsd.org>

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

Log:
  Migrate mwlstats to use bsdstat.

Deleted:
  head/tools/tools/mwl/mwlstats/statfoo.c
  head/tools/tools/mwl/mwlstats/statfoo.h
Modified:
  head/tools/tools/mwl/mwlstats/Makefile
  head/tools/tools/mwl/mwlstats/mwlstats.c
  head/tools/tools/mwl/mwlstats/mwlstats.h

Modified: head/tools/tools/mwl/mwlstats/Makefile
==============================================================================
--- head/tools/tools/mwl/mwlstats/Makefile	Thu Mar  6 07:47:19 2014	(r262829)
+++ head/tools/tools/mwl/mwlstats/Makefile	Thu Mar  6 07:48:43 2014	(r262830)
@@ -4,7 +4,9 @@ PROG=	mwlstats
 BINDIR=	/usr/local/bin
 NO_MAN=
 
-SRCS=	main.c statfoo.c mwlstats.c
+SRCS=	main.c mwlstats.c
+USEPRIVATELIB=
+LDADD=-lbsdstat
 
 .include <bsd.prog.mk>
 

Modified: head/tools/tools/mwl/mwlstats/mwlstats.c
==============================================================================
--- head/tools/tools/mwl/mwlstats/mwlstats.c	Thu Mar  6 07:47:19 2014	(r262829)
+++ head/tools/tools/mwl/mwlstats/mwlstats.c	Thu Mar  6 07:48:43 2014	(r262830)
@@ -265,7 +265,7 @@ mwl_collect(struct mwlstatfoo_p *wf, str
 }
 
 static void
-mwl_collect_cur(struct statfoo *sf)
+mwl_collect_cur(struct bsdstat *sf)
 {
 	struct mwlstatfoo_p *wf = (struct mwlstatfoo_p *) sf;
 
@@ -273,7 +273,7 @@ mwl_collect_cur(struct statfoo *sf)
 }
 
 static void
-mwl_collect_tot(struct statfoo *sf)
+mwl_collect_tot(struct bsdstat *sf)
 {
 	struct mwlstatfoo_p *wf = (struct mwlstatfoo_p *) sf;
 
@@ -281,7 +281,7 @@ mwl_collect_tot(struct statfoo *sf)
 }
 
 static void
-mwl_update_tot(struct statfoo *sf)
+mwl_update_tot(struct bsdstat *sf)
 {
 	struct mwlstatfoo_p *wf = (struct mwlstatfoo_p *) sf;
 
@@ -300,7 +300,7 @@ setrate(char b[], size_t bs, uint8_t rat
 }
 
 static int
-mwl_get_curstat(struct statfoo *sf, int s, char b[], size_t bs)
+mwl_get_curstat(struct bsdstat *sf, int s, char b[], size_t bs)
 {
 	struct mwlstatfoo_p *wf = (struct mwlstatfoo_p *) sf;
 #define	STAT(x) \
@@ -406,7 +406,7 @@ mwl_get_curstat(struct statfoo *sf, int 
 }
 
 static int
-mwl_get_totstat(struct statfoo *sf, int s, char b[], size_t bs)
+mwl_get_totstat(struct bsdstat *sf, int s, char b[], size_t bs)
 {
 	struct mwlstatfoo_p *wf = (struct mwlstatfoo_p *) sf;
 #define	STAT(x) \
@@ -510,7 +510,7 @@ mwl_get_totstat(struct statfoo *sf, int 
 }
 
 static void
-mwl_print_verbose(struct statfoo *sf, FILE *fd)
+mwl_print_verbose(struct bsdstat *sf, FILE *fd)
 {
 	struct mwlstatfoo_p *wf = (struct mwlstatfoo_p *) sf;
 	const struct fmt *f;
@@ -539,7 +539,7 @@ mwl_print_verbose(struct statfoo *sf, FI
 				wf->total.mst_ant_rx[i]);
 }
 
-STATFOO_DEFINE_BOUNCE(mwlstatfoo)
+BSDSTAT_DEFINE_BOUNCE(mwlstatfoo)
 
 struct mwlstatfoo *
 mwlstats_new(const char *ifname, const char *fmtstring)
@@ -549,7 +549,7 @@ mwlstats_new(const char *ifname, const c
 
 	wf = calloc(1, sizeof(struct mwlstatfoo_p));
 	if (wf != NULL) {
-		statfoo_init(&wf->base.base, "mwlstats", mwlstats, N(mwlstats));
+		bsdstat_init(&wf->base.base, "mwlstats", mwlstats, N(mwlstats));
 		/* override base methods */
 		wf->base.base.collect_cur = mwl_collect_cur;
 		wf->base.base.collect_tot = mwl_collect_tot;
@@ -559,7 +559,7 @@ mwlstats_new(const char *ifname, const c
 		wf->base.base.print_verbose = mwl_print_verbose;
 
 		/* setup bounce functions for public methods */
-		STATFOO_BOUNCE(wf, mwlstatfoo);
+		BSDSTAT_BOUNCE(wf, mwlstatfoo);
 
 		/* setup our public methods */
 		wf->base.setifname = mwl_setifname;

Modified: head/tools/tools/mwl/mwlstats/mwlstats.h
==============================================================================
--- head/tools/tools/mwl/mwlstats/mwlstats.h	Thu Mar  6 07:47:19 2014	(r262829)
+++ head/tools/tools/mwl/mwlstats/mwlstats.h	Thu Mar  6 07:48:43 2014	(r262830)
@@ -32,15 +32,15 @@
 #ifndef _MWLSTATS_H_
 #define	_MWLSTATS_H_
 
-#include "statfoo.h"
+#include "bsdstat.h"
 
 /*
  * mv statistics class.
  */
 struct mwlstatfoo {
-	struct statfoo base;
+	struct bsdstat base;
 
-	STATFOO_DECL_METHODS(struct mwlstatfoo *);
+	BSDSTAT_DECL_METHODS(struct mwlstatfoo *);
 
 	/* set the network interface name for collection */
 	void (*setifname)(struct mwlstatfoo *, const char *ifname);



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