flash-ipmi: implement flashStartTransfer
Change-Id: I207f350dad3d73dacf1216e7742637531b50ea1a
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/flash-ipmi.hpp b/flash-ipmi.hpp
index 5e5fb22..7b60b05 100644
--- a/flash-ipmi.hpp
+++ b/flash-ipmi.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <string>
#include <vector>
#include "host-ipmid/ipmid-api.h"
@@ -148,8 +149,10 @@
class FlashUpdate : public UpdateInterface
{
public:
- FlashUpdate() = default;
- ~FlashUpdate() = default;
+ FlashUpdate(const std::string& stagingPath) :
+ flashLength(0), flashFd(nullptr), tmpPath(stagingPath){};
+ ~FlashUpdate();
+
FlashUpdate(const FlashUpdate&) = default;
FlashUpdate& operator=(const FlashUpdate&) = default;
FlashUpdate(FlashUpdate&&) = default;
@@ -168,6 +171,11 @@
private:
/**
+ * Tries to close out everything.
+ */
+ void closeEverything();
+
+ /**
* Tries to close out and delete anything staged.
*/
void abortEverything();
@@ -178,4 +186,13 @@
* @return false on failure.
*/
bool openEverything();
+
+ /* The length of the flash image in bytes. */
+ uint32_t flashLength;
+
+ /* The file handle to the flash staging file. */
+ std::FILE* flashFd;
+
+ /* Where the bytes are written before verification. */
+ const std::string tmpPath;
};