git: e6925175174b - main - Handle MODULE_VERBOSE_TWIDDLE in module_verbose_set

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Thu, 24 Feb 2022 05:26:48 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6925175174b1a7d7b5aef035ec684b2d5f628b9

commit e6925175174b1a7d7b5aef035ec684b2d5f628b9
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2022-02-24 05:26:41 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2022-02-24 05:26:41 +0000

    Handle MODULE_VERBOSE_TWIDDLE in module_verbose_set
    
    If module_verbose is set to a value below MODULE_VERBOSE_TWIDDLE
    call twiddle_divisor(UINT_MAX).
    
    This makes more sense here than when we are loading the kernel.
    
    Sponsored by:   Juniper Networks, Inc.
---
 stand/common/console.c  | 5 +++++
 stand/common/load_elf.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/stand/common/console.c b/stand/common/console.c
index 08d0dc40e3a9..0e8afb477ee8 100644
--- a/stand/common/console.c
+++ b/stand/common/console.c
@@ -27,6 +27,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include <sys/param.h>
 #include <stand.h>
 #include <string.h>
 
@@ -58,6 +59,10 @@ module_verbose_set(struct env_var *ev, int flags, const void *value)
 		return (CMD_ERROR);
 	}
 	module_verbose = (int)v;
+	if (module_verbose < MODULE_VERBOSE_TWIDDLE) {
+		/* A hack for now; we do not want twiddling */
+		twiddle_divisor(UINT_MAX);
+	}
 	env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
 
 	return (CMD_OK);
diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c
index 62df96aa2ebc..4a6c1d5f4e7f 100644
--- a/stand/common/load_elf.c
+++ b/stand/common/load_elf.c
@@ -470,11 +470,6 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest,
 	} else if (module_verbose > MODULE_VERBOSE_SILENT)
 		printf("%s ", filename);
 
-	if (module_verbose < MODULE_VERBOSE_TWIDDLE) {
-		/* A hack for now; we do not want twiddling */
-		twiddle_divisor(UINT_MAX);
-	}
-
 	fp->f_size = __elfN(loadimage)(fp, &ef, dest);
 	if (fp->f_size == 0 || fp->f_addr == 0)
 		goto ioerr;