diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2018-04-20 10:03:01 -0500 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2018-05-03 16:40:01 -0500 |
commit | 7e8d76b3de932520789a8fb2920cd4b6fde9d388 (patch) | |
tree | dc338381bf61c2855f6caa18f2bb9e8dfd351c27 | |
parent | eaa1ee05ea9287acfea0dfd9ccf84b9180caff58 (diff) | |
download | phosphor-bmc-code-mgmt-7e8d76b3de932520789a8fb2920cd4b6fde9d388.tar.gz phosphor-bmc-code-mgmt-7e8d76b3de932520789a8fb2920cd4b6fde9d388.zip |
sync_manager: Initial commit
Create a new sync manager to handle file sync
operations, such as copying persistent files to the
alternate BMC chip for backup. Make the new sync
manager optional via a compile flag since this function
requires that the system has a second BMC chip.
Change-Id: I2fbf7903d0baaa162e0ce62e8548db2cf2782398
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | Makefile.am | 8 | ||||
-rwxr-xr-x | configure.ac | 12 | ||||
-rw-r--r-- | sync_manager.hpp | 28 | ||||
-rw-r--r-- | sync_manager_main.cpp | 15 |
5 files changed, 64 insertions, 0 deletions
@@ -44,6 +44,7 @@ Makefile.in /phosphor-version-software-manager /phosphor-download-manager /phosphor-image-updater +/phosphor-sync-software-manager server.hpp server.cpp error.hpp diff --git a/Makefile.am b/Makefile.am index 10c3bf8..b4755c5 100755 --- a/Makefile.am +++ b/Makefile.am @@ -44,6 +44,14 @@ noinst_HEADERS += image_verify.hpp phosphor_image_updater_SOURCES += image_verify.cpp endif +if WANT_SYNC +noinst_HEADERS += sync_manager.hpp +sbin_PROGRAMS += phosphor-sync-software-manager +phosphor_sync_software_manager_SOURCES = sync_manager_main.cpp +phosphor_sync_software_manager_CXXFLAGS = $(generic_cxxflags) +phosphor_sync_software_manager_LDFLAGS = $(generic_ldflags) +endif + nodist_phosphor_image_updater_SOURCES = \ org/openbmc/Associations/server.cpp diff --git a/configure.ac b/configure.ac index 773071c..65afe9a 100755 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,11 @@ AS_IF([test "x$DOWNLOAD_BUSNAME" == "x"], [DOWNLOAD_BUSNAME="xyz.openbmc_project.Software.Download"]) AC_DEFINE_UNQUOTED([DOWNLOAD_BUSNAME], ["$DOWNLOAD_BUSNAME"], [The DBus busname to own]) +AC_ARG_VAR(SYNC_BUSNAME, [The D-Bus busname to own]) +AS_IF([test "x$SYNC_BUSNAME" == "x"], + [SYNC_BUSNAME="xyz.openbmc_project.Software.Sync"]) +AC_DEFINE_UNQUOTED([SYNC_BUSNAME], ["$SYNC_BUSNAME"], [The D-Bus busname to own]) + AC_DEFINE([MAPPER_BUSNAME], ["xyz.openbmc_project.ObjectMapper"], [Object mapper bus name]) AC_DEFINE([MAPPER_INTERFACE], ["xyz.openbmc_project.ObjectMapper"], [Object mapper interface]) AC_DEFINE([MAPPER_PATH], ["/xyz/openbmc_project/object_mapper"], [Object mapper DBUS path]) @@ -139,6 +144,13 @@ AM_CONDITIONAL([WANT_SIGNATURE_VERIFY_BUILD], [test "x$enable_verify_signature" AC_DEFINE(BUSNAME_UPDATER, "xyz.openbmc_project.Software.BMC.Updater", [The item updater DBus busname to own.]) +# setup sync of filesystem files +AC_ARG_ENABLE([sync_bmc_files], + AS_HELP_STRING([--enable-sync_bmc_files], [Enable sync of filesystem files.])) +AS_IF([test "x$enable_sync_bmc_files" == "xyes"], \ + [AC_DEFINE([WANT_SYNC],[],[Enable sync of filesystem files.])]) +AM_CONDITIONAL([WANT_SYNC], [test "x$enable_sync_bmc_files" == "xyes"]) + # Check for header files. AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) AC_CHECK_HEADER(sdbusplus/server.hpp, ,[AC_MSG_ERROR([Could not find sdbusplus/server.hpp...openbmc/sdbusplus package required])]) diff --git a/sync_manager.hpp b/sync_manager.hpp new file mode 100644 index 0000000..a48a806 --- /dev/null +++ b/sync_manager.hpp @@ -0,0 +1,28 @@ +#pragma once + +namespace phosphor +{ +namespace software +{ +namespace manager +{ + +/** @class Sync + * @brief Contains filesystem sync functions. + * @details The software manager class that contains functions to perform + * sync operations. + */ +class Sync +{ + public: + Sync() = default; + Sync(const Sync&) = delete; + Sync& operator=(const Sync&) = delete; + Sync(Sync&&) = default; + Sync& operator=(Sync&&) = default; + ~Sync() = default; +}; + +} // namespace manager +} // namespace software +} // namespace phosphor diff --git a/sync_manager_main.cpp b/sync_manager_main.cpp new file mode 100644 index 0000000..09aea5c --- /dev/null +++ b/sync_manager_main.cpp @@ -0,0 +1,15 @@ +#include <sdbusplus/bus.hpp> +#include <sdbusplus/server/manager.hpp> +#include "config.h" +#include "sync_manager.hpp" + +int main(int argc, char* argv[]) +{ + auto bus = sdbusplus::bus::new_default(); + + sdbusplus::server::manager::manager objManager(bus, SOFTWARE_OBJPATH); + phosphor::software::manager::Sync syncManager(); + bus.request_name(SYNC_BUSNAME); + + return 0; +} |