NetBSD-Bugs archive

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

bin/59500: mount: absent -v is silent, with -v gives too much noise



>Number:         59500
>Category:       bin
>Synopsis:       mount: absent -v is silent, with -v gives too much noise
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 02 00:55:01 +0000 2025
>Originator:     Greywolf
>Release:        NetBSD 10.1
>Organization:
>Environment:
NetBSD valentina.serenity.starwolf.com 10.1 NetBSD 10.1 (VALENTINA) #3: Sun Jun 29 12:09:29 PDT 2025  root@:/usr/src/sys/arch/amd64/compile/VALENTINA amd64

>Description:
I know "this is the way it has been for years", but...

The output from 'mount -v' gives (what I think is) too much info (read/write/sync stats) in addition to showing what gets mounted.  I would expect the extended info to be provided with additional instances of '-v'.

I have submitted a patch below, done my best not to deviate from the NetBSD style.  This may seem egregious, but if it is not an acceptable patch I should like to know why.

I have a similar one for 'umount' on the way.
>How-To-Repeat:
WHAT I DO:
# mount -v /build

WHAT I EXPECT:
/dev/ld0k on /build type ffs
#

WHAT I GET:
/dev/ld0k on /build type ffs (local, fsid: 0x130a/0x78b, reads: sync 1 async 0, writes: sync 2 async 0)
#
>Fix:
--- mount.c.orig	2025-06-29 13:24:50.474675703 -0700
+++ mount.c	2025-06-29 13:54:58.344278494 -0700
@@ -200,6 +200,7 @@
 					rval = 1;
 			}
 		} else {
+			verbose += verbose? 1: 0;
 			if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
 				err(EXIT_FAILURE, "getmntinfo");
 			for (i = 0; i < mntsize; i++) {
@@ -464,7 +465,7 @@
 	argv[argc++] = name;
 	argv[argc] = NULL;
 
-	if ((verbose && buf == NULL) || debug) {
+	if ((verbose > 1 && buf == NULL) || debug) {
 		(void)printf("exec:");
 		for (i = 0; i < argc; i++)
 			(void)printf(" %s", argv[i]);
@@ -581,6 +582,11 @@
 	    sfp->f_mntonname, (int)sizeof(sfp->f_fstypename),
 	    sfp->f_fstypename);
 
+	if (verbose <= 1) {
+	    (void)printf("\n");
+	    return;
+	}
+
 	flags = sfp->f_flag & MNT_VISFLAGMASK;
 	for (f = 0, o = optnames; flags && o <
 	    &optnames[sizeof(optnames)/sizeof(optnames[0])]; o++)
@@ -600,18 +606,18 @@
 		else
 			(void)printf("%d", sfp->f_owner);
 	}
-	if (verbose)
+	if (verbose > 1)
 		(void)printf("%sfsid: 0x%x/0x%x",
 		    !f++ ? " (" /* ) */: ", ",
 		    sfp->f_fsidx.__fsid_val[0], sfp->f_fsidx.__fsid_val[1]);
 
-	if (verbose) {
+	if (verbose > 1) {
 		(void)printf("%s", !f++ ? " (" : ", ");
 		(void)printf("reads: sync %" PRIu64 " async %" PRIu64 "",
 		    sfp->f_syncreads, sfp->f_asyncreads);
 		(void)printf(", writes: sync %" PRIu64 " async %" PRIu64 "",
 		    sfp->f_syncwrites, sfp->f_asyncwrites);
-		if (verbose > 1) {
+		if (verbose > 2) {
 			char buf[2048];
 
 			if (getmntargs(sfp, buf, sizeof(buf)))



Home | Main Index | Thread Index | Old Index