cleanup: drop default filesystem handler
Drop the default file system handler from the constructor and just pass
it in to the one place it's needed.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I356adccbca583c20097e4e8977ce157ecd706f81
diff --git a/cleanup/cleanup.hpp b/cleanup/cleanup.hpp
index 3120a3c..2266668 100644
--- a/cleanup/cleanup.hpp
+++ b/cleanup/cleanup.hpp
@@ -20,7 +20,7 @@
FileCleanupHandler(const std::string& blobId,
const std::vector<std::string>& files,
- const FileSystemInterface* helper = &fileSystemHelper) :
+ const FileSystemInterface* helper) :
supported(blobId),
files(files), helper(helper)
{}
diff --git a/cleanup/fs.cpp b/cleanup/fs.cpp
index b12d78f..06422f7 100644
--- a/cleanup/fs.cpp
+++ b/cleanup/fs.cpp
@@ -37,6 +37,4 @@
return;
}
-FileSystem fileSystemHelper;
-
} // namespace ipmi_flash
diff --git a/cleanup/fs.hpp b/cleanup/fs.hpp
index c206721..c67ef55 100644
--- a/cleanup/fs.hpp
+++ b/cleanup/fs.hpp
@@ -21,6 +21,4 @@
void remove(const std::string& path) const override;
};
-extern FileSystem fileSystemHelper;
-
} // namespace ipmi_flash
diff --git a/cleanup/main.cpp b/cleanup/main.cpp
index cfc3b63..0f82f4e 100644
--- a/cleanup/main.cpp
+++ b/cleanup/main.cpp
@@ -17,6 +17,7 @@
#include "config.h"
#include "cleanup.hpp"
+#include "fs.hpp"
#include "util.hpp"
#include <blobs-ipmid/blobs.hpp>
@@ -30,12 +31,15 @@
std::vector<std::string> files = {
STATIC_HANDLER_STAGED_NAME, TARBALL_STAGED_NAME, HASH_FILENAME,
VERIFY_STATUS_FILENAME, UPDATE_STATUS_FILENAME};
-}
+
+FileSystem fileSystemHelper;
+} // namespace ipmi_flash
extern "C" std::unique_ptr<blobs::GenericBlobInterface> createHandler()
{
auto handler = ipmi_flash::FileCleanupHandler::CreateCleanupHandler(
- ipmi_flash::cleanupBlobId, ipmi_flash::files);
+ ipmi_flash::cleanupBlobId, ipmi_flash::files,
+ &ipmi_flash::fileSystemHelper);
if (!handler)
{