Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Oct 2010 22:56:42 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        freebsd-geom@freebsd.org
Subject:   improvement to 'geom class load' error output
Message-ID:  <20101023225642.GA63520@freebsd.org>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
hi there,

this patch will improve the error output when 'geom class load' fails. right
now the output for every failure is:

"geom: geom_zero module not available!"

with the patch geom will output the following if EPERM has been returned:

"geom: Could not load module: Operation not permitted."

the only "problem" with the patch is that errno is either being set by
kldload(2) or modfind(2). from the output users cannot device whether
kldload(2) or modfind(2) failed.

with this patch the output of 'geom class load' should very much equal
the one from 'geom class unload'.

cheers.
alex

-- 
a13x

[-- Attachment #2 --]
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 0a583ef..8321684 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -184,7 +184,8 @@ load_module(void)
 		if (kldload(name2) < 0 || modfind(name1) < 0) {
 			if (errno != EEXIST) {
 				errx(EXIT_FAILURE,
-				    "%s module not available!", name2);
+				    "Could not load module: %s.",
+				    strerror(errno));
 			}
 		}
 	}

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101023225642.GA63520>