blob: 1321dfb5a7648e7954e1a4d22ad8a5d0a4fb594e [file] [log] [blame]
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file contains wrapper of fmap functions.
#ifndef HAMMERD_FMAP_UTILS_H_
#define HAMMERD_FMAP_UTILS_H_
#include <fmap.h>
#include <stdint.h>
#include <string>
#include <base/macros.h>
namespace hammerd {
class FmapInterface {
public:
virtual ~FmapInterface() = default;
virtual int64_t Find(const uint8_t* image, unsigned int len) = 0;
virtual const fmap_area* FindArea(const fmap* fmap,
const std::string& name) = 0;
};
class Fmap : public FmapInterface {
public:
Fmap() = default;
Fmap(const Fmap&) = delete;
Fmap& operator=(const Fmap&) = delete;
int64_t Find(const uint8_t* image, unsigned int len) override;
const fmap_area* FindArea(const fmap* fmap, const std::string& name) override;
};
} // namespace hammerd
#endif // HAMMERD_FMAP_UTILS_H_