[PATCH openpower-host-ipmi-oem 4/8] fixed #define issue with byte swapping
OpenBMC Patches
patches at stwcx.xyz
Thu Oct 22 13:52:09 AEDT 2015
From: Chris Austen <austenc at us.ibm.com>
---
oemhandler.C | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/oemhandler.C b/oemhandler.C
index fa1b9a2..f05a0f3 100644
--- a/oemhandler.C
+++ b/oemhandler.C
@@ -9,7 +9,10 @@ const char *g_esel_path = "/tmp/";
uint16_t g_record_id = 0x0100;
-#define LSMSSWAP(x,y) (y<<8|x)
+#define LSMSSWAP(x,y) ((y)<<8|(x))
+
+const char *fio_wb[] = "wb";
+const char *fio_rb[] = "rb+";
///////////////////////////////////////////////////////////////////////////////
@@ -33,7 +36,6 @@ ipmi_ret_t ipmi_ibm_oem_partial_esel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
short offset = 0;
uint8_t rlen;
ipmi_ret_t rc = IPMI_CC_OK;
- char iocmd[][4] = { { "wb" }, {"rb+"} };
char string[64];
char *pio;
@@ -59,9 +61,9 @@ ipmi_ret_t ipmi_ibm_oem_partial_esel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// to indicate this is a new record rather then an ofset in
// my next commit TODO
if (offset == 0) {
- pio = iocmd[0];
+ pio = fio_wb;
} else {
- pio = iocmd[1];
+ pio = fio_rb;
}
if ((fp = fopen(string, pio)) != NULL) {
--
2.6.0
More information about the openbmc
mailing list