From nobody Fri May 3 00:15:51 2024 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 4VVrtc0vNNz5KJwL; Fri, 3 May 2024 00:15:52 +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 4VVrtb6Xj4z4QcX; Fri, 3 May 2024 00:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714695351; 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=A/eFniuHt9wFmUDPsJYOpmTOK4SmFM60Sx0TEulI3eM=; b=pmoE0i0Q8tSRD13qGyVRmWd6HxyhGej1/mSJ9gbYOiSuDNDeswl8+ml8VdMfdeJuxnT9C9 ZfGAwfDQCv9c+YxkPAxwcKPW4IULDcZ9iDPwzFQZ/pzi+2azsP52XggdSAatqhLnP5hh+V Xli0DvMbRwfKb3SMIb2Wedc/ZOOE+TRe6uM4gtfgvu2xeiWDZnBT2I3ra5/7TUMsjslquN vsVPJbD9rBU/g743Nk6LyX3YxFuKhacZAUvs/ZH2uvB0/vSWBz0n6qLuyLupqpZZeRqRsp svYE/d+8vqzd0hCWhQ/dltfq5uVWg7VYpSKkTv8xzr4wUC8nmSKOzbepwp4Orw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714695351; a=rsa-sha256; cv=none; b=sZMcafHBRiXEnfGa8mYlCEefIPN4/tWec1Zgqb/iwdr1NRE80sTS/soovymM+B+1PYPmni 8Nx/Qzf3hwf9JH1lJrJ5reDoi8jYs2ivc48SrOcNoZWBQmVt78e8fahwxza4Pti/8aO1Eh bZ3k7oncUVj145yewPsAtb+SEeaZYf9YzVpTshBOaSoEIKD8z+gbKMmLiPVrSvH4XZmKIE K8SVqwBWonvH08ayrR22uWmO6bvSwZ4b7t1O7iW7O3ltt6KvmsPEWppC3icIyvH0GtZ078 6EQBbIWkPASVcD2qpo8d+FPLNbWCprsVPyZMEHB+PeAnPRkJ9tTPba0W5JsK/Q== 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=1714695351; 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=A/eFniuHt9wFmUDPsJYOpmTOK4SmFM60Sx0TEulI3eM=; b=DfEbwsTNNNshOfj3GlzaNTFQ5ikPslEMV5Ie1GJG1TacDMMfienlMHANv1atWp4Aq8Pzzl OGHyii00eWYa6KTSx7CMzSpB4IDE51Dedjv1bOFRz6j6WE8luStFiLaJYWdUX0Cs4pEfRQ nY76OGwCsz3y0uzBlJU21yF9CA9iqhyiMDIzmBZJzJ+1fIl5aYEjpFrATkQ147iBivEJ6W mIdxw+sUBsvYVIaxqC62/8Hq2ThCuA5EGBV5ElJ60vaXGfjmfL6NqKClW/MZ75/8t1vIEX B4cGW43NkKAiAdMCXMzMhxUE6ASSlH1d43dhO0nIt9idaXnU6knVyYRdW409Ew== 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 4VVrtb690pzP15; Fri, 3 May 2024 00:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4430FpP0079317; Fri, 3 May 2024 00:15:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4430FpbS079314; Fri, 3 May 2024 00:15:51 GMT (envelope-from git) Date: Fri, 3 May 2024 00:15:51 GMT Message-Id: <202405030015.4430FpbS079314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 352cf4a64adf - main - ctl: Avoid an upcast for calling ctl_scsi_path_string 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 352cf4a64adf117a8a0cf23a20b8de4990b2ba22 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=352cf4a64adf117a8a0cf23a20b8de4990b2ba22 commit 352cf4a64adf117a8a0cf23a20b8de4990b2ba22 Author: John Baldwin AuthorDate: 2024-05-02 23:30:20 +0000 Commit: John Baldwin CommitDate: 2024-05-02 23:30:20 +0000 ctl: Avoid an upcast for calling ctl_scsi_path_string Change the first argument of ctl_scsi_path_string to be the embedded header structure instead of the union. Currently union ctl_io and struct ctl_scsiio have the same alignment, but this changes on i386 if a new union member is added that contains a uint64_t member (such as an embedded struct nvme_command for NVMeoF). In that case, union ctl_io requires stronger alignment, so the upcast from struct ctl_scsiio to union ctl_io in ctl_scsi_sense_sbuf raises an increasing alignment warning on i386. Avoid the warning by passing struct ctl_io_hdr as the first argument to ctl_scsi_path_string instead. Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44716 --- sys/cam/ctl/ctl.c | 2 +- sys/cam/ctl/ctl_scsi_all.c | 8 ++++---- sys/cam/ctl/ctl_scsi_all.h | 2 +- sys/cam/ctl/ctl_util.c | 6 +++--- usr.sbin/ctladm/ctladm.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 5230a2694544..6951ed6b229a 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -12837,7 +12837,7 @@ ctl_process_done(union ctl_io *io) char path_str[64]; struct sbuf sb; - ctl_scsi_path_string(io, path_str, sizeof(path_str)); + ctl_scsi_path_string(&io->io_hdr, path_str, sizeof(path_str)); sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN); ctl_io_sbuf(io, &sb); diff --git a/sys/cam/ctl/ctl_scsi_all.c b/sys/cam/ctl/ctl_scsi_all.c index 5c55907cb27c..84fa5656fb5f 100644 --- a/sys/cam/ctl/ctl_scsi_all.c +++ b/sys/cam/ctl/ctl_scsi_all.c @@ -109,12 +109,12 @@ ctl_scsi_command_string(struct ctl_scsiio *ctsio, } void -ctl_scsi_path_string(union ctl_io *io, char *path_str, int len) +ctl_scsi_path_string(struct ctl_io_hdr *hdr, char *path_str, int len) { snprintf(path_str, len, "(%u:%u:%u/%u): ", - io->io_hdr.nexus.initid, io->io_hdr.nexus.targ_port, - io->io_hdr.nexus.targ_lun, io->io_hdr.nexus.targ_mapped_lun); + hdr->nexus.initid, hdr->nexus.targ_port, + hdr->nexus.targ_lun, hdr->nexus.targ_mapped_lun); } /* @@ -130,7 +130,7 @@ ctl_scsi_sense_sbuf(struct ctl_scsiio *ctsio, if ((ctsio == NULL) || (sb == NULL)) return(-1); - ctl_scsi_path_string((union ctl_io *)ctsio, path_str, sizeof(path_str)); + ctl_scsi_path_string(&ctsio->io_hdr, path_str, sizeof(path_str)); if (flags & SSS_FLAG_PRINT_COMMAND) { sbuf_cat(sb, path_str); diff --git a/sys/cam/ctl/ctl_scsi_all.h b/sys/cam/ctl/ctl_scsi_all.h index 5e99acddf01c..ebf69c967978 100644 --- a/sys/cam/ctl/ctl_scsi_all.h +++ b/sys/cam/ctl/ctl_scsi_all.h @@ -43,7 +43,7 @@ int ctl_scsi_command_string(struct ctl_scsiio *ctsio, int ctl_scsi_sense_sbuf(struct ctl_scsiio *ctsio, struct scsi_inquiry_data *inq_data, struct sbuf *sb, scsi_sense_string_flags flags); -void ctl_scsi_path_string(union ctl_io *io, char *path_str, int strlen); +void ctl_scsi_path_string(struct ctl_io_hdr *hdr, char *path_str, int strlen); char *ctl_scsi_sense_string(struct ctl_scsiio *ctsio, struct scsi_inquiry_data *inq_data, char *str, int str_len); diff --git a/sys/cam/ctl/ctl_util.c b/sys/cam/ctl/ctl_util.c index 76f4aff6bb3d..d039e3f6fe6e 100644 --- a/sys/cam/ctl/ctl_util.c +++ b/sys/cam/ctl/ctl_util.c @@ -731,7 +731,7 @@ ctl_io_sbuf(union ctl_io *io, struct sbuf *sb) const char *task_desc; char path_str[64]; - ctl_scsi_path_string(io, path_str, sizeof(path_str)); + ctl_scsi_path_string(&io->io_hdr, path_str, sizeof(path_str)); switch (io->io_hdr.io_type) { case CTL_IO_SCSI: @@ -784,7 +784,7 @@ ctl_io_error_sbuf(union ctl_io *io, struct scsi_inquiry_data *inq_data, } } - ctl_scsi_path_string(io, path_str, sizeof(path_str)); + ctl_scsi_path_string(&io->io_hdr, path_str, sizeof(path_str)); sbuf_cat(sb, path_str); if (status_desc == NULL) @@ -861,7 +861,7 @@ ctl_data_print(union ctl_io *io) return; if (io->scsiio.kern_sg_entries > 0) /* XXX: Implement */ return; - ctl_scsi_path_string(io, path_str, sizeof(path_str)); + ctl_scsi_path_string(&io->io_hdr, path_str, sizeof(path_str)); len = min(io->scsiio.kern_data_len, 4096); for (i = 0; i < len; ) { sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN); diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index 15cbf2d6cd77..d09187735a5a 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -1245,7 +1245,7 @@ cctl_start_stop(int fd, int lun, int iid, int retries, int start, goto bailout; } - ctl_scsi_path_string(io, scsi_path, sizeof(scsi_path)); + ctl_scsi_path_string(&io->io_hdr, scsi_path, sizeof(scsi_path)); if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { fprintf(stdout, "%s LUN %s successfully\n", scsi_path, (start) ? "started" : "stopped"); @@ -1966,7 +1966,7 @@ cctl_get_inquiry(int fd, int lun, int iid, int retries, retval = 1; ctl_io_error_print(io, NULL, stderr); } else if (path_str != NULL) - ctl_scsi_path_string(io, path_str, path_len); + ctl_scsi_path_string(&io->io_hdr, path_str, path_len); bailout: ctl_scsi_free_io(io); @@ -2364,7 +2364,7 @@ cctl_persistent_reserve_out(int fd, int lun, int iid, } if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { char scsi_path[40]; - ctl_scsi_path_string(io, scsi_path, sizeof(scsi_path)); + ctl_scsi_path_string(&io->io_hdr, scsi_path, sizeof(scsi_path)); fprintf( stdout, "%sPERSISTENT RESERVE OUT executed " "successfully\n", scsi_path); } else