All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs-utils - 4 of 6 - nfsstat - removed needless warning
@ 2003-06-18 18:00 Steve Dickson
  2003-07-02  6:52 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Dickson @ 2003-06-18 18:00 UTC (permalink / raw)
  To: nfs

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

Reworked the diagnostics of nfsstat so warnings
are not displayed for statistics that are not
asked for and don't exist.

SteveD.


[-- Attachment #2: nfs-utils-1.0.3-04-nfsstat-gooddiags.patch --]
[-- Type: text/plain, Size: 1327 bytes --]

--- nfs-utils-1.0.1/utils/nfsstat/nfsstat.c.org	2002-05-05 19:33:30.000000000 -0400
+++ nfs-utils-1.0.1/utils/nfsstat/nfsstat.c	2003-01-07 16:01:02.000000000 -0500
@@ -124,6 +124,8 @@
 	int		opt_all = 0,
 			opt_srv = 0,
 			opt_clt = 0,
+			srv_info = 0,
+			clt_info = 0,
 			opt_prt = 0;
 	int		c;
 
@@ -184,9 +186,25 @@
 			"server.\n");
 	}
 
-	if ((opt_srv && !parse_statfile(NFSSVCSTAT, svcinfo))
-	 || (opt_clt && !parse_statfile(NFSCLTSTAT, cltinfo)))
-		return 2;
+	if (opt_srv) {
+		srv_info = parse_statfile(NFSSVCSTAT, svcinfo);
+		if (srv_info == 0 && opt_clt == 0) {
+			fprintf(stderr, "Warning: No Server Stats (%s: %m).\n", NFSSVCSTAT);
+			return 2;
+		}
+		if (srv_info == 0)
+			opt_srv = 0;
+	}
+
+	if (opt_clt) {
+		clt_info = parse_statfile(NFSCLTSTAT, cltinfo);
+		if (opt_srv == 0 && clt_info == 0) {
+			fprintf(stderr, "Warning: No Client Stats (%s: %m).\n", NFSCLTSTAT);
+			return 2;
+		}
+		if (clt_info == 0)
+			opt_clt = 0;
+	}
 
 	if (opt_srv) {
 		if (opt_prt & PRNT_NET) {
@@ -338,8 +356,8 @@
 	 * be a fatal error -- it usually means the module isn't loaded.
 	 */
 	if ((fp = fopen(name, "r")) == NULL) {
-		fprintf(stderr, "Warning: %s: %m\n", name);
-		return 1;
+		// fprintf(stderr, "Warning: %s: %m\n", name);
+		return 0;
 	}
 
 	while (fgets(buffer, sizeof(buffer), fp) != NULL) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfs-utils - 4 of 6 - nfsstat - removed needless warning
  2003-06-18 18:00 [PATCH] nfs-utils - 4 of 6 - nfsstat - removed needless warning Steve Dickson
@ 2003-07-02  6:52 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2003-07-02  6:52 UTC (permalink / raw)
  To: Steve Dickson; +Cc: nfs

On Wednesday June 18, SteveD@redhat.com wrote:
> Reworked the diagnostics of nfsstat so warnings
> are not displayed for statistics that are not
> asked for and don't exist.
> 

I've committed this and the two mountd patches to CVS.

NeilBrown


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-02  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-18 18:00 [PATCH] nfs-utils - 4 of 6 - nfsstat - removed needless warning Steve Dickson
2003-07-02  6:52 ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.