From owner-freebsd-geom@FreeBSD.ORG Sat Oct 23 22:56:42 2010 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 130501065670; Sat, 23 Oct 2010 22:56:42 +0000 (UTC) Date: Sat, 23 Oct 2010 22:56:42 +0000 From: Alexander Best To: freebsd-geom@freebsd.org Message-ID: <20101023225642.GA63520@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline Subject: improvement to 'geom class load' error output X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Oct 2010 22:56:42 -0000 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="geom.c.diff" 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)); } } } --2fHTh5uZTiUOsy+g--