Received: by mail.netbsd.org (Postfix, from userid 605) id 6F8B384D37; Wed, 26 May 2021 06:11:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 9C5B984D21 for ; Wed, 26 May 2021 06:11:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id fDM977fEhDvN for ; Wed, 26 May 2021 06:11:51 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id E45BC84D1F for ; Wed, 26 May 2021 06:11:50 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id CF34AFA95; Wed, 26 May 2021 06:11:50 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Wed, 26 May 2021 06:11:50 +0000 From: "matthew green" Subject: CVS commit: src/sys/dev/raidframe To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20210526061150.CF34AFA95@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "matthew green" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: mrg Date: Wed May 26 06:11:50 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_compat80.c rf_driver.c rf_netbsdkintf.c Log Message: support different endian raidframe component label. there are two on-disk formats in use in raidframe: - the component label - the parity map the parity map is a bitmap implemented as bytes, so it has no endian issue. the component label is the problem, as most of the fields are 32 bit. this change only supports version 2 of raidframe (active since the year 2000.) as component labels are read and used before a raidPtr for the raid set has been created, there is no obvious storage for the swapped indicator, so the in-core version remains the on-disk version, while the rest of in-core label is swapped. in raidread_component_label() and raidwrite_component_label(), check if the swapped version, and if so, call new rf_swap_label() and ensure that the in-core label is native-byte order. for the write method, an on-stack copy is modified before writing, so that the in-core version remains valid. (this stack usage is below other stack usage in similar functions here.) adjust the label ioctls RAIDFRAME_GET_COMPONENT_LABEL and RAIDFRAME_GET_COMPONENT_LABEL80 to return the byte-swapped version so that eg, raidctl -s reports the right version. when performing final configuration of a raidset, report if a label swapped, and also complain if there are differently swapped versions on the other components. tested on arm64, sparc64 and amd64 ok @oster To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/raidframe/rf_compat80.c cvs rdiff -u -r1.136 -r1.137 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.393 -r1.394 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.