diff options
author | Manojkiran Eda <manojkiran.eda@gmail.com> | 2020-04-30 16:36:48 +0300 |
---|---|---|
committer | ManojKiran Eda <manojkiran.eda@gmail.com> | 2020-05-15 08:18:05 +0300 |
commit | 55fd1a9ba83d2562df415b5b48f2c91f53123fa2 (patch) | |
tree | b50ad5cb97b54114feec05db35f43684e7e559e9 /include/ibm | |
parent | 5bb0ece5da042b38b74e5c156d6204c74828f0aa (diff) | |
download | bmcweb-55fd1a9ba83d2562df415b5b48f2c91f53123fa2.tar.xz |
AcquireLock : ResourceID Endianness Changes
- HMC constructs the resourceID with the First Segment
data in the First Byte of the resourceID from the MSB
position.
- As BMC is a Little Endian machine, and we need to convert
the endian-ness before processing the resourceID.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: Ieb0b0f8083c4c2cbd2b19477507e67378d5704ba
Diffstat (limited to 'include/ibm')
-rw-r--r-- | include/ibm/locks.hpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp index 66eb926263..79079c485e 100644 --- a/include/ibm/locks.hpp +++ b/include/ibm/locks.hpp @@ -2,6 +2,7 @@ #include <boost/algorithm/string.hpp> #include <boost/container/flat_map.hpp> +#include <boost/endian/conversion.hpp> #include <filesystem> #include <fstream> #include <nlohmann/json.hpp> @@ -717,9 +718,18 @@ inline bool Lock::isConflictRecord(const LockRequest refLockRecord1, for (uint32_t i = 0; i < p.second; i++) { // if the segment data is different , then the locks is on a - // different resource So no conflict between the lock records - if (!(checkByte(std::get<3>(refLockRecord1), - std::get<3>(refLockRecord2), i))) + // different resource So no conflict between the lock + // records. + // BMC is little endian , but the resourceID is formed by + // the Managament Console in such a way that, the first byte + // from the MSB Position corresponds to the First Segment + // data. Therefore we need to convert the in-comming + // resourceID into Big Endian before processing further. + if (!(checkByte(boost::endian::endian_reverse( + std::get<3>(refLockRecord1)), + boost::endian::endian_reverse( + std::get<3>(refLockRecord2)), + i))) { return false; } |