Editor implementation update for VPD-Manager app.
This commit updates the implementaion logic of reading VPD file
for vpd keyword update using VPD-Manager app.
In order to improve the efficiency, full vpd file will be read
in a single call instead of multiple blocks using multiple call.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: Ibf4c6ba1cfb1b098a542be7ade7f0046e444abbe
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index 79ab5a5..766583d 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -84,36 +84,12 @@
}
inventory::Path vpdFilePath = frus.find(path)->second;
- std::ifstream vpdStream(vpdFilePath, std::ios::binary);
- if (!vpdStream)
- {
- throw std::runtime_error("file not found");
- }
- Byte data;
- vpdStream.seekg(IPZ_DATA_START, std::ios::beg);
- vpdStream.get(*(reinterpret_cast<char*>(&data)));
+ // instantiate editor class to update the data
+ EditorImpl edit(vpdFilePath, recordName, keyword);
+ edit.updateKeyword(value);
- // implies it is IPZ VPD
- if (data == KW_VAL_PAIR_START_TAG)
- {
- Binary vpdHeader(lengths::VHDR_RECORD_LENGTH +
- lengths::VHDR_ECC_LENGTH);
- vpdStream.seekg(0);
- vpdStream.read(reinterpret_cast<char*>(vpdHeader.data()),
- vpdHeader.capacity());
-
- // check if header is valid
- openpower::vpd::keyword::editor::processHeader(
- std::move(vpdHeader));
-
- // instantiate editor class to update the data
- EditorImpl edit(vpdFilePath, recordName, keyword);
- edit.updateKeyword(value);
-
- return;
- }
- throw std::runtime_error("Invalid VPD file type");
+ return;
}
catch (const std::exception& e)
{