pldm: Rearranging datatype declaration
This commit adds support to eliminating duplication of datatypes which
enhancing clarity and manageability throughout the pldm repository.
This is rearrangement of declaration of data types so it can be used
host-bmc and oem layer both the places.
Change-Id: Ieb1232884b8e2128e8bf97dafd01e4ad5524ede0
Signed-off-by: Kamalkumar Patel <kamalkumar.patel@ibm.com>
diff --git a/host-bmc/host_pdr_handler.hpp b/host-bmc/host_pdr_handler.hpp
index 0af0f63..4fafe8d 100644
--- a/host-bmc/host_pdr_handler.hpp
+++ b/host-bmc/host_pdr_handler.hpp
@@ -23,7 +23,6 @@
namespace pldm
{
-using EntityType = uint16_t;
// vector which would hold the PDR record handle data returned by
// pldmPDRRepositoryChgEvent event data
using ChangeEntry = uint32_t;
@@ -324,11 +323,11 @@
/** @brief maps an object path to pldm_entity from the BMC's entity
* association tree
*/
- ObjectPathMaps objPathMap;
+ pldm::utils::ObjectPathMaps objPathMap;
/** @brief maps an entity name to map, maps to entity name to pldm_entity
*/
- EntityAssociations entityAssociations;
+ pldm::utils::EntityAssociations entityAssociations;
/** @brief the vector of FRU Record Data Format
*/
@@ -339,7 +338,7 @@
/** @brief entityID and entity name is only loaded once
*/
- EntityMaps entityMaps;
+ pldm::utils::EntityMaps entityMaps;
};
} // namespace pldm
diff --git a/host-bmc/test/meson.build b/host-bmc/test/meson.build
index fd3e8c9..9b7cbba 100644
--- a/host-bmc/test/meson.build
+++ b/host-bmc/test/meson.build
@@ -6,7 +6,6 @@
'../../common/utils.cpp',
'../utils.cpp',
'../custom_dbus.cpp',
- '../utils.cpp'
]
tests = [
diff --git a/host-bmc/utils.cpp b/host-bmc/utils.cpp
index 784401c..196e2f5 100644
--- a/host-bmc/utils.cpp
+++ b/host-bmc/utils.cpp
@@ -1,12 +1,12 @@
-#include "common/utils.hpp"
+#include "utils.hpp"
#include "libpldm/entity.h"
-#include "utils.hpp"
-
#include <cstdlib>
#include <iostream>
+using namespace pldm::utils;
+
namespace pldm
{
namespace hostbmc
diff --git a/host-bmc/utils.hpp b/host-bmc/utils.hpp
index 6a3629e..d576fd4 100644
--- a/host-bmc/utils.hpp
+++ b/host-bmc/utils.hpp
@@ -1,5 +1,6 @@
#include "libpldm/pdr.h"
+#include "common/utils.hpp"
#include "libpldmresponder/oem_handler.hpp"
#include <nlohmann/json.hpp>
@@ -12,17 +13,9 @@
#include <vector>
PHOSPHOR_LOG2_USING;
+
namespace pldm
{
-using Json = nlohmann::json;
-namespace fs = std::filesystem;
-using ObjectPath = fs::path;
-using EntityName = std::string;
-using EntityType = uint16_t;
-using Entities = std::vector<pldm_entity_node*>;
-using EntityAssociations = std::vector<Entities>;
-using ObjectPathMaps = std::map<ObjectPath, pldm_entity_node*>;
-using EntityMaps = std::map<EntityType, EntityName>;
namespace hostbmc
{
namespace utils
@@ -36,9 +29,9 @@
* @return
*/
void updateEntityAssociation(
- const EntityAssociations& entityAssoc,
- pldm_entity_association_tree* entityTree, ObjectPathMaps& objPathMap,
- EntityMaps entityMaps,
+ const pldm::utils::EntityAssociations& entityAssoc,
+ pldm_entity_association_tree* entityTree,
+ pldm::utils::ObjectPathMaps& objPathMap, pldm::utils::EntityMaps entityMaps,
pldm::responder::oem_platform::Handler* oemPlatformHandler);
/** @brief Parsing entity to DBus string mapping from json file
@@ -47,7 +40,7 @@
*
* @return returns the entity to DBus string mapping object
*/
-EntityMaps parseEntityMap(const fs::path& filePath);
+pldm::utils::EntityMaps parseEntityMap(const fs::path& filePath);
} // namespace utils
} // namespace hostbmc