From owner-svn-src-all@freebsd.org Wed Jul 22 02:14:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8756136E741; Wed, 22 Jul 2020 02:14:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BBJtr2rjQz4XKZ; Wed, 22 Jul 2020 02:14:28 +0000 (UTC) (envelope-from delphij@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 460C9281B1; Wed, 22 Jul 2020 02:14:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06M2ESUh062089; Wed, 22 Jul 2020 02:14:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06M2ESbg062088; Wed, 22 Jul 2020 02:14:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202007220214.06M2ESbg062088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 22 Jul 2020 02:14:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363410 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 363410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2020 02:14:28 -0000 Author: delphij Date: Wed Jul 22 02:14:27 2020 New Revision: 363410 URL: https://svnweb.freebsd.org/changeset/base/363410 Log: gctl_get_class, gctl_get_geom and gctl_get_provider: provide feedback when the requested argument is missing. Reviewed by: cem MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D25738 Modified: head/sys/geom/geom_ctl.c Modified: head/sys/geom/geom_ctl.c ============================================================================== --- head/sys/geom/geom_ctl.c Wed Jul 22 02:09:10 2020 (r363409) +++ head/sys/geom/geom_ctl.c Wed Jul 22 02:14:27 2020 (r363410) @@ -396,12 +396,15 @@ gctl_get_class(struct gctl_req *req, char const *arg) struct g_class *cp; p = gctl_get_asciiparam(req, arg); - if (p == NULL) + if (p == NULL) { + gctl_error(req, "Missing %s argument", arg); return (NULL); + } LIST_FOREACH(cp, &g_classes, class) { if (!strcmp(p, cp->name)) return (cp); } + gctl_error(req, "Class not found: \"%s\"", p); return (NULL); } @@ -413,8 +416,10 @@ gctl_get_geom(struct gctl_req *req, struct g_class *mp struct g_geom *gp; p = gctl_get_asciiparam(req, arg); - if (p == NULL) + if (p == NULL) { + gctl_error(req, "Missing %s argument", arg); return (NULL); + } LIST_FOREACH(mp, &g_classes, class) { if (mpr != NULL && mpr != mp) continue; @@ -434,8 +439,10 @@ gctl_get_provider(struct gctl_req *req, char const *ar struct g_provider *pp; p = gctl_get_asciiparam(req, arg); - if (p == NULL) + if (p == NULL) { + gctl_error(req, "Missing '%s' argument", arg); return (NULL); + } pp = g_provider_by_name(p); if (pp != NULL) return (pp); @@ -453,10 +460,8 @@ g_ctl_req(void *arg, int flag __unused) g_topology_assert(); req = arg; mp = gctl_get_class(req, "class"); - if (mp == NULL) { - gctl_error(req, "Class not found"); + if (mp == NULL) return; - } if (mp->ctlreq == NULL) { gctl_error(req, "Class takes no requests"); return;