git: 17af098383ba - main - Revert "virtual_oss(8): Fix cuse.ko check"

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Fri, 18 Sep 2026 18:58:26 UTC
The branch main has been updated by christos:

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

commit 17af098383ba18497610c77239a406c2f9bd02b1
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-09-18 18:56:59 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-09-18 18:56:59 +0000

    Revert "virtual_oss(8): Fix cuse.ko check"
    
    parse_options() was moved above cuse_init(), which makes every single
    regular virtual_oss invocation which uses cuse_dev_create() fail.
    
    This reverts commit f014795ec3bd5efb88dfc249599e9665dc10a59e.
---
 usr.sbin/virtual_oss/virtual_oss/main.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c
index 41658d0af325..1b03e2c8cf37 100644
--- a/usr.sbin/virtual_oss/virtual_oss/main.c
+++ b/usr.sbin/virtual_oss/virtual_oss/main.c
@@ -2564,7 +2564,6 @@ int
 main(int argc, char **argv)
 {
 	const char *ptrerr;
-	const char *cuse_mod = "cuse.ko";
 	struct sigaction sa;
 	struct cuse_dev *pdev = NULL;
 	struct virtual_profile *pvp;
@@ -2584,17 +2583,9 @@ main(int argc, char **argv)
 
 	atomic_init();
 
-	ptrerr = parse_options(argc, argv, 1);
-	if (ptrerr != NULL)
-		errx(EX_USAGE, "%s", ptrerr);
-
-	if (kldfind(cuse_mod) < 0 && errno == ENOENT) {
-		/* module is not loaded */
-		if (kldload(cuse_mod) < 0 && errno != EEXIST)
-			err(1, "Failed to load cuse kernel module");
-	}
+	if (kldload("cuse.ko") < 0 && errno != EEXIST)
+		err(1, "Failed to load cuse kernel module");
 
-	/* cuse is loaded, initialize it */
 	if (cuse_init() != 0)
 		errx(EX_USAGE, "Could not connect to cuse module");
 
@@ -2608,6 +2599,9 @@ main(int argc, char **argv)
 	if (sigaction(SIGTERM, &sa, NULL) < 0)
 		err(1, "sigaction(SIGTERM)");
 
+	ptrerr = parse_options(argc, argv, 1);
+	if (ptrerr != NULL)
+		errx(EX_USAGE, "%s", ptrerr);
 
 	if (voss_dsp_rx_device[0] == 0 || voss_dsp_tx_device[0] == 0)
 		errx(EX_USAGE, "Missing -f argument");