Add a helper function copyRestFRUArea to updateFRUProperty

Refactoring updateFRUProperty function and created a new helper
function copyRestFRUArea. Moved this function to fru_utils.cpp
as it is common for all fru-device deamons and avoid code
duplication.

This patch is created based on suggestion on the below patch.
https://gerrit.openbmc.org/c/openbmc/entity-manager/+/51555

TESTED : Built Facebook YosemiteV2 images and loaded
on the target hardware. Verified all the fru's read and write.

Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Change-Id: I3a3ac6ff3190f0d91f5806e4824400cca0a590e4
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
diff --git a/include/fru_utils.hpp b/include/fru_utils.hpp
index d1784cd..0a988ef 100644
--- a/include/fru_utils.hpp
+++ b/include/fru_utils.hpp
@@ -68,6 +68,8 @@
     size_t size;           // Fru Area Size
     size_t end;            // Fru Area end offset
     size_t updateFieldLoc; // Fru Area update Field Location
+    size_t restFieldsLoc;  // Starting location of restFRUArea data
+    size_t restFieldsEnd;  // Ending location of restFRUArea data
 };
 
 const std::vector<std::string> fruAreaNames = {"INTERNAL", "CHASSIS", "BOARD",
@@ -170,10 +172,25 @@
 /// properties
 /// \param fruData - vector to store fru data
 /// \param propertyName - fru property Name
-/// \param fruAreaParams - struct to have fru Area paramteters like length,
-/// size. \return true if fru field is found, fruAreaParams are updated with
-/// fruArea and field info.
+/// \param fruAreaParams - struct to have fru Area parameters like length,
+/// size.
+/// \return true if fru field is found, fruAreaParams like updateFieldLoc,
+/// Start, Size, End are updated with fruArea and field info.
 bool findFruAreaLocationAndField(std::vector<uint8_t>& fruData,
                                  const std::string& propertyName,
-                                 struct FruArea& fruAreaParams,
-                                 size_t& fruDataIter);
+                                 struct FruArea& fruAreaParams);
+
+/// \brief Copy the fru Area fields and properties into restFRUAreaFieldsData.
+/// restFRUAreaField is the rest of the fields in FRU area after the field that
+/// is being updated.
+/// \param fruData - vector to store fru data
+/// \param propertyName - fru property Name
+/// \param fruAreaParams - struct to have fru Area parameters like length
+/// \param restFRUAreaFieldsData - vector to store fru Area Fields and
+/// properties.
+/// \return true on success false on failure. restFieldLoc and restFieldEnd
+/// are updated.
+bool copyRestFRUArea(std::vector<uint8_t>& fruData,
+                     const std::string& propertyName,
+                     struct FruArea& fruAreaParams,
+                     std::vector<uint8_t>& restFRUAreaFieldsData);