Remove SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
Fix the code to support new sdbusplus error without
SDBUSPP_REMOVE_DEPRECATED_NAMESPACE.
Change-Id: I12713ec1757d3835e1acf07c7abf409ff97615e1
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/callouts/callout_test.cpp b/callouts/callout_test.cpp
index 87614cb..9088243 100644
--- a/callouts/callout_test.cpp
+++ b/callouts/callout_test.cpp
@@ -16,7 +16,7 @@
return -1;
}
- using namespace example::xyz::openbmc_project::Example::Elog;
+ using namespace example::xyz::openbmc_project::example::elog;
try
{
elog<TestCallout>(TestCallout::DEV_ADDR(0xDEADEAD),
diff --git a/elog_block.hpp b/elog_block.hpp
index 2e2db44..1d25e6c 100644
--- a/elog_block.hpp
+++ b/elog_block.hpp
@@ -14,8 +14,8 @@
{
using BlockIface = sdbusplus::server::object_t<
- sdbusplus::xyz::openbmc_project::Logging::server::ErrorBlocksTransition,
- sdbusplus::xyz::openbmc_project::Association::server::Definitions>;
+ sdbusplus::server::xyz::openbmc_project::logging::ErrorBlocksTransition,
+ sdbusplus::server::xyz::openbmc_project::association::Definitions>;
using AssociationList =
std::vector<std::tuple<std::string, std::string, std::string>>;
diff --git a/elog_entry.cpp b/elog_entry.cpp
index 85751ed..37a1f53 100644
--- a/elog_entry.cpp
+++ b/elog_entry.cpp
@@ -23,12 +23,12 @@
bool Entry::resolved(bool value)
{
auto current =
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolved();
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved();
if (value != current)
{
value ? associations({}) : associations(assocs);
current =
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolved(
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved(
value);
uint64_t ms = std::chrono::duration_cast<std::chrono::milliseconds>(
@@ -45,11 +45,11 @@
std::string Entry::eventId(std::string value)
{
auto current =
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::eventId();
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::eventId();
if (value != current)
{
current =
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::eventId(
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::eventId(
value);
serialize(*this);
}
@@ -60,11 +60,11 @@
std::string Entry::resolution(std::string value)
{
auto current =
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolution();
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::resolution();
if (value != current)
{
current =
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolution(
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::resolution(
value);
serialize(*this);
}
diff --git a/elog_entry.hpp b/elog_entry.hpp
index 87cc7ea..d8b9025 100644
--- a/elog_entry.hpp
+++ b/elog_entry.hpp
@@ -17,11 +17,11 @@
{
using EntryIfaces = sdbusplus::server::object_t<
- sdbusplus::xyz::openbmc_project::Logging::server::Entry,
- sdbusplus::xyz::openbmc_project::Object::server::Delete,
- sdbusplus::xyz::openbmc_project::Association::server::Definitions,
- sdbusplus::xyz::openbmc_project::Software::server::Version,
- sdbusplus::xyz::openbmc_project::Common::server::FilePath>;
+ sdbusplus::server::xyz::openbmc_project::logging::Entry,
+ sdbusplus::server::xyz::openbmc_project::object::Delete,
+ sdbusplus::server::xyz::openbmc_project::association::Definitions,
+ sdbusplus::server::xyz::openbmc_project::software::Version,
+ sdbusplus::server::xyz::openbmc_project::common::FilePath>;
using AssociationList =
std::vector<std::tuple<std::string, std::string, std::string>>;
@@ -79,7 +79,7 @@
associations(std::move(objects), true);
// Store a copy of associations in case we need to recreate
assocs = associations();
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolved(false,
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved(false,
true);
version(fwVersion, true);
@@ -113,7 +113,7 @@
*/
bool resolved(bool value) override;
- using sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolved;
+ using sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved;
/** @brief Update eventId string of the error.
* @param[in] value - The eventID
@@ -121,7 +121,7 @@
*/
std::string eventId(std::string value) override;
- using sdbusplus::xyz::openbmc_project::Logging::server::Entry::eventId;
+ using sdbusplus::server::xyz::openbmc_project::logging::Entry::eventId;
/** @brief Update resolution string of the error.
* @param[in] value - The resolution
@@ -129,7 +129,7 @@
*/
std::string resolution(std::string value) override;
- using sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolution;
+ using sdbusplus::server::xyz::openbmc_project::logging::Entry::resolution;
/** @brief Delete this d-bus object.
*/
diff --git a/elog_meta.cpp b/elog_meta.cpp
index f2883b7..e8d7174 100644
--- a/elog_meta.cpp
+++ b/elog_meta.cpp
@@ -14,7 +14,7 @@
#if defined PROCESS_META
template <>
-void build<xyz::openbmc_project::Common::Callout::Device::CALLOUT_DEVICE_PATH>(
+void build<xyz::openbmc_project::common::callout::Device::CALLOUT_DEVICE_PATH>(
const std::string& match, const std::vector<std::string>& data,
AssociationList& list)
{
@@ -40,7 +40,7 @@
template <>
void build<
- xyz::openbmc_project::Common::Callout::Inventory::CALLOUT_INVENTORY_PATH>(
+ xyz::openbmc_project::common::callout::Inventory::CALLOUT_INVENTORY_PATH>(
const std::string& match, const std::vector<std::string>& data,
AssociationList& list)
{
diff --git a/elog_meta.hpp b/elog_meta.hpp
index 2272cf5..49ebd59 100644
--- a/elog_meta.hpp
+++ b/elog_meta.hpp
@@ -79,7 +79,7 @@
// Example template specialization - we don't want to do anything
// for this metadata.
-using namespace example::xyz::openbmc_project::Example::Elog;
+using namespace example::xyz::openbmc_project::example::elog;
template <>
inline void
build<TestErrorTwo::DEV_ID>(const std::string& /*match*/,
@@ -89,7 +89,7 @@
template <>
inline void
- build<example::xyz::openbmc_project::Example::Device::Callout::
+ build<example::xyz::openbmc_project::example::device::Callout::
CALLOUT_DEVICE_PATH_TEST>(const std::string& match,
const std::vector<std::string>& data,
AssociationList& list)
@@ -122,13 +122,13 @@
#if defined PROCESS_META
template <>
-void build<xyz::openbmc_project::Common::Callout::Device::CALLOUT_DEVICE_PATH>(
+void build<xyz::openbmc_project::common::callout::Device::CALLOUT_DEVICE_PATH>(
const std::string& match, const std::vector<std::string>& data,
AssociationList& list);
template <>
void build<
- xyz::openbmc_project::Common::Callout::Inventory::CALLOUT_INVENTORY_PATH>(
+ xyz::openbmc_project::common::callout::Inventory::CALLOUT_INVENTORY_PATH>(
const std::string& match, const std::vector<std::string>& data,
AssociationList& list);
diff --git a/elog_serialize.cpp b/elog_serialize.cpp
index d1de0c6..1ed63ed 100644
--- a/elog_serialize.cpp
+++ b/elog_serialize.cpp
@@ -45,7 +45,7 @@
template <class Archive>
void load(Archive& a, Entry& e, const std::uint32_t version)
{
- using namespace sdbusplus::xyz::openbmc_project::Logging::server;
+ using namespace sdbusplus::server::xyz::openbmc_project::logging;
uint32_t id{};
Entry::Level severity{};
@@ -92,11 +92,11 @@
e.timestamp(timestamp, true);
e.message(message, true);
e.additionalData(additionalData, true);
- e.sdbusplus::xyz::openbmc_project::Logging::server::Entry::resolved(
+ e.sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved(
resolved, true);
e.associations(associations, true);
e.version(fwVersion, true);
- e.purpose(sdbusplus::xyz::openbmc_project::Software::server::Version::
+ e.purpose(sdbusplus::server::xyz::openbmc_project::software::Version::
VersionPurpose::BMC,
true);
e.updateTimestamp(updateTimestamp, true);
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index eaedcff..1c51167 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -106,8 +106,8 @@
"xyz.openbmc_project.Inventory.Item.PowerSupply";
} // namespace interface
-using namespace sdbusplus::xyz::openbmc_project::State::Boot::server;
-using namespace sdbusplus::xyz::openbmc_project::State::server;
+using namespace sdbusplus::server::xyz::openbmc_project::state::boot;
+using namespace sdbusplus::server::xyz::openbmc_project::state;
namespace match_rules = sdbusplus::bus::match::rules;
const DBusInterfaceList hotplugInterfaces{interface::invFan,
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index 29fe67e..9a64722 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -46,7 +46,7 @@
namespace common_error = sdbusplus::xyz::openbmc_project::Common::Error;
-using Create = sdbusplus::xyz::openbmc_project::Logging::server::Create;
+using Create = sdbusplus::server::xyz::openbmc_project::logging::Create;
namespace additional_data
{
@@ -632,7 +632,7 @@
std::string message, Entry::Level severity,
std::map<std::string, std::string> additionalData,
std::vector<std::tuple<
- sdbusplus::xyz::openbmc_project::Logging::server::Create::FFDCFormat,
+ sdbusplus::server::xyz::openbmc_project::logging::Create::FFDCFormat,
uint8_t, uint8_t, sdbusplus::message::unix_fd>>
fFDC)
{
diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp
index b8c5442..c5bda7f 100644
--- a/extensions/openpower-pels/manager.hpp
+++ b/extensions/openpower-pels/manager.hpp
@@ -551,7 +551,7 @@
*/
std::map<std::string,
std::unique_ptr<
- sdbusplus::org::open_power::Logging::PEL::server::Entry>>
+ sdbusplus::server::org::open_power::logging::pel::Entry>>
_pelEntries;
/**
diff --git a/extensions/openpower-pels/pel_entry.cpp b/extensions/openpower-pels/pel_entry.cpp
index 3515128..89e9dd0 100644
--- a/extensions/openpower-pels/pel_entry.cpp
+++ b/extensions/openpower-pels/pel_entry.cpp
@@ -11,11 +11,11 @@
bool PELEntry::managementSystemAck(bool value)
{
- auto current = sdbusplus::org::open_power::Logging::PEL::server::Entry::
+ auto current = sdbusplus::server::org::open_power::logging::pel::Entry::
managementSystemAck();
if (value != current)
{
- current = sdbusplus::org::open_power::Logging::PEL::server::Entry::
+ current = sdbusplus::server::org::open_power::logging::pel::Entry::
managementSystemAck(value);
Repository::LogID id{Repository::LogID::Obmc(getMyId())};
diff --git a/extensions/openpower-pels/pel_entry.hpp b/extensions/openpower-pels/pel_entry.hpp
index f42fc3b..482efce 100644
--- a/extensions/openpower-pels/pel_entry.hpp
+++ b/extensions/openpower-pels/pel_entry.hpp
@@ -6,7 +6,7 @@
namespace pels
{
-using PELEntryIface = sdbusplus::org::open_power::Logging::PEL::server::Entry;
+using PELEntryIface = sdbusplus::server::org::open_power::logging::pel::Entry;
using PropertiesVariant = PELEntryIface::PropertiesVariant;
class PELEntry : public PELEntryIface
diff --git a/extensions/openpower-pels/phal_service_actions.hpp b/extensions/openpower-pels/phal_service_actions.hpp
index 8d8652c..8032663 100644
--- a/extensions/openpower-pels/phal_service_actions.hpp
+++ b/extensions/openpower-pels/phal_service_actions.hpp
@@ -13,7 +13,7 @@
{
using EntrySeverity =
- sdbusplus::xyz::openbmc_project::HardwareIsolation::server::Entry::Type;
+ sdbusplus::server::xyz::openbmc_project::hardware_isolation::Entry::Type;
/**
* @brief Helper function to create service actions in the PEL
diff --git a/lib/elog.cpp b/lib/elog.cpp
index 11daee7..60e9a82 100644
--- a/lib/elog.cpp
+++ b/lib/elog.cpp
@@ -10,7 +10,7 @@
{
namespace details
{
-using namespace sdbusplus::xyz::openbmc_project::Logging::server;
+using namespace sdbusplus::server::xyz::openbmc_project::logging;
auto _prepareMsg(const char* funcName)
{
diff --git a/lib/include/phosphor-logging/elog.hpp b/lib/include/phosphor-logging/elog.hpp
index b3227e5..228f549 100644
--- a/lib/include/phosphor-logging/elog.hpp
+++ b/lib/include/phosphor-logging/elog.hpp
@@ -13,7 +13,7 @@
namespace logging
{
-using namespace sdbusplus::xyz::openbmc_project::Logging::server;
+using namespace sdbusplus::server::xyz::openbmc_project::logging;
/**
* @brief Structure used by callers to indicate they want to use the last value
diff --git a/log_manager.cpp b/log_manager.cpp
index d3a50cd..cf7ef60 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -335,7 +335,7 @@
void Manager::checkAndQuiesceHost()
{
- using Host = sdbusplus::xyz::openbmc_project::State::server::Host;
+ using Host = sdbusplus::server::xyz::openbmc_project::state::Host;
// First check host state
std::variant<Host::HostState> property;
diff --git a/log_manager.hpp b/log_manager.hpp
index 275530e..8f5ca43 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -20,9 +20,9 @@
extern const std::map<std::string, std::vector<std::string>> g_errMetaMap;
extern const std::map<std::string, level> g_errLevelMap;
-using CreateIface = sdbusplus::xyz::openbmc_project::Logging::server::Create;
+using CreateIface = sdbusplus::server::xyz::openbmc_project::logging::Create;
using DeleteAllIface =
- sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll;
+ sdbusplus::server::xyz::openbmc_project::collection::DeleteAll;
namespace details
{
@@ -30,7 +30,7 @@
using ServerObject = typename sdbusplus::server::object_t<T...>;
using ManagerIface =
- sdbusplus::xyz::openbmc_project::Logging::Internal::server::Manager;
+ sdbusplus::server::xyz::openbmc_project::logging::internal::Manager;
} // namespace details
@@ -184,7 +184,7 @@
*/
void create(
const std::string& message,
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level severity,
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::Level severity,
const std::map<std::string, std::string>& additionalData);
/** @brief Creates an event log, and accepts FFDC files
@@ -203,7 +203,7 @@
*/
void createWithFFDC(
const std::string& message,
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level severity,
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::Level severity,
const std::map<std::string, std::string>& additionalData,
const FFDCEntries& ffdc);
@@ -381,7 +381,7 @@
*/
void create(
std::string message,
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level severity,
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::Level severity,
std::map<std::string, std::string> additionalData) override
{
manager.create(message, severity, additionalData);
@@ -399,7 +399,7 @@
*/
void createWithFFDCFiles(
std::string message,
- sdbusplus::xyz::openbmc_project::Logging::server::Entry::Level severity,
+ sdbusplus::server::xyz::openbmc_project::logging::Entry::Level severity,
std::map<std::string, std::string> additionalData,
std::vector<std::tuple<CreateIface::FFDCFormat, uint8_t, uint8_t,
sdbusplus::message::unix_fd>>
diff --git a/logging_test.cpp b/logging_test.cpp
index 2f751f3..c0350f5 100644
--- a/logging_test.cpp
+++ b/logging_test.cpp
@@ -92,27 +92,27 @@
const char* test_string = "/tmp/test_string/";
try
{
- elog<example::xyz::openbmc_project::Example::Elog::TestErrorOne>(
- example::xyz::openbmc_project::Example::Elog::TestErrorOne::ERRNUM(
+ elog<example::xyz::openbmc_project::example::elog::TestErrorOne>(
+ example::xyz::openbmc_project::example::elog::TestErrorOne::ERRNUM(
number),
- example::xyz::openbmc_project::Example::Elog::TestErrorOne::
+ example::xyz::openbmc_project::example::elog::TestErrorOne::
FILE_PATH(test_string),
- example::xyz::openbmc_project::Example::Elog::TestErrorOne::
+ example::xyz::openbmc_project::example::elog::TestErrorOne::
FILE_NAME("elog_test_3.txt"),
- example::xyz::openbmc_project::Example::Elog::TestErrorTwo::
+ example::xyz::openbmc_project::example::elog::TestErrorTwo::
DEV_ADDR(0xDEADDEAD),
- example::xyz::openbmc_project::Example::Elog::TestErrorTwo::DEV_ID(
+ example::xyz::openbmc_project::example::elog::TestErrorTwo::DEV_ID(
100),
- example::xyz::openbmc_project::Example::Elog::TestErrorTwo::
+ example::xyz::openbmc_project::example::elog::TestErrorTwo::
DEV_NAME("test case 3"));
}
- catch (const example::xyz::openbmc_project::Example::Elog::TestErrorOne& e)
+ catch (const example::xyz::openbmc_project::example::elog::TestErrorOne& e)
{
std::cout << "elog exception caught: " << e.what() << std::endl;
}
// Reduce our error namespaces
- using namespace example::xyz::openbmc_project::Example::Elog;
+ using namespace example::xyz::openbmc_project::example::elog;
// Now read back and verify our data made it into the journal
std::stringstream stream;
@@ -208,12 +208,12 @@
{
try
{
- elog<example::xyz::openbmc_project::Example::Elog::AutoTestSimple>(
- example::xyz::openbmc_project::Example::Elog::AutoTestSimple::
+ elog<example::xyz::openbmc_project::example::elog::AutoTestSimple>(
+ example::xyz::openbmc_project::example::elog::AutoTestSimple::
STRING("FOO"));
}
catch (
- const example::xyz::openbmc_project::Example::Elog::AutoTestSimple&
+ const example::xyz::openbmc_project::example::elog::AutoTestSimple&
e)
{
std::cout << "elog exception caught: " << e.what() << std::endl;
@@ -222,8 +222,8 @@
}
else if (std::strcmp(text, "AutoTestCreateAndCommit") == 0)
{
- report<example::xyz::openbmc_project::Example::Elog::AutoTestSimple>(
- example::xyz::openbmc_project::Example::Elog::AutoTestSimple::
+ report<example::xyz::openbmc_project::example::elog::AutoTestSimple>(
+ example::xyz::openbmc_project::example::elog::AutoTestSimple::
STRING("FOO"));
}
diff --git a/phosphor-rsyslog-config/server-conf.cpp b/phosphor-rsyslog-config/server-conf.cpp
index 76e310e..36149a5 100644
--- a/phosphor-rsyslog-config/server-conf.cpp
+++ b/phosphor-rsyslog-config/server-conf.cpp
@@ -24,7 +24,7 @@
namespace utils = phosphor::rsyslog_utils;
using namespace phosphor::logging;
-using namespace sdbusplus::xyz::openbmc_project::Common::Error;
+using namespace sdbusplus::error::xyz::openbmc_project::common;
namespace internal
{
@@ -123,7 +123,7 @@
std::string Server::address(std::string value)
{
- using Argument = xyz::openbmc_project::Common::InvalidArgument;
+ using Argument = xyz::openbmc_project::common::InvalidArgument;
std::string result{};
try
diff --git a/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp b/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp
index a846c2f..2a6aa01 100644
--- a/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp
+++ b/tools/phosphor-logging/templates/elog-process-metadata.mako.cpp
@@ -10,14 +10,22 @@
#include "elog_meta.hpp"
using namespace phosphor::logging;
-using namespace example::xyz::openbmc_project::Example::Elog;
+using namespace example::xyz::openbmc_project::example::elog;
using namespace std::placeholders;
extern const std::map<metadata::Metadata,
std::function<metadata::associations::Type>> meta = {
- % for key, value in metadata_process.items():
+% for key, value in metadata_process.items():
<%
- type = value.replace(".", "::")
+ import inflection
+ def sdbusplus_name(name):
+ names = name.split(".")
+ classname = inflection.camelize(names[-2])
+ metadata_field = names[-1]
+ namespace_name = "::".join([inflection.underscore(x) for x in names[:-2]])
+
+ return "::".join([namespace_name, classname, metadata_field])
+ type = sdbusplus_name(value)
%>\
{"${key}", metadata::associations::build<${type}>},
% endfor