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.