NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/59494: mount -v too chatty/messy



The following reply was made to PR bin/59494; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: greywolf%valentina.serenity.starwolf.com@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/59494: mount -v too chatty/messy
Date: Tue, 01 Jul 2025 06:24:26 +0700

 I agree that something between silence and everything is probably
 a good idea.
 
 I plan on fixing this, but in a slightly less invasive way than was
 suggested, but I believe with the same effect.
 
 Here's the patch I am intending upon (somethng like, should anyone
 want to test it) - so far this has not been near a compiler even!
 
 kre
 
 
 Index: mount.c
 ===================================================================
 RCS file: /cvsroot/src/sbin/mount/mount.c,v
 retrieving revision 1.107
 diff -u -r1.107 mount.c
 --- mount.c	7 Dec 2021 14:31:13 -0000	1.107
 +++ mount.c	30 Jun 2025 23:21:45 -0000
 @@ -69,7 +69,7 @@
  #include "pathnames.h"
  #include "mountprog.h"
  
 -static int	debug, verbose;
 +static int	debug, verbose, noise;
  
  static void	catopt(char **, const char *);
  static const char *
 @@ -170,6 +170,12 @@
  	(strcmp(type, FSTAB_RO) &&					\
  	    strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ))
  
 +	noise = 0;
 +	if (argc > 0 && verbose) {
 +		noise = 1;
 +		verbose--;
 +	}
 +
  	rval = 0;
  	switch (argc) {
  	case 0:
 @@ -419,7 +425,7 @@
  			 */
  			if (strncmp(name, sfp[i].f_mntonname, MNAMELEN) == 0 &&
  			    strncmp(vfstype, mountedtype, cmplen) == 0) {
 -				if (verbose)
 +				if (noise || verbose)
  					(void)printf("%s on %s type %.*s: "
  					    "%s\n",
  					    sfp[i].f_mntfromname,
 @@ -555,7 +561,7 @@
  		}
  
  		if (buf == NULL) {
 -			if (verbose) {
 +			if (verbose || noise) {
  				if (statvfs(name, &sf) == -1) {
  					warn("statvfs %s", name);
  					return 1;
 


Home | Main Index | Thread Index | Old Index