From nobody Mon Jun 19 20:47:08 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QlMJX5gpCz4fkDV; Mon, 19 Jun 2023 20:47:08 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QlMJX4Jmyz4Rh7; Mon, 19 Jun 2023 20:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687207628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXwJzJFMhlWmXiDbs/LCzkd+vZSSfP+R1ha80r3SoHs=; b=S8NaPKJJQEJZVQGAAdxnPeKCCsTf/EHQK10oWVDe+4zwOnTASuyfQul8PlFtvAN9jUpZL3 UMt4wLrutoP9m7rDwSQpD17CQLiyCIBkhzcSuLz+LNDShtjYvLoFyfLV9AaTbYM44rIKPK 1S41h5dniL/7EQbduEDLSIPVMl6HiMyYU4H4GnR63uGO/dCsPCpTmYe/Y8qzmxhGVPAIud 3cX+x4UQKFrDQC86D/DDvR6WhnnKkI4SiEpY/K3d4WExi+6eUttvF31auc/QcPBA8CyQ11 jvWJQeeYttUpUYiUkTkDpwu03rJfrmnXH1P/G1GBDXziePFNgV5aMkjDmiywSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687207628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXwJzJFMhlWmXiDbs/LCzkd+vZSSfP+R1ha80r3SoHs=; b=sczhJK7VrzOMeaHZ0MZB55HynTG8OIWxX6mpakWib8QWfQAIdM1kLtLE/xd6lUJXcLz/aw ByrGWsgTvMv835ffMpqmfvP/d3Y5pkTTcWdGDQCsI/agZzRY3vgeFK6rszG8ed33jDVjLu jpBjuBrdBrO5rAj2/35qT7jVn0msw9HuCaIsHk2tyiy3B5J6FKO6hq+CJNVIsLFhwWLx8O Tu57/9Q+nH9Eg9UnAn2K6gmozapKdhdS72RQTq9S0MuwSgB0LD1EKkJRQAKlz1A4D6Qr5p 6DbQ0FLDYH1v3GaOQbe8tEEg0zHpd5mbOCLcwoqD2sbpu4y/fnz28itNLOCpCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687207628; a=rsa-sha256; cv=none; b=yhZxfz+ZmU+GXF8z1cunyFVo72ZBH80i04sAd4fjw68YijEjDsdKdxhSusxoiDJwUZS/Fn 1XsrKa7Mk7qBo743ESOf32WTYjYcvOLi24uhvYxPRvhI8OgAjrEh0wtKRo5FfU2StFdcC4 SoAWHqlrJpalyLf5SH1hkrXrSr5GLAdhq+RdWBX72P8wj37es71/NEWX2lhrO2W0SFIOa4 JiiqRe+zBWTijJW1nYMRNtvArNN2MPZsMay00Lf8puXxEFwvRS0bRvkHdstxBIN8eUdjwe 5HF5QvVDsUo4Auh1hWyHIKHtGjALWcvKw0xII592Tcq5YQsDbEGC8ajC8n8lbw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QlMJX3DJwzX3Z; Mon, 19 Jun 2023 20:47:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35JKl8Us095763; Mon, 19 Jun 2023 20:47:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35JKl8Tc095762; Mon, 19 Jun 2023 20:47:08 GMT (envelope-from git) Date: Mon, 19 Jun 2023 20:47:08 GMT Message-Id: <202306192047.35JKl8Tc095762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 2e105b61e98d - main - camcontrol: simplify summary logic for defects List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e105b61e98d976045f0ec042cfcb5d45504bde0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2e105b61e98d976045f0ec042cfcb5d45504bde0 commit 2e105b61e98d976045f0ec042cfcb5d45504bde0 Author: Warner Losh AuthorDate: 2023-06-19 20:43:30 +0000 Commit: Warner Losh CommitDate: 2023-06-19 20:45:43 +0000 camcontrol: simplify summary logic for defects We don't need to count the number of lists requested. Instead, use the more general form of checking to see if any of the non-defect format bits are set. Also, check summary boolean to control summary reporting behavior. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D40524 --- sbin/camcontrol/camcontrol.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 487d0d64a969..45b769589da8 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -3837,7 +3837,7 @@ readdefects(struct cam_device *device, int argc, char **argv, u_int8_t returned_format, returned_type; unsigned int i; int c, error = 0; - int mads = 0, lists_specified = 0; + int mads = 0; bool summary = false, quiet = false, list_type_set = false; bool get_length = true, use_12byte = false, first_pass = true; bool hex_format = false; @@ -3876,11 +3876,9 @@ readdefects(struct cam_device *device, int argc, char **argv, } case 'G': list_format |= SRDD10_GLIST; - lists_specified++; break; case 'P': list_format |= SRDD10_PLIST; - lists_specified++; break; case 'q': quiet = true; @@ -3916,7 +3914,7 @@ readdefects(struct cam_device *device, int argc, char **argv, /* * This implies a summary, and was the previous behavior. */ - if (lists_specified == 0) + if ((list_format & ~SRDD10_DLIST_FORMAT_MASK) == 0) summary = true; ccb = cam_getccb(device); @@ -4215,7 +4213,7 @@ next_batch: if (first_pass) { fprintf(stderr, "Got %d defect", num_returned); - if ((lists_specified == 0) || (num_returned == 0)) { + if (!summary || (num_returned == 0)) { fprintf(stderr, "s.\n"); goto defect_bailout; } else if (num_returned == 1)