Refactor: Move watch to ubi
watch is ubi specific functions, move it to ubi dir.
Tested: On the last commit of the patch series, run code update and
factory reset on Witherspoon and all work fine.
Change-Id: Ia7f6b6de845ddd40e2a32ad626d3b7af9074c7f3
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/Makefile.am b/Makefile.am
index c924948..716e453 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,6 @@
activation.cpp \
version.cpp \
serialize.cpp \
- watch.cpp \
item_updater.cpp \
item_updater_main.cpp
diff --git a/item_updater_main.cpp b/item_updater_main.cpp
index d0d7554..e54239a 100644
--- a/item_updater_main.cpp
+++ b/item_updater_main.cpp
@@ -2,8 +2,8 @@
#ifdef UBIFS_LAYOUT
#include "ubi/item_updater_ubi.hpp"
+#include "ubi/watch.hpp"
#endif
-#include "watch.hpp"
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
@@ -35,10 +35,12 @@
bus.request_name(BUSNAME_UPDATER);
try
{
+#ifdef UBIFS_LAYOUT
openpower::software::updater::Watch watch(
loop,
std::bind(std::mem_fn(&ItemUpdater::updateFunctionalAssociation),
&updater, std::placeholders::_1));
+#endif
bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL);
auto rc = sd_event_loop(loop);
if (rc < 0)
diff --git a/test/Makefile.am b/test/Makefile.am
index 3dc6960..c4165ec 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -34,7 +34,7 @@
$(top_builddir)/openpower_update_manager-activation.o \
$(top_builddir)/openpower_update_manager-version.o \
$(top_builddir)/openpower_update_manager-serialize.o \
- $(top_builddir)/openpower_update_manager-watch.o \
+ $(top_builddir)/ubi/openpower_update_manager-watch.o \
$(top_builddir)/openpower_update_manager-item_updater.o \
$(top_builddir)/org/openbmc/Associations/openpower_update_manager-server.o \
$(top_builddir)/image_verify.cpp \
diff --git a/ubi/Makefile.am.include b/ubi/Makefile.am.include
index fba30d9..a836661 100644
--- a/ubi/Makefile.am.include
+++ b/ubi/Makefile.am.include
@@ -1,2 +1,3 @@
openpower_update_manager_SOURCES += \
- %reldir%/item_updater_ubi.cpp
+ %reldir%/item_updater_ubi.cpp \
+ %reldir%/watch.cpp
diff --git a/watch.cpp b/ubi/watch.cpp
similarity index 100%
rename from watch.cpp
rename to ubi/watch.cpp
diff --git a/watch.hpp b/ubi/watch.hpp
similarity index 100%
rename from watch.hpp
rename to ubi/watch.hpp