Prefix zfs internal endian checks with _ZFS

FreeBSD defines _BIG_ENDIAN BIG_ENDIAN _LITTLE_ENDIAN
LITTLE_ENDIAN on every architecture. Trying to do
cross builds whilst hiding this from ZFS has proven
extremely cumbersome.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #10621
This commit is contained in:
Matthew Macy
2020-07-28 13:02:49 -07:00
committed by GitHub
parent 3eabed74c0
commit 5678d3f593
23 changed files with 99 additions and 240 deletions
+6 -8
View File
@@ -40,16 +40,14 @@
#ifndef _SYS_BYTEORDER_H
#define _SYS_BYTEORDER_H
#include <sys/isa_defs.h>
#include <sys/int_types.h>
#if defined(__GNUC__) && defined(_ASM_INLINES) && \
(defined(__i386) || defined(__amd64))
#include <asm/byteorder.h>
#endif
#include <sys/isa_defs.h>
#include <sys/int_types.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -58,7 +56,7 @@ extern "C" {
* macros for conversion between host and (internet) network byte order
*/
#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
#if defined(_ZFS_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
/* big-endian */
#define ntohl(x) (x)
#define ntohs(x) (x)
@@ -108,7 +106,7 @@ extern in_port_t ntohs(in_port_t);
/*
* Macros to convert from a specific byte order to/from native byte order
*/
#ifdef _BIG_ENDIAN
#ifdef _ZFS_BIG_ENDIAN
#define BE_8(x) BMASK_8(x)
#define BE_16(x) BMASK_16(x)
#define BE_32(x) BMASK_32(x)
@@ -128,7 +126,7 @@ extern in_port_t ntohs(in_port_t);
#define BE_64(x) BSWAP_64(x)
#endif
#ifdef _BIG_ENDIAN
#ifdef _ZFS_BIG_ENDIAN
static __inline__ uint64_t
htonll(uint64_t n)
{