From nobody Mon Jun 19 20:47:07 2023 X-Original-To: dev-commits-src-main@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 4QlMJW5jy7z4fjxq; Mon, 19 Jun 2023 20:47:07 +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 4QlMJW3kVsz4RLD; Mon, 19 Jun 2023 20:47:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687207627; 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=ZMpbD7Y01qIKNGUg1BnAF79OLEXu1+I9/STn04eR2BY=; b=LNEMqF5ot1f9ZFcxe/9H0WyOXFneNfVM2Rq7j2dtIAa8RKSDF1vRt1ejt80NM2PgiqhCpC ZkfmhdkzHhTuxAnzoMm13JgFsElCbtIH9krCOu+ZW+yGzG8/8aHY2BefIqDJX8xIEh1k5N 3v8V9+B1oSjVhWNjEbVY1KGUlrkPiTWTkh6o6aUYLuobFcVeWC9KHs1p65hKFKJi832pse ob9P/QqO/Ai4BsbrU4yo9dU3ozToMCfDO6lrCLveJy3SQFYkdUk55scQ6ThvzQJur2VfWH eej4xIVe8jJDBe0LfQp33sPBCRIrlCFkmAd79CjMdyoZKKB49ZkbPDIo4kikYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687207627; 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=ZMpbD7Y01qIKNGUg1BnAF79OLEXu1+I9/STn04eR2BY=; b=Jxe8qlrNLvAdrju5/XaKeaxsu2v5pF2dm013lqr67pdGX8DKnz2vmR87wsrui/wtMzVwl4 kPCOe9bUW7Lg0ZyO8l7iq3RPiLauOc+7rXJZ4c0mxi4uEIgHfwOC2EmZKydxmGnOU+LQa6 /9iA2rXvxhh3vNDtr1r8MGpKzS37e4h+i0kQFzG3Eo+Jfo73bkgpU9zh3EMqsVBg0Uy6kI MABl0g8D39b9TtpJg3IxKmedoQKFJWkyAKuO9fSRVbZt4VXKGlAwEgHxwKgjTGlppM0VLA dFeYWrsNwI7j3t/ewJJPVfgmYUwP4IdN43R0zj4YXjK+jkTCmPEnXNhtDJlPSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687207627; a=rsa-sha256; cv=none; b=SuvSd8pzmRsIgUVMNfd/Pd5GHVHIjyU62eA4jvAbXf/hUfizfyuYZbwSb5y1Rq0w4N6Gb4 RKMr5OdIVRF0aqh0r/wHC+QD5WBeCbW16P/xT67RO8PExGilASrEVLqagfOKzIJt+ntcms P4AoHoHl33qfXlX5YeUB92AtlxB6O0D9Vpu7exSEE1YZLWVhPTXpIU6n5YeQGyWSlztBzO Z2PG0+/0n2Cstu55SBXw1upnSaFGsWGe1+/9D0VnHCKBNKr7Nqd+S8aABNXO4XrEqanvpt Ag+dqwy25E1BSTA552d/McupaRGOPDTcC5rekG2ph1sH54Fb2TgxfC62CQ+S3g== 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 4QlMJW2CvrzX3Y; Mon, 19 Jun 2023 20:47:07 +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 35JKl775095737; Mon, 19 Jun 2023 20:47:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35JKl795095736; Mon, 19 Jun 2023 20:47:07 GMT (envelope-from git) Date: Mon, 19 Jun 2023 20:47:07 GMT Message-Id: <202306192047.35JKl795095736@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: f20d86e17143 - main - camcontrol: No need to set CAM_ARG_[PG]LIST in defects List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: f20d86e1714365ae4d098d101aac302a3572eb1d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f20d86e1714365ae4d098d101aac302a3572eb1d commit f20d86e1714365ae4d098d101aac302a3572eb1d Author: Warner Losh AuthorDate: 2023-06-19 20:43:12 +0000 Commit: Warner Losh CommitDate: 2023-06-19 20:45:43 +0000 camcontrol: No need to set CAM_ARG_[PG]LIST in defects We can or in the the list_format bits directly if we or in the list_format when we look it up the first time. Free up CAM_ARG_[PG]LIST from the CAM_ARG_xxx enum. Sponsored by: Netflix Reviewed by: mav (I made his suggested change) Differential Revision: https://reviews.freebsd.org/D40523 --- sbin/camcontrol/camcontrol.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index c059d64652c5..487d0d64a969 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -126,8 +126,8 @@ typedef enum { /* unused 0x00000080 */ /* unused 0x00000100 */ /* unused 0x00000200 */ - CAM_ARG_PLIST = 0x00000400, - CAM_ARG_GLIST = 0x00000800, + /* unused 0x00000400 */ + /* unused 0x00000800 */ CAM_ARG_GET_SERIAL = 0x00001000, CAM_ARG_GET_STDINQ = 0x00002000, CAM_ARG_GET_XFERRATE = 0x00004000, @@ -3849,13 +3849,19 @@ readdefects(struct cam_device *device, int argc, char **argv, scsi_nv_status status; int entry_num = 0; + if (list_type_set) { + warnx("%s: -f specified twice", __func__); + error = 1; + goto defect_bailout; + } + status = scsi_get_nv(defect_list_type_map, sizeof(defect_list_type_map) / sizeof(defect_list_type_map[0]), optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); if (status == SCSI_NV_FOUND) { - list_format = defect_list_type_map[ + list_format |= defect_list_type_map[ entry_num].value; list_type_set = true; } else { @@ -3869,10 +3875,12 @@ readdefects(struct cam_device *device, int argc, char **argv, break; } case 'G': - arglist |= CAM_ARG_GLIST; + list_format |= SRDD10_GLIST; + lists_specified++; break; case 'P': - arglist |= CAM_ARG_PLIST; + list_format |= SRDD10_PLIST; + lists_specified++; break; case 'q': quiet = true; @@ -3905,16 +3913,6 @@ readdefects(struct cam_device *device, int argc, char **argv, goto defect_bailout; } - if (arglist & CAM_ARG_PLIST) { - list_format |= SRDD10_PLIST; - lists_specified++; - } - - if (arglist & CAM_ARG_GLIST) { - list_format |= SRDD10_GLIST; - lists_specified++; - } - /* * This implies a summary, and was the previous behavior. */