From nobody Tue Aug 27 18:07:14 2024 X-Original-To: dev-commits-src-branches@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 4Wtb9G2jBgz52ZNV; Tue, 27 Aug 2024 18:07:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wtb9G1BM4z4ZGs; Tue, 27 Aug 2024 18:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724782034; 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=pu3ws5pD2Ey3EEy0IHDI6WpbJMJIDI9xe7x5FkZY0Bs=; b=HExHqyZ9iwNh7BUJ3BKJEgPN0q56EEyEknwSJ28ZGuQaWgE5aBM/5UdFfdqwTQbizqRoxW j7maBrKj1P0cDZQXhgpbkaAsocI/tl49mMEreD/2nh5/GCRGqTmC5u0t9sUBA2KhGr9kek wWo+VDDKselqeazjR76UD+8/OSXTJEor9lyaBl23i/IpJrnCbpdibRs+R33W9HSD6PuwHt MvVMpZtrKLDdenhNhoV5ypab/4WN3TXvimfyr9J0+fq9cGgr1fbvAL0pTJra2XFXQ2GMBJ 4wghqWXQsmaXbzniwNpzxuoBHOfkB9a21N73u/zXvt4F92gwiA4PAtUH8tZodw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724782034; a=rsa-sha256; cv=none; b=FtmTqsNUoqTYHKPQAE25jtKkiiB36LhxScWBbguBcTYHa6I70802vJFw8qCWViHKFzSzVL hqkjtJcY88LaIifhco/WBWWTcIGW/HG6sk6hhc5Hg2+F3xhY9fKmpmjzFy0oQskd6JEaPx QMxLt63kPOMapSbNzU2lPM4IeQrIoPs+3hqKQ1InbFY/MG0K71+SklpG3slS8/UR/a96Xu wnNwgJHkyE88RkpovB1AD+WcfvARHDwf+pNYkiNT+MDmBj9PjWzDhXQjy0vYP49SI3dgkm z7quavSq/FFgqgeqqp2VUCOUZMG+E57HndZrir1sHvYVsJy+mn/nCLe7+zATkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724782034; 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=pu3ws5pD2Ey3EEy0IHDI6WpbJMJIDI9xe7x5FkZY0Bs=; b=DLnwQjgScfHqQZnI9y86z3+uIXRXAbQoUUcWpxGRoHcIIKqKjZRAmeJhq04CYIYrjh5BxM UWhLRP4b3pmCA82gjmw0WVHBz5tr2HXSV71hnLvdHlIpkRTnBFIOXYp/F6zJIovFlykVej aL2nNHsL30a12Ujd0L1vpXOVhmLuaZ1/aBjQyRR++gFkek44V7qkN34AAvNydY9P/PcvoQ +mxmx7N7++KwYDMFbkcl8hxlSYBKHGXMimlzzpDdrkRHYb2OHiuefjxAW+SU1axUWbLSkz UkebXhyamxgjW6FIqd2HbtCwReq5kfTjhIrUtpqRw+1x5+w3QR2P7SlkO9rE7A== 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 4Wtb9G0lpjz10Tg; Tue, 27 Aug 2024 18:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47RI7EQr093990; Tue, 27 Aug 2024 18:07:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47RI7E55093987; Tue, 27 Aug 2024 18:07:14 GMT (envelope-from git) Date: Tue, 27 Aug 2024 18:07:14 GMT Message-Id: <202408271807.47RI7E55093987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 169c76b9b65f - stable/14 - camcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 169c76b9b65f97043af32058a86ceda8da4375fe Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=169c76b9b65f97043af32058a86ceda8da4375fe commit 169c76b9b65f97043af32058a86ceda8da4375fe Author: Elyes Haouas AuthorDate: 2023-11-07 17:37:33 +0000 Commit: John Baldwin CommitDate: 2024-08-27 16:35:34 +0000 camcontrol: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas (cherry picked from commit 7028e630d6110789502cfc0f17b36b6f513ec297) --- sbin/camcontrol/attrib.c | 4 ++-- sbin/camcontrol/epc.c | 11 +++++------ sbin/camcontrol/zone.c | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sbin/camcontrol/attrib.c b/sbin/camcontrol/attrib.c index 7e89dbc3d48e..4cf9832756b4 100644 --- a/sbin/camcontrol/attrib.c +++ b/sbin/camcontrol/attrib.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -265,7 +265,7 @@ scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt, int entry_num = 0; status = scsi_get_nv(elem_type_map, - sizeof(elem_type_map) / sizeof(elem_type_map[0]), + nitems(elem_type_map), optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); if (status == SCSI_NV_FOUND) element_type = elem_type_map[entry_num].value; diff --git a/sbin/camcontrol/epc.c b/sbin/camcontrol/epc.c index 206b34594f4f..4273ad19047c 100644 --- a/sbin/camcontrol/epc.c +++ b/sbin/camcontrol/epc.c @@ -33,10 +33,9 @@ * ATA Extended Power Conditions (EPC) support */ -#include +#include #include #include -#include #include #include #include @@ -151,7 +150,7 @@ epc_print_pcl_desc(struct ata_power_cond_log_desc *desc, const char *prefix) max_chars = 75; num_printed = printf("%sFlags: ", prefix); - for (i = 0; i < (sizeof(epc_flags) / sizeof(epc_flags[0])); i++) { + for (i = 0; i < nitems(epc_flags); i++) { if ((desc->flags & epc_flags[i].value) == 0) continue; if (first == 0) { @@ -466,7 +465,7 @@ check_power_mode: } mode_name = scsi_nv_to_str(epc_power_cond_map, - sizeof(epc_power_cond_map) / sizeof(epc_power_cond_map[0]), count); + nitems(epc_power_cond_map), count); printf("Current power state: "); /* Note: ident can be null in power_only mode */ if ((ident == NULL) @@ -638,7 +637,7 @@ epc(struct cam_device *device, int argc, char **argv, char *combinedopt, int entry_num; status = scsi_get_nv(epc_cmd_map, - (sizeof(epc_cmd_map) / sizeof(epc_cmd_map[0])), + nitems(epc_cmd_map), optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); if (status == SCSI_NV_FOUND) action = epc_cmd_map[entry_num].value; @@ -715,7 +714,7 @@ epc(struct cam_device *device, int argc, char **argv, char *combinedopt, int entry_num; status = scsi_get_nv(epc_ps_map, - (sizeof(epc_ps_map) / sizeof(epc_ps_map[0])), + nitems(epc_ps_map), optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); if (status == SCSI_NV_FOUND) power_src = epc_ps_map[entry_num].value; diff --git a/sbin/camcontrol/zone.c b/sbin/camcontrol/zone.c index d651ca0e2acf..dc87cd9a9570 100644 --- a/sbin/camcontrol/zone.c +++ b/sbin/camcontrol/zone.c @@ -34,10 +34,9 @@ * This is an implementation of the SCSI ZBC and ATA ZAC specs. */ -#include +#include #include #include -#include #include #include #include @@ -353,7 +352,7 @@ zone(struct cam_device *device, int argc, char **argv, char *combinedopt, int entry_num; status = scsi_get_nv(zone_cmd_map, - (sizeof(zone_cmd_map) / sizeof(zone_cmd_map[0])), + nitems(zone_cmd_map), optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); if (status == SCSI_NV_FOUND) action = zone_cmd_map[entry_num].value; @@ -387,7 +386,7 @@ zone(struct cam_device *device, int argc, char **argv, char *combinedopt, int entry_num; status = scsi_get_nv(zone_rep_opts, - (sizeof(zone_rep_opts) /sizeof(zone_rep_opts[0])), + nitems(zone_rep_opts), optarg, &entry_num, SCSI_NV_FLAG_IG_CASE); if (status == SCSI_NV_FOUND) rep_option = zone_rep_opts[entry_num].value;