Convert version 1 files to version 2 on startup

When reading in persisted property values from their files, check the
version number the file was saved in.  If that version is less than the
first version using name/value pairs, then rewrite the file using the
latest version.

This is done so that it removes the possibility of the problem described
in openbmc/phosphor-settingsd/#16 of occurring in the future, which is
where if a new property is added it gets set to another property's
value.

This also creates functions for the serializing and deserializing so the
code to do it just needs to be in one place.

Note that if a version of code runs from when before NVP support was
added, it can still read files saved with the new version so this change
is backwards compatible.

Change-Id: Ib0be93de2151bc9435664179690b0eac2bb980ff
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
1 file changed