diff mbox

[PATCHv2,2/6] libpore: Add GLIBC style endianness detection

Message ID 1499251121-19678-3-git-send-email-akshay.adiga@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Akshay Adiga July 5, 2017, 10:38 a.m. UTC
p9_stop_api expects glibc style endianness check. Adding glibc style
endianness in endian.h under libpore.

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
---
 libpore/endian.h       | 29 +++++++++++++++++++++++++++++
 libpore/p9_stop_util.H |  4 +---
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 libpore/endian.h

Comments

Gautham R Shenoy July 5, 2017, 4:40 p.m. UTC | #1
On Wed, Jul 05, 2017 at 04:08:37PM +0530, Akshay Adiga wrote:
> p9_stop_api expects glibc style endianness check. Adding glibc style
> endianness in endian.h under libpore.
> 
> Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>

Tested-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
diff mbox

Patch

diff --git a/libpore/endian.h b/libpore/endian.h
new file mode 100644
index 0000000..22a12cf
--- /dev/null
+++ b/libpore/endian.h
@@ -0,0 +1,29 @@ 
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *	http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Adding GLIBC style endianness check required for p9_stop_api
+ */
+
+#include <ccan/endian/endian.h>
+
+#ifndef __BYTE_ORDER
+#define	__LITTLE_ENDIAN	1234
+#define	__BIG_ENDIAN	4321
+
+/* Support Glibc style endianness check */
+#define __BYTE_ORDER __BIG_ENDIAN
+#endif /* __BYTE_ORDER */
diff --git a/libpore/p9_stop_util.H b/libpore/p9_stop_util.H
index 3266fde..a649648 100644
--- a/libpore/p9_stop_util.H
+++ b/libpore/p9_stop_util.H
@@ -27,10 +27,8 @@ 
 
 #ifdef _AIX
     #define __BYTE_ORDER __BIG_ENDIAN
-#elif __SKIBOOT__
-    #include <skiboot.h>
 #else
-    #include <endian.h>
+    #include "endian.h"
 #endif
 
 #ifndef __PPE_PLAT