xref: /openbmc/phosphor-ipmi-flash/util.hpp (revision 4857ab46)
1 #pragma once
2 #include <utility>
3 
4 namespace ipmi_flash
5 {
6 
7 inline constexpr char biosBlobId[] = "/flash/bios";
8 inline constexpr char updateBlobId[] = "/flash/update";
9 inline constexpr char verifyBlobId[] = "/flash/verify";
10 inline constexpr char hashBlobId[] = "/flash/hash";
11 inline constexpr char activeImageBlobId[] = "/flash/active/image";
12 inline constexpr char activeHashBlobId[] = "/flash/active/hash";
13 inline constexpr char staticLayoutBlobId[] = "/flash/image";
14 inline constexpr char ubiTarballBlobId[] = "/flash/tarball";
15 inline constexpr char cleanupBlobId[] = "/flash/cleanup";
16 
17 /** @brief Lightweight class wrapper that removes move operations from a class
18  *         in order to guarantee the contents stay pinned to a specific location
19  *         in memory.
20  */
21 template <typename T>
22 struct Pinned : public T
23 {
24     template <typename... Args>
25     Pinned(Args&&... args) : T(std::forward<Args>(args)...)
26     {}
27     template <typename Arg>
28     Pinned& operator=(const Arg& o)
29     {
30         *static_cast<T*>(this) = o;
31         return *this;
32     }
33 
34     Pinned(Pinned&&) = delete;
35     Pinned& operator=(Pinned&&) = delete;
36 };
37 
38 } // namespace ipmi_flash
39