blob: 44cf0bf257b30fe13eb6dc1e529f6761eea7c4e6 [file] [log] [blame]
Patrick Venture9efef5d2019-06-19 08:45:44 -07001/*
2 * Copyright 2019 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "config.h"
18
19#include "cleanup.hpp"
Patrick Venture80748c32020-07-16 10:30:11 -070020#include "fs.hpp"
Patrick Venture9efef5d2019-06-19 08:45:44 -070021#include "util.hpp"
22
23#include <blobs-ipmid/blobs.hpp>
Patrick Venture9b37b092020-05-28 20:58:57 -070024
25#include <memory>
Patrick Venture9efef5d2019-06-19 08:45:44 -070026#include <string>
27#include <vector>
28
29namespace ipmi_flash
30{
Brandon Kimcec91dd2019-09-16 17:24:40 -070031std::vector<std::string> files = {
32 STATIC_HANDLER_STAGED_NAME, TARBALL_STAGED_NAME, HASH_FILENAME,
33 VERIFY_STATUS_FILENAME, UPDATE_STATUS_FILENAME};
Patrick Venture80748c32020-07-16 10:30:11 -070034} // namespace ipmi_flash
Patrick Venture9efef5d2019-06-19 08:45:44 -070035
36extern "C" std::unique_ptr<blobs::GenericBlobInterface> createHandler()
37{
Patrick Venture9efef5d2019-06-19 08:45:44 -070038 auto handler = ipmi_flash::FileCleanupHandler::CreateCleanupHandler(
Patrick Venture80748c32020-07-16 10:30:11 -070039 ipmi_flash::cleanupBlobId, ipmi_flash::files,
Patrick Venture2950c252020-07-16 15:11:03 -070040 std::make_unique<ipmi_flash::FileSystem>());
Patrick Venture9efef5d2019-06-19 08:45:44 -070041
42 if (!handler)
43 {
Patrick Venture1ab824a2020-05-26 19:29:57 -070044 std::fprintf(stderr, "Unable to create FileCleanupHandle for Firmware");
Patrick Venture9efef5d2019-06-19 08:45:44 -070045 return nullptr;
46 }
47
48 return handler;
49}