Update DIMM memorySizeInKB to be in size_t
Following the changes in
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/41870
where `MemorySizeInKB` type changed from `uint32` to `size`.
Tested:
On a 64-bit system, MemorySizeInKB has type `t`, which is uint64.
```
.MemorySizeInKB property t 33554432 emits-change writable
```
Before:
```
[ERROR "dbus_utils.hpp":21] DBUS property error in property: MemorySizeInKB, reason: 1
---
~# curl localhost/redfish/v1/Systems/system -s \
| grep -A7 MemorySummary
"MemorySummary": {
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Disabled"
},
"TotalSystemMemoryGiB": 0
},
```
After:
```
~# curl localhost/redfish/v1/Systems/system -s \
| grep -A7 MemorySummary
"MemorySummary": {
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"TotalSystemMemoryGiB": 64
},
```
Change-Id: Ifc66d4cf78ea81629957091bc4f3b407aa96355a
Signed-off-by: Anthony <anthonyhkf@google.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 1cedf2d..b051899 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -339,7 +339,7 @@
return;
}
- const uint32_t* memorySizeInKB = nullptr;
+ const size_t* memorySizeInKB = nullptr;
const bool success =
sdbusplus::unpackPropertiesNoThrow(
@@ -366,14 +366,16 @@
aResp->res
.jsonValue["MemorySummary"]
["TotalSystemMemoryGiB"] =
- *memorySizeInKB / (1024 * 1024);
+ *memorySizeInKB /
+ static_cast<size_t>(1024 * 1024);
}
else
{
aResp->res
.jsonValue["MemorySummary"]
["TotalSystemMemoryGiB"] =
- *memorySizeInKB / (1024 * 1024) +
+ *memorySizeInKB /
+ static_cast<size_t>(1024 * 1024) +
*preValue;
}
aResp->res.jsonValue["MemorySummary"]["Status"]