From owner-svn-src-head@freebsd.org Tue Sep 11 16:46:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1210E10967AC; Tue, 11 Sep 2018 16:46:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B9BFA7F12A; Tue, 11 Sep 2018 16:46:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4BF71A6B9; Tue, 11 Sep 2018 16:46:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8BGkS4g033022; Tue, 11 Sep 2018 16:46:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8BGkSFX033021; Tue, 11 Sep 2018 16:46:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201809111646.w8BGkSFX033021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 11 Sep 2018 16:46:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338589 - head/sbin/geom/core X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sbin/geom/core X-SVN-Commit-Revision: 338589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2018 16:46:29 -0000 Author: trasz Date: Tue Sep 11 16:46:28 2018 New Revision: 338589 URL: https://svnweb.freebsd.org/changeset/base/338589 Log: Minor usability improvements to geom(8). Approved by: re (kib) MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/sbin/geom/core/geom.c Modified: head/sbin/geom/core/geom.c ============================================================================== --- head/sbin/geom/core/geom.c Tue Sep 11 15:56:06 2018 (r338588) +++ head/sbin/geom/core/geom.c Tue Sep 11 16:46:28 2018 (r338589) @@ -145,8 +145,8 @@ usage(void) { if (class_name == NULL) { - errx(EXIT_FAILURE, "usage: %s [options]", - "geom"); + fprintf(stderr, "usage: geom [options]\n"); + exit(EXIT_FAILURE); } else { struct g_command *cmd; const char *prefix; @@ -191,8 +191,7 @@ load_module(void) /* Not present in kernel, try loading it. */ if (kldload(name2) < 0 || modfind(name1) < 0) { if (errno != EEXIST) { - errx(EXIT_FAILURE, - "%s module not available!", name2); + err(EXIT_FAILURE, "cannot load %s", name2); } } } @@ -460,7 +459,8 @@ run_command(int argc, char *argv[]) usage(); } if (!std_available(cmd->gc_name)) { - warnx("Command '%s' not available.", argv[0]); + warnx("Command '%s' not available; " + "try 'load' first.", argv[0]); exit(EXIT_FAILURE); } } @@ -644,7 +644,7 @@ get_class(int *argc, char ***argv) /* If we can't load or list, it's not a class. */ if (!std_available("load") && !std_available("list")) - errx(EXIT_FAILURE, "Invalid class name."); + errx(EXIT_FAILURE, "Invalid class name '%s'.", class_name); if (*argc < 1) usage(); @@ -806,7 +806,7 @@ std_list(struct gctl_req *req, unsigned flags __unused classp = find_class(&mesh, gclass_name); if (classp == NULL) { geom_deletetree(&mesh); - errx(EXIT_FAILURE, "Class %s not found.", gclass_name); + errx(EXIT_FAILURE, "Class '%s' not found.", gclass_name); } nargs = gctl_get_int(req, "nargs"); all = gctl_get_int(req, "all"); @@ -814,8 +814,11 @@ std_list(struct gctl_req *req, unsigned flags __unused for (i = 0; i < nargs; i++) { name = gctl_get_ascii(req, "arg%d", i); gp = find_geom(classp, name); - if (gp == NULL) - errx(EXIT_FAILURE, "No such geom: %s.", name); + if (gp == NULL) { + errx(EXIT_FAILURE, "Class '%s' does not have " + "an instance named '%s'.", + gclass_name, name); + } list_one_geom(gp); } } else {