Fix cross-endian interoperability of zstd

It turns out that layouts of union bitfields are a pain, and the
current code results in an inconsistent layout between BE and LE
systems, leading to zstd-active datasets on one erroring out on
the other.

Switch everyone over to the LE layout, and add compatibility code
to read both.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12008
Closes #12022
This commit is contained in:
Rich Ercolani
2021-08-30 17:13:46 -04:00
committed by GitHub
parent c3cb57ae47
commit b1a1c64313
6 changed files with 165 additions and 19 deletions
+11
View File
@@ -0,0 +1,11 @@
#ifdef __sparc__
#include <stdint.h>
#include <sys/byteorder.h>
#include "include/sparc_compat.h"
uint64_t __bswapdi2(uint64_t in) {
return (BSWAP_64(in));
}
uint32_t __bswapsi2(uint32_t in) {
return (BSWAP_32(in));
}
#endif