improvement to 'geom class load' error output

Alexander Best arundel at freebsd.org
Sat Oct 23 22:56:42 UTC 2010


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
-------------- next part --------------
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));
 			}
 		}
 	}


More information about the freebsd-geom mailing list